diff --git a/migrations/Version20250812113220.php b/migrations/Version20250812113220.php new file mode 100644 index 0000000..3537134 --- /dev/null +++ b/migrations/Version20250812113220.php @@ -0,0 +1,38 @@ +addSql('CREATE TABLE apps_organizations (apps_id INT NOT NULL, organizations_id INT NOT NULL, PRIMARY KEY(apps_id, organizations_id))'); + $this->addSql('CREATE INDEX IDX_FFE659D5A2D76671 ON apps_organizations (apps_id)'); + $this->addSql('CREATE INDEX IDX_FFE659D586288A55 ON apps_organizations (organizations_id)'); + $this->addSql('ALTER TABLE apps_organizations ADD CONSTRAINT FK_FFE659D5A2D76671 FOREIGN KEY (apps_id) REFERENCES apps (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE apps_organizations ADD CONSTRAINT FK_FFE659D586288A55 FOREIGN KEY (organizations_id) REFERENCES organizations (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE apps_organizations DROP CONSTRAINT FK_FFE659D5A2D76671'); + $this->addSql('ALTER TABLE apps_organizations DROP CONSTRAINT FK_FFE659D586288A55'); + $this->addSql('DROP TABLE apps_organizations'); + } +}