You've already forked symfony-playground
inheritance
This commit is contained in:
48
migrations/Version20220522115037.php
Normal file
48
migrations/Version20220522115037.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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 Version20220522115037 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 person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL, job VARCHAR(255) DEFAULT NULL)');
|
||||
$this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)');
|
||||
$this->addSql('CREATE TABLE toothbrush2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL)');
|
||||
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
|
||||
$this->addSql('DROP TABLE employee1');
|
||||
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, CONSTRAINT FK_2250E3BCA25DC38 FOREIGN KEY (toothbrush1_id) REFERENCES toothbrush1 (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
||||
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
|
||||
$this->addSql('DROP TABLE __temp__employee1');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP TABLE person2');
|
||||
$this->addSql('DROP TABLE toothbrush2');
|
||||
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
|
||||
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
|
||||
$this->addSql('DROP TABLE employee1');
|
||||
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL)');
|
||||
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
|
||||
$this->addSql('DROP TABLE __temp__employee1');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user