addSql('CREATE SEQUENCE user_list_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE SEQUENCE user_list_film_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE TABLE user_list (id INT NOT NULL, viewer_id INT NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_3E49B4D16C59C752 ON user_list (viewer_id)'); $this->addSql('CREATE TABLE user_list_film (id INT NOT NULL, user_list_id INT DEFAULT NULL, film_id INT NOT NULL, position INT DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_C76AEC2F65A30881 ON user_list_film (user_list_id)'); $this->addSql('CREATE INDEX IDX_C76AEC2F567F5183 ON user_list_film (film_id)'); $this->addSql('ALTER TABLE user_list ADD CONSTRAINT FK_3E49B4D16C59C752 FOREIGN KEY (viewer_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE user_list_film ADD CONSTRAINT FK_C76AEC2F65A30881 FOREIGN KEY (user_list_id) REFERENCES user_list (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE user_list_film ADD CONSTRAINT FK_C76AEC2F567F5183 FOREIGN KEY (film_id) REFERENCES film (id) 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('DROP SEQUENCE user_list_id_seq CASCADE'); $this->addSql('DROP SEQUENCE user_list_film_id_seq CASCADE'); $this->addSql('ALTER TABLE user_list DROP CONSTRAINT FK_3E49B4D16C59C752'); $this->addSql('ALTER TABLE user_list_film DROP CONSTRAINT FK_C76AEC2F65A30881'); $this->addSql('ALTER TABLE user_list_film DROP CONSTRAINT FK_C76AEC2F567F5183'); $this->addSql('DROP TABLE user_list'); $this->addSql('DROP TABLE user_list_film'); } }