addSql('DROP SEQUENCE collection.battery_type_id_seq CASCADE'); $this->addSql('CREATE TABLE collection.chipset (id SERIAL NOT NULL, brand_id INT NOT NULL, name VARCHAR(255) NOT NULL, parts VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_110BAE8044F5D008 ON collection.chipset (brand_id)'); $this->addSql('CREATE TABLE collection.motherboard (id SERIAL NOT NULL, brand_id INT NOT NULL, chipset_id INT DEFAULT NULL, model VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_5C3F5E3144F5D008 ON collection.motherboard (brand_id)'); $this->addSql('CREATE INDEX IDX_5C3F5E31BC1433B9 ON collection.motherboard (chipset_id)'); $this->addSql('CREATE TABLE collection.motherboard_socket_link (motherboard_id INT NOT NULL, socket_id INT NOT NULL, PRIMARY KEY(motherboard_id, socket_id))'); $this->addSql('CREATE INDEX IDX_D635BC6D6511E8A3 ON collection.motherboard_socket_link (motherboard_id)'); $this->addSql('CREATE INDEX IDX_D635BC6DD20E239C ON collection.motherboard_socket_link (socket_id)'); $this->addSql('ALTER TABLE collection.chipset ADD CONSTRAINT FK_110BAE8044F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E3144F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E31BC1433B9 FOREIGN KEY (chipset_id) REFERENCES collection.chipset (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6D6511E8A3 FOREIGN KEY (motherboard_id) REFERENCES collection.motherboard (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('DROP TABLE collection.battery_type'); } 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('CREATE SEQUENCE collection.battery_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $this->addSql('CREATE TABLE collection.battery_type (id SERIAL NOT NULL, PRIMARY KEY(id))'); $this->addSql('ALTER TABLE collection.chipset DROP CONSTRAINT FK_110BAE8044F5D008'); $this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E3144F5D008'); $this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E31BC1433B9'); $this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6D6511E8A3'); $this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6DD20E239C'); $this->addSql('DROP TABLE collection.chipset'); $this->addSql('DROP TABLE collection.motherboard'); $this->addSql('DROP TABLE collection.motherboard_socket_link'); } }