<?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 Version20200812113143 extends AbstractMigration
{
/**
* @return string
*/
public function getDescription() : string
{
return '';
}
/**
* @param Schema $schema
*
* @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 SEQUENCE customers_activation_log_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE customers_activation_log (id INT NOT NULL, customer_id INT NOT NULL, changed_by_id INT NOT NULL, status BOOLEAN NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_D2022C7A9395C3F3 ON customers_activation_log (customer_id)');
$this->addSql('CREATE INDEX IDX_D2022C7A828AD0A0 ON customers_activation_log (changed_by_id)');
$this->addSql('ALTER TABLE customers_activation_log ADD CONSTRAINT FK_D2022C7A9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE customers_activation_log ADD CONSTRAINT FK_D2022C7A828AD0A0 FOREIGN KEY (changed_by_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
/**
* @param Schema $schema
*
* @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('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE customers_activation_log_id_seq CASCADE');
$this->addSql('DROP TABLE customers_activation_log');
}
}