<?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 Version20220222155305 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 shop_order_status (id INT AUTO_INCREMENT NOT NULL, intitule VARCHAR(50) NOT NULL, code VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('INSERT INTO shop_order_status (id, intitule, code) VALUES (1, "En attente", "created")');
$this->addSql('INSERT INTO shop_order_status (id, intitule, code) VALUES (2, "Confirmé", "success")');
$this->addSql('INSERT INTO shop_order_status (id, intitule, code) VALUES (3, "Annulé / refusé", "canceled")');
$this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\'');
$this->addSql('ALTER TABLE shop_order ADD status_id INT NOT NULL DEFAULT 1');
$this->addSql('ALTER TABLE shop_order ADD CONSTRAINT FK_323FC9CA6BF700BD FOREIGN KEY (status_id) REFERENCES shop_order_status (id)');
$this->addSql('CREATE INDEX IDX_323FC9CA6BF700BD ON shop_order (status_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE shop_order DROP FOREIGN KEY FK_323FC9CA6BF700BD');
$this->addSql('DROP TABLE shop_order_status');
$this->addSql('ALTER TABLE media__media CHANGE provider_metadata provider_metadata LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci` COMMENT \'(DC2Type:json)\'');
$this->addSql('DROP INDEX IDX_323FC9CA6BF700BD ON shop_order');
$this->addSql('ALTER TABLE shop_order DROP status_id');
}
}