intranet/migrations/Version20230616160425.php
Audrey Jensen 632199009d init
2023-06-28 15:38:14 +00:00

36 lines
1.4 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 Version20230616160425 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 role VARCHAR(255) DEFAULT \'end_user\'');
}
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, firstname, last_name, email, display_name, registered, title FROM user');
$this->addSql('DROP TABLE user');
$this->addSql('CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, firstname VARCHAR(64) DEFAULT NULL, last_name VARCHAR(64) DEFAULT NULL, email VARCHAR(80) NOT NULL, display_name VARCHAR(255) DEFAULT NULL, registered DATETIME DEFAULT NULL, title VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO user (id, firstname, last_name, email, display_name, registered, title) SELECT id, firstname, last_name, email, display_name, registered, title FROM __temp__user');
$this->addSql('DROP TABLE __temp__user');
}
}