<?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 Version20200329135538 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE TABLE devices_user_settings (user_setting_id INT NOT NULL, device_id INT NOT NULL, PRIMARY KEY(user_setting_id, device_id))');
$this->addSql('CREATE INDEX IDX_C1E5626149527B9E ON devices_user_settings (user_setting_id)');
$this->addSql('CREATE INDEX IDX_C1E5626194A4C7D4 ON devices_user_settings (device_id)');
$this->addSql('ALTER TABLE devices_user_settings ADD CONSTRAINT FK_C1E5626149527B9E FOREIGN KEY (user_setting_id) REFERENCES user_settings (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE devices_user_settings ADD CONSTRAINT FK_C1E5626194A4C7D4 FOREIGN KEY (device_id) REFERENCES devices (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('COMMENT ON COLUMN users.activated_at IS \'Activated at.\'');
}
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('CREATE SCHEMA public');
$this->addSql('DROP TABLE devices_user_settings');
$this->addSql('COMMENT ON COLUMN users.activated_at IS \'Hash validity ends at.\'');
}
}