<?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 Version20220510090542 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE configuration (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE address ADD firstname VARCHAR(255) NOT NULL, ADD lastname VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE cart DROP FOREIGN KEY FK_BA388B7B9D4965A');
$this->addSql('DROP INDEX IDX_BA388B7B9D4965A ON cart');
$this->addSql('ALTER TABLE cart DROP imei_id');
$this->addSql('ALTER TABLE imei ADD cart_id INT DEFAULT NULL, ADD sync TINYINT(1) DEFAULT NULL');
$this->addSql('ALTER TABLE imei ADD CONSTRAINT FK_B8179F81AD5CDBF FOREIGN KEY (cart_id) REFERENCES cart (id)');
$this->addSql('CREATE INDEX IDX_B8179F81AD5CDBF ON imei (cart_id)');
$this->addSql('ALTER TABLE `order` ADD temp_address_id INT DEFAULT NULL, ADD payment VARCHAR(16) DEFAULT NULL');
$this->addSql('ALTER TABLE `order` ADD CONSTRAINT FK_F5299398C3638859 FOREIGN KEY (temp_address_id) REFERENCES address (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F5299398C3638859 ON `order` (temp_address_id)');
$this->addSql('ALTER TABLE shop ADD apikey VARCHAR(255) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE configuration (id INT AUTO_INCREMENT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE address DROP firstname, DROP lastname');
$this->addSql('ALTER TABLE cart ADD imei_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE cart ADD CONSTRAINT FK_BA388B7B9D4965A FOREIGN KEY (imei_id) REFERENCES imei (id)');
$this->addSql('CREATE INDEX IDX_BA388B7B9D4965A ON cart (imei_id)');
$this->addSql('ALTER TABLE imei DROP FOREIGN KEY FK_B8179F81AD5CDBF');
$this->addSql('DROP INDEX IDX_B8179F81AD5CDBF ON imei');
$this->addSql('ALTER TABLE imei DROP cart_id, DROP sync');
$this->addSql('ALTER TABLE `order` DROP FOREIGN KEY FK_F5299398C3638859');
$this->addSql('DROP INDEX UNIQ_F5299398C3638859 ON `order`');
$this->addSql('ALTER TABLE `order` DROP temp_address_id, DROP payment');
$this->addSql('ALTER TABLE shop DROP apikey');
}
}