migrations/Identity/Version20200227100457_UserPassword.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 Version20200227100457_UserPassword extends AbstractMigration
{
public function getDescription(): string
{
return 'Create password table';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE TABLE user_password (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES public.user (id),
value CHARACTER VARYING NOT NULL,
expired BOOLEAN DEFAULT FALSE,
created_by INTEGER REFERENCES public.user (id),
updated_by INTEGER REFERENCES public.user (id),
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_password_user_value_key UNIQUE (user_id, value)
)");
$this->addSql("CREATE INDEX user_password_user_id_idx ON user_password (user_id)");
$this->addSql("CREATE INDEX user_password_created_by_idx ON user_password (created_by)");
$this->addSql("CREATE INDEX user_password_updated_by_idx ON user_password (updated_by)");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS user_password");
}
}