addSql('CREATE TEMPORARY TABLE __temp__food_order AS SELECT id, closed_at, started_by, started_at FROM food_order'); $this->addSql('DROP TABLE food_order'); $this->addSql('CREATE TABLE food_order (id BLOB NOT NULL --(DC2Type:ulid) , vendor_id BLOB NOT NULL --(DC2Type:ulid) , closed_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable) , started_by VARCHAR(30) NOT NULL, started_at DATETIME NOT NULL --(DC2Type:datetime_immutable) , PRIMARY KEY(id), CONSTRAINT FK_4485672F603EE73 FOREIGN KEY (vendor_id) REFERENCES vendor (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); $this->addSql('INSERT INTO food_order (id, closed_at, started_by, started_at) SELECT id, closed_at, started_by, started_at FROM __temp__food_order'); $this->addSql('DROP TABLE __temp__food_order'); $this->addSql('CREATE INDEX IDX_4485672F603EE73 ON food_order (vendor_id)'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs $this->addSql('CREATE TEMPORARY TABLE __temp__food_order AS SELECT id, closed_at, started_by, started_at FROM food_order'); $this->addSql('DROP TABLE food_order'); $this->addSql('CREATE TABLE food_order (id BLOB NOT NULL --(DC2Type:ulid) , closed_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable) , started_by VARCHAR(30) NOT NULL, started_at DATETIME NOT NULL --(DC2Type:datetime_immutable) , PRIMARY KEY(id))'); $this->addSql('INSERT INTO food_order (id, closed_at, started_by, started_at) SELECT id, closed_at, started_by, started_at FROM __temp__food_order'); $this->addSql('DROP TABLE __temp__food_order'); } }