39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
|
<?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 Version20240622233923 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 user ADD COLUMN meta_data CLOB DEFAULT NULL');
|
||
|
}
|
||
|
|
||
|
public function down(Schema $schema): void
|
||
|
{
|
||
|
// this down() migration is auto-generated, please modify it to your needs
|
||
|
$this->addSql('CREATE TEMPORARY TABLE __temp__user AS SELECT id, email, roles, password, name FROM user');
|
||
|
$this->addSql('DROP TABLE user');
|
||
|
$this->addSql('CREATE TABLE user (id BLOB NOT NULL --(DC2Type:uuid)
|
||
|
, email VARCHAR(180) NOT NULL, roles CLOB NOT NULL --(DC2Type:json)
|
||
|
, password VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||
|
$this->addSql('INSERT INTO user (id, email, roles, password, name) SELECT id, email, roles, password, name FROM __temp__user');
|
||
|
$this->addSql('DROP TABLE __temp__user');
|
||
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_EMAIL ON user (email)');
|
||
|
}
|
||
|
}
|