point-tools/migrations/Version20171104182713.php

35 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<?php
2023-03-12 15:15:25 +00:00
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
2023-03-12 15:15:25 +00:00
use Doctrine\Migrations\AbstractMigration;
/**
* New fields for User entity: 'public' and 'whitelistOnly' (privacy support)
*/
2023-03-12 15:15:25 +00:00
final class Version20171104182713 extends AbstractMigration
{
2023-03-12 15:15:25 +00:00
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE users.users ADD public BOOLEAN DEFAULT FALSE NOT NULL');
$this->addSql('ALTER TABLE users.users ADD whitelist_only BOOLEAN DEFAULT FALSE NOT NULL');
$this->addSql('CREATE INDEX idx_user_public ON users.users (public)');
$this->addSql('CREATE INDEX idx_user_removed ON users.users (is_removed)');
}
2023-03-12 15:15:25 +00:00
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('DROP INDEX users.idx_user_public');
$this->addSql('DROP INDEX users.idx_user_removed');
$this->addSql('ALTER TABLE users.users DROP public');
$this->addSql('ALTER TABLE users.users DROP whitelist_only');
}
}