<?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 Version20190817065832 extends AbstractMigration
{
public function getDescription(): string
{
return 'Users table';
}
/**
* @throws \Doctrine\DBAL\DBALException
*/
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE TABLE "hub_user" (
id UUID NOT NULL, slug VARCHAR(255) NOT NULL,
email VARCHAR(180) NOT NULL,
roles JSON NOT NULL,
password VARCHAR(255) NOT NULL, PRIMARY KEY(id))'
);
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649989D9B62 ON "hub_user" (slug)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649E7927C74 ON "hub_user" (email)');
$this->addSql('COMMENT ON COLUMN "hub_user".id IS \'(DC2Type:uuid)\'');
}
/**
* @throws \Doctrine\DBAL\DBALException
*/
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('DROP TABLE "hub_user"');
}
}