<?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 Version20220829062234 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 model (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, image JSON NOT NULL, active TINYINT(1) DEFAULT 1, in_home TINYINT(1) DEFAULT 1, position INT NOT NULL, slug VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, dtype VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_D79572D9989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('DROP INDEX UNIQ_2F566B69989D9B62 ON bus');
$this->addSql('ALTER TABLE bus DROP title, DROP image, DROP active, DROP in_home, DROP position, DROP slug, DROP created_at, DROP modified_at, DROP created_user, DROP modified_user, CHANGE id id INT NOT NULL');
$this->addSql('ALTER TABLE bus ADD CONSTRAINT FK_2F566B69BF396750 FOREIGN KEY (id) REFERENCES model (id) ON DELETE CASCADE');
$this->addSql('DROP INDEX UNIQ_CDCCF30A989D9B62 ON truck');
$this->addSql('ALTER TABLE truck DROP title, DROP image, DROP active, DROP in_home, DROP position, DROP slug, DROP created_at, DROP modified_at, DROP created_user, DROP modified_user, CHANGE id id INT NOT NULL');
$this->addSql('ALTER TABLE truck ADD CONSTRAINT FK_CDCCF30ABF396750 FOREIGN KEY (id) REFERENCES model (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE bus DROP FOREIGN KEY FK_2F566B69BF396750');
$this->addSql('ALTER TABLE truck DROP FOREIGN KEY FK_CDCCF30ABF396750');
$this->addSql('DROP TABLE model');
$this->addSql('ALTER TABLE bus ADD title VARCHAR(255) NOT NULL, ADD image JSON NOT NULL, ADD active TINYINT(1) DEFAULT 1, ADD in_home TINYINT(1) DEFAULT 1, ADD position INT NOT NULL, ADD slug VARCHAR(255) NOT NULL, ADD created_at DATETIME DEFAULT NULL, ADD modified_at DATETIME DEFAULT NULL, ADD created_user INT DEFAULT NULL, ADD modified_user INT DEFAULT NULL, CHANGE id id INT AUTO_INCREMENT NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2F566B69989D9B62 ON bus (slug)');
$this->addSql('ALTER TABLE truck ADD title VARCHAR(255) NOT NULL, ADD image JSON NOT NULL, ADD active TINYINT(1) DEFAULT 1, ADD in_home TINYINT(1) DEFAULT 1, ADD position INT NOT NULL, ADD slug VARCHAR(255) NOT NULL, ADD created_at DATETIME DEFAULT NULL, ADD modified_at DATETIME DEFAULT NULL, ADD created_user INT DEFAULT NULL, ADD modified_user INT DEFAULT NULL, CHANGE id id INT AUTO_INCREMENT NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CDCCF30A989D9B62 ON truck (slug)');
}
}