addSql('CREATE TABLE favorites (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))'); $this->addSql('CREATE INDEX IDX_E46960F5525DD4B4 ON favorites (intern_id)'); $this->addSql('CREATE INDEX IDX_E46960F5913AEA17 ON favorites (announcement_id)'); $this->addSql('CREATE TABLE applications (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))'); $this->addSql('CREATE INDEX IDX_F7C966F0525DD4B4 ON applications (intern_id)'); $this->addSql('CREATE INDEX IDX_F7C966F0913AEA17 ON applications (announcement_id)'); $this->addSql('ALTER TABLE favorites ADD CONSTRAINT FK_E46960F5525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE favorites ADD CONSTRAINT FK_E46960F5913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE applications ADD CONSTRAINT FK_F7C966F0525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE applications ADD CONSTRAINT FK_F7C966F0913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (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 favorites DROP CONSTRAINT FK_E46960F5525DD4B4'); $this->addSql('ALTER TABLE favorites DROP CONSTRAINT FK_E46960F5913AEA17'); $this->addSql('ALTER TABLE applications DROP CONSTRAINT FK_F7C966F0525DD4B4'); $this->addSql('ALTER TABLE applications DROP CONSTRAINT FK_F7C966F0913AEA17'); $this->addSql('DROP TABLE favorites'); $this->addSql('DROP TABLE applications'); } }