From f2f2c3e6629fed13236ea6d4f0f3e341c802fd36 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sat, 30 Nov 2024 19:53:26 -0500 Subject: [PATCH] Replace migration --- ...0241130014227.php => Version20241130210724.php} | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) rename migrations/{Version20241130014227.php => Version20241130210724.php} (62%) diff --git a/migrations/Version20241130014227.php b/migrations/Version20241130210724.php similarity index 62% rename from migrations/Version20241130014227.php rename to migrations/Version20241130210724.php index e279aaf..fc1cf62 100644 --- a/migrations/Version20241130014227.php +++ b/migrations/Version20241130210724.php @@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20241130014227 extends AbstractMigration +final class Version20241130210724 extends AbstractMigration { public function getDescription(): string { @@ -20,20 +20,18 @@ final class Version20241130014227 extends AbstractMigration public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TABLE supervision (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', worker_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', UNIQUE INDEX UNIQ_30C258C06B20BA36 (worker_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE supervision (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', supervisor_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', worker_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_30C258C019E9AC5F (supervisor_id), UNIQUE INDEX UNIQ_30C258C06B20BA36 (worker_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('ALTER TABLE supervision ADD CONSTRAINT FK_30C258C019E9AC5F FOREIGN KEY (supervisor_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE supervision ADD CONSTRAINT FK_30C258C06B20BA36 FOREIGN KEY (worker_id) REFERENCES user (id)'); - $this->addSql('ALTER TABLE user ADD supervisor_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\''); - $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D64919E9AC5F FOREIGN KEY (supervisor_id) REFERENCES supervision (id)'); - $this->addSql('CREATE INDEX IDX_8D93D64919E9AC5F ON user (supervisor_id)'); + $this->addSql('ALTER TABLE user DROP supervisor_id'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D64919E9AC5F'); + $this->addSql('ALTER TABLE supervision DROP FOREIGN KEY FK_30C258C019E9AC5F'); $this->addSql('ALTER TABLE supervision DROP FOREIGN KEY FK_30C258C06B20BA36'); $this->addSql('DROP TABLE supervision'); - $this->addSql('DROP INDEX IDX_8D93D64919E9AC5F ON user'); - $this->addSql('ALTER TABLE user DROP supervisor_id'); + $this->addSql('ALTER TABLE user ADD supervisor_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\''); } }