<?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 Version20211216100846 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add deals table';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE deal (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', store_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', drupal_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', url VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, title_sales VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, is_active TINYINT(1) NOT NULL, image VARCHAR(255) NOT NULL, date_start DATETIME DEFAULT NULL, date_end DATETIME DEFAULT NULL, coupon_code VARCHAR(255) NOT NULL, allowed_days VARCHAR(255) NOT NULL, sort_order INT NOT NULL, updated_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_E3FEC116F023AAC2 (drupal_id), INDEX IDX_E3FEC116B092A811 (store_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE deal ADD CONSTRAINT FK_E3FEC116B092A811 FOREIGN KEY (store_id) REFERENCES store (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE deal');
}
public function isTransactional(): bool
{
return false;
}
}