<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230311231902 extends AbstractMigration
{
public function getDescription(): string
{
return 'Dodanie tabeli z pasażerami';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE passenger (id INT AUTO_INCREMENT NOT NULL, order_id INT NOT NULL, first_name VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, country_of_residence VARCHAR(2) NOT NULL, INDEX IDX_3BEFE8DD8D9F6D38 (order_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE passenger ADD CONSTRAINT FK_3BEFE8DD8D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE `order` ADD last_name VARCHAR(255) DEFAULT NULL, CHANGE full_name first_name VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE passenger DROP FOREIGN KEY FK_3BEFE8DD8D9F6D38');
$this->addSql('DROP TABLE passenger');
$this->addSql('ALTER TABLE `order` ADD full_name VARCHAR(255) DEFAULT NULL, DROP first_name, DROP last_name');
}
}