diff --git a/migrations/Version20260409075411.php b/migrations/Version20260409075411.php new file mode 100644 index 0000000..935eda5 --- /dev/null +++ b/migrations/Version20260409075411.php @@ -0,0 +1,37 @@ +addSql('CREATE TABLE task_collaborator (task_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY (task_id, user_id))'); + $this->addSql('CREATE INDEX IDX_A8FC6C518DB60186 ON task_collaborator (task_id)'); + $this->addSql('CREATE INDEX IDX_A8FC6C51A76ED395 ON task_collaborator (user_id)'); + $this->addSql('ALTER TABLE task_collaborator ADD CONSTRAINT FK_A8FC6C518DB60186 FOREIGN KEY (task_id) REFERENCES task (id) ON DELETE CASCADE NOT DEFERRABLE'); + $this->addSql('ALTER TABLE task_collaborator ADD CONSTRAINT FK_A8FC6C51A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE task_collaborator DROP CONSTRAINT FK_A8FC6C518DB60186'); + $this->addSql('ALTER TABLE task_collaborator DROP CONSTRAINT FK_A8FC6C51A76ED395'); + $this->addSql('DROP TABLE task_collaborator'); + } +}