addSql('CREATE TABLE session_consumables (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, price_rials INT NOT NULL, quantity INT NOT NULL, created_at INT NOT NULL, session_id INT NOT NULL, inventory_item_id INT NOT NULL, UNIQUE INDEX UNIQ_6776C347D17F50A6 (uuid), INDEX IDX_6776C347613FECDF (session_id), INDEX IDX_6776C347536BF4A2 (inventory_item_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4'); $this->addSql('ALTER TABLE session_consumables ADD CONSTRAINT FK_6776C347613FECDF FOREIGN KEY (session_id) REFERENCES patient_sessions (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE session_consumables ADD CONSTRAINT FK_6776C347536BF4A2 FOREIGN KEY (inventory_item_id) REFERENCES inventory_items (id) ON DELETE RESTRICT'); $this->addSql('ALTER TABLE patient_sessions ADD session_at INT DEFAULT NULL, ADD inventory_package_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE patient_sessions ADD CONSTRAINT FK_ADE5C5B6B7A2FE7C FOREIGN KEY (inventory_package_id) REFERENCES inventory_packages (id) ON DELETE SET NULL'); $this->addSql('CREATE INDEX IDX_ADE5C5B6B7A2FE7C ON patient_sessions (inventory_package_id)'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE session_consumables DROP FOREIGN KEY FK_6776C347613FECDF'); $this->addSql('ALTER TABLE session_consumables DROP FOREIGN KEY FK_6776C347536BF4A2'); $this->addSql('DROP TABLE session_consumables'); $this->addSql('ALTER TABLE patient_sessions DROP FOREIGN KEY FK_ADE5C5B6B7A2FE7C'); $this->addSql('DROP INDEX IDX_ADE5C5B6B7A2FE7C ON patient_sessions'); $this->addSql('ALTER TABLE patient_sessions DROP session_at, DROP inventory_package_id'); } }