migrations/Identity/Version20200227105602_UserAccount.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Identity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200227105602_UserAccount extends AbstractMigration
{
public function getDescription(): string
{
return 'Add account table';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE TABLE user_account (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES public.user (id),
slug CHARACTER VARYING NOT NULL,
provider CHARACTER VARYING(255) NOT NULL,
account_id CHARACTER VARYING(255) NOT NULL,
data JSONB NOT NULL,
created_at TIMESTAMP(0) WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP(0) WITH TIME ZONE,
deleted_at TIMESTAMP(0) WITH TIME ZONE,
CONSTRAINT user_account_slug_key UNIQUE (slug),
CONSTRAINT user_account_compound_id_key UNIQUE (provider, account_id)
)");
$this->addSql("CREATE INDEX user_account_user_id_idx ON user_account (user_id)");
$this->addSql("CREATE INDEX user_account_provider_idx ON user_account (provider)");
$this->addSql("CREATE INDEX user_account_account_id_idx ON user_account (account_id)");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE IF EXISTS user_account');
}
}