<?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 Version20211202110827 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('ALTER TABLE order_item DROP CONSTRAINT fk_52ea1f095da0fb8');
$this->addSql('DROP SEQUENCE cover_id_seq CASCADE');
$this->addSql('DROP TABLE cover');
$this->addSql('DROP INDEX IF EXISTS idx_52ea1f095da0fb8');
$this->addSql('ALTER TABLE order_item ADD cover VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE order_item DROP template_id');
$this->addSql('ALTER TABLE widget ALTER covers TYPE TEXT');
$this->addSql('ALTER TABLE widget ALTER covers DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN widget.covers IS \'(DC2Type:array)\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE cover_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE cover (id INT NOT NULL, widget_id UUID NOT NULL, filename VARCHAR(255) NOT NULL, sort_order INT NOT NULL, is_enabled BOOLEAN DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX idx_8d0886c5fbe885e2 ON cover (widget_id)');
$this->addSql('COMMENT ON COLUMN cover.widget_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE cover ADD CONSTRAINT fk_8d0886c5fbe885e2 FOREIGN KEY (widget_id) REFERENCES widget (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE widget ALTER covers TYPE TEXT');
$this->addSql('ALTER TABLE widget ALTER covers DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN widget.covers IS NULL');
$this->addSql('ALTER TABLE order_item ADD template_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE order_item DROP cover');
$this->addSql('ALTER TABLE order_item ADD CONSTRAINT fk_52ea1f095da0fb8 FOREIGN KEY (template_id) REFERENCES cover (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_52ea1f095da0fb8 ON order_item (template_id)');
}
}