addSql('CREATE SEQUENCE degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE faq_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE intern_application_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE intern_degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE intern_favorite_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE intern_skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE message_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE TABLE degree (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE TABLE faq (id INT NOT NULL, question TEXT NOT NULL, answer TEXT DEFAULT NULL, update_date DATE NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE TABLE intern_application (id INT NOT NULL, application_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, application_date DATE NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_4EDBBCC83E030ACD ON intern_application (application_id)'); $this->addSql('CREATE INDEX IDX_4EDBBCC8525DD4B4 ON intern_application (intern_id)'); $this->addSql('CREATE TABLE intern_degree (id INT NOT NULL, degree_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, graduation_date DATE NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_E68CCB23B35C5756 ON intern_degree (degree_id)'); $this->addSql('CREATE INDEX IDX_E68CCB23525DD4B4 ON intern_degree (intern_id)'); $this->addSql('CREATE TABLE intern_favorite (id INT NOT NULL, announcement_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_A709862E913AEA17 ON intern_favorite (announcement_id)'); $this->addSql('CREATE INDEX IDX_A709862E525DD4B4 ON intern_favorite (intern_id)'); $this->addSql('CREATE TABLE intern_skill (id INT NOT NULL, skill_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_75E1C4DC5585C142 ON intern_skill (skill_id)'); $this->addSql('CREATE INDEX IDX_75E1C4DC525DD4B4 ON intern_skill (intern_id)'); $this->addSql('CREATE TABLE message (id INT NOT NULL, sender_id INT DEFAULT NULL, receiver_id INT DEFAULT NULL, content TEXT NOT NULL, sending_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_B6BD307FF624B39D ON message (sender_id)'); $this->addSql('CREATE INDEX IDX_B6BD307FCD53EDB6 ON message (receiver_id)'); $this->addSql('CREATE TABLE skill (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); $this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC83E030ACD FOREIGN KEY (application_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC8525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23B35C5756 FOREIGN KEY (degree_id) REFERENCES degree (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC5585C142 FOREIGN KEY (skill_id) REFERENCES skill (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FF624B39D FOREIGN KEY (sender_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FCD53EDB6 FOREIGN KEY (receiver_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $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'); $this->addSql('ALTER TABLE announcement ADD creation_date DATE NOT NULL'); } 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('DROP SEQUENCE degree_id_seq CASCADE'); $this->addSql('DROP SEQUENCE faq_id_seq CASCADE'); $this->addSql('DROP SEQUENCE intern_application_id_seq CASCADE'); $this->addSql('DROP SEQUENCE intern_degree_id_seq CASCADE'); $this->addSql('DROP SEQUENCE intern_favorite_id_seq CASCADE'); $this->addSql('DROP SEQUENCE intern_skill_id_seq CASCADE'); $this->addSql('DROP SEQUENCE message_id_seq CASCADE'); $this->addSql('DROP SEQUENCE skill_id_seq CASCADE'); $this->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_e46960f5913aea17 ON favorites (announcement_id)'); $this->addSql('CREATE INDEX idx_e46960f5525dd4b4 ON favorites (intern_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_f7c966f0913aea17 ON applications (announcement_id)'); $this->addSql('CREATE INDEX idx_f7c966f0525dd4b4 ON applications (intern_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'); $this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC83E030ACD'); $this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC8525DD4B4'); $this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23B35C5756'); $this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23525DD4B4'); $this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E913AEA17'); $this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E525DD4B4'); $this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC5585C142'); $this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC525DD4B4'); $this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FF624B39D'); $this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FCD53EDB6'); $this->addSql('DROP TABLE degree'); $this->addSql('DROP TABLE faq'); $this->addSql('DROP TABLE intern_application'); $this->addSql('DROP TABLE intern_degree'); $this->addSql('DROP TABLE intern_favorite'); $this->addSql('DROP TABLE intern_skill'); $this->addSql('DROP TABLE message'); $this->addSql('DROP TABLE skill'); $this->addSql('ALTER TABLE announcement DROP creation_date'); } }