<?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 Version20230807184541 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 TEMPORARY TABLE __temp__data AS SELECT namespace, "key", value FROM data');
$this->addSql('DROP TABLE data');
$this->addSql('CREATE TABLE data (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, namespace VARCHAR(100) NOT NULL, config_key VARCHAR(100) NOT NULL, config_value CLOB DEFAULT NULL)');
$this->addSql('INSERT INTO data (namespace, config_key, config_value) SELECT namespace, "key", value FROM __temp__data');
$this->addSql('DROP TABLE __temp__data');
$this->addSql('CREATE UNIQUE INDEX UNIQ_ADF3F36333E16B5695D1CAA6 ON data (namespace, config_key)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__data AS SELECT namespace, config_key, config_value FROM data');
$this->addSql('DROP TABLE data');
$this->addSql('CREATE TABLE data (namespace VARCHAR(100) NOT NULL, "key" VARCHAR(100) NOT NULL, value CLOB DEFAULT NULL)');
$this->addSql('INSERT INTO data (namespace, "key", value) SELECT namespace, config_key, config_value FROM __temp__data');
$this->addSql('DROP TABLE __temp__data');
$this->addSql('CREATE UNIQUE INDEX data-namespace_key-idx ON data (namespace, "key")');
}
}