<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220204214839 extends AbstractMigration
{
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 bill (id INT AUTO_INCREMENT NOT NULL, event_id INT NOT NULL, user_created_id INT DEFAULT NULL, create_date DATETIME NOT NULL, status INT NOT NULL, INDEX IDX_7A2119E371F7E88B (event_id), INDEX IDX_7A2119E3F987D8A8 (user_created_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE event (id INT AUTO_INCREMENT NOT NULL, user_created_id INT DEFAULT NULL, create_date DATETIME NOT NULL, name VARCHAR(255) NOT NULL, status INT NOT NULL, INDEX IDX_3BAE0AA7F987D8A8 (user_created_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE item (id INT AUTO_INCREMENT NOT NULL, bill_id INT NOT NULL, user_created_id INT DEFAULT NULL, create_date DATETIME NOT NULL, status INT NOT NULL, seller INT NOT NULL, INDEX IDX_1F1B251E1A8C12F5 (bill_id), INDEX IDX_1F1B251EF987D8A8 (user_created_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE bill ADD CONSTRAINT FK_7A2119E371F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('ALTER TABLE bill ADD CONSTRAINT FK_7A2119E3F987D8A8 FOREIGN KEY (user_created_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7F987D8A8 FOREIGN KEY (user_created_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE item ADD CONSTRAINT FK_1F1B251E1A8C12F5 FOREIGN KEY (bill_id) REFERENCES bill (id)');
$this->addSql('ALTER TABLE item ADD CONSTRAINT FK_1F1B251EF987D8A8 FOREIGN KEY (user_created_id) REFERENCES user (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE item DROP FOREIGN KEY FK_1F1B251E1A8C12F5');
$this->addSql('ALTER TABLE bill DROP FOREIGN KEY FK_7A2119E371F7E88B');
$this->addSql('DROP TABLE bill');
$this->addSql('DROP TABLE event');
$this->addSql('DROP TABLE item');
}
}