futtern/migrations/Version20240212201659.php

55 lines
2.7 KiB
PHP
Raw Normal View History

2024-02-05 15:16:43 +00:00
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
2024-02-12 21:03:17 +00:00
final class Version20240212201659 extends AbstractMigration
2024-02-05 15:16:43 +00:00
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE food_order (id BLOB NOT NULL --(DC2Type:ulid)
2024-02-12 21:03:17 +00:00
, 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))');
2024-02-05 15:16:43 +00:00
$this->addSql('CREATE TABLE menu_item (id BLOB NOT NULL --(DC2Type:ulid)
, vendor_id BLOB NOT NULL --(DC2Type:ulid)
2024-02-12 21:03:17 +00:00
, price INTEGER NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_D754D550F603EE73 FOREIGN KEY (vendor_id) REFERENCES vendor (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
2024-02-05 15:16:43 +00:00
$this->addSql('CREATE INDEX IDX_D754D550F603EE73 ON menu_item (vendor_id)');
$this->addSql('CREATE TABLE menu_item_alias (id BLOB NOT NULL --(DC2Type:ulid)
, menu_item_id BLOB NOT NULL --(DC2Type:ulid)
2024-02-12 21:03:17 +00:00
, name VARCHAR(50) NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_EA66C4969AB44FE0 FOREIGN KEY (menu_item_id) REFERENCES menu_item (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
2024-02-05 15:16:43 +00:00
$this->addSql('CREATE INDEX IDX_EA66C4969AB44FE0 ON menu_item_alias (menu_item_id)');
$this->addSql('CREATE TABLE order_item (id BLOB NOT NULL --(DC2Type:ulid)
, food_order_id BLOB NOT NULL --(DC2Type:ulid)
, menu_item_id BLOB NOT NULL --(DC2Type:ulid)
, PRIMARY KEY(id), CONSTRAINT FK_52EA1F09A5D24A7A FOREIGN KEY (food_order_id) REFERENCES food_order (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_52EA1F099AB44FE0 FOREIGN KEY (menu_item_id) REFERENCES menu_item (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('CREATE INDEX IDX_52EA1F09A5D24A7A ON order_item (food_order_id)');
2024-02-12 21:03:17 +00:00
$this->addSql('CREATE UNIQUE INDEX UNIQ_52EA1F099AB44FE0 ON order_item (menu_item_id)');
2024-02-05 15:16:43 +00:00
$this->addSql('CREATE TABLE vendor (id BLOB NOT NULL --(DC2Type:ulid)
2024-02-12 21:03:17 +00:00
, name VARCHAR(50) NOT NULL, PRIMARY KEY(id))');
2024-02-05 15:16:43 +00:00
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE food_order');
$this->addSql('DROP TABLE menu_item');
$this->addSql('DROP TABLE menu_item_alias');
$this->addSql('DROP TABLE order_item');
$this->addSql('DROP TABLE vendor');
}
}