addSql('CREATE TABLE collection.cpu_socket_link (socket_id INT NOT NULL, cpu_id INT NOT NULL, PRIMARY KEY(socket_id, cpu_id))'); $this->addSql('CREATE INDEX IDX_B1ADF47DD20E239C ON collection.cpu_socket_link (socket_id)'); $this->addSql('CREATE INDEX IDX_B1ADF47D3917014 ON collection.cpu_socket_link (cpu_id)'); $this->addSql('CREATE TABLE collection.fpu (id SERIAL NOT NULL, brand_id INT NOT NULL, socket_id INT NOT NULL, model VARCHAR(255) NOT NULL, clock_speed INT NOT NULL, count INT DEFAULT 1 NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_C741FA5844F5D008 ON collection.fpu (brand_id)'); $this->addSql('CREATE INDEX IDX_C741FA58D20E239C ON collection.fpu (socket_id)'); $this->addSql('ALTER TABLE collection.cpu_socket_link ADD CONSTRAINT FK_B1ADF47DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.cpu (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE collection.cpu_socket_link ADD CONSTRAINT FK_B1ADF47D3917014 FOREIGN KEY (cpu_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE collection.fpu ADD CONSTRAINT FK_C741FA5844F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); $this->addSql('ALTER TABLE collection.fpu ADD CONSTRAINT FK_C741FA58D20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (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('ALTER TABLE collection.cpu_socket_link DROP CONSTRAINT FK_B1ADF47DD20E239C'); $this->addSql('ALTER TABLE collection.cpu_socket_link DROP CONSTRAINT FK_B1ADF47D3917014'); $this->addSql('ALTER TABLE collection.fpu DROP CONSTRAINT FK_C741FA5844F5D008'); $this->addSql('ALTER TABLE collection.fpu DROP CONSTRAINT FK_C741FA58D20E239C'); $this->addSql('DROP TABLE collection.cpu_socket_link'); $this->addSql('DROP TABLE collection.fpu'); } }