migrations/Version20200812113143.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20200812113143 extends AbstractMigration
  10. {
  11.     /**
  12.      * @return string
  13.      */
  14.     public function getDescription() : string
  15.     {
  16.         return '';
  17.     }
  18.     /**
  19.      * @param Schema $schema
  20.      *
  21.      * @throws \Doctrine\DBAL\DBALException
  22.      */
  23.     public function up(Schema $schema) : void
  24.     {
  25.         // this up() migration is auto-generated, please modify it to your needs
  26.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  27.         $this->addSql('CREATE SEQUENCE customers_activation_log_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  28.         $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))');
  29.         $this->addSql('CREATE INDEX IDX_D2022C7A9395C3F3 ON customers_activation_log (customer_id)');
  30.         $this->addSql('CREATE INDEX IDX_D2022C7A828AD0A0 ON customers_activation_log (changed_by_id)');
  31.         $this->addSql('ALTER TABLE customers_activation_log ADD CONSTRAINT FK_D2022C7A9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  32.         $this->addSql('ALTER TABLE customers_activation_log ADD CONSTRAINT FK_D2022C7A828AD0A0 FOREIGN KEY (changed_by_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  33.     }
  34.     /**
  35.      * @param Schema $schema
  36.      *
  37.      * @throws \Doctrine\DBAL\DBALException
  38.      */
  39.     public function down(Schema $schema) : void
  40.     {
  41.         // this down() migration is auto-generated, please modify it to your needs
  42.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  43.         $this->addSql('CREATE SCHEMA public');
  44.         $this->addSql('DROP SEQUENCE customers_activation_log_id_seq CASCADE');
  45.         $this->addSql('DROP TABLE customers_activation_log');
  46.     }
  47. }