migrations/Version20200313071907.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 Version20200313071907 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  19.         $this->addSql('DROP SEQUENCE user_id_seq CASCADE');
  20.         $this->addSql('CREATE SEQUENCE users_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  21.         $this->addSql('CREATE TABLE users (id INT NOT NULL, customer_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, created_at TIMESTAMP(0) WITH TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITH TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
  22.         $this->addSql('CREATE UNIQUE INDEX UNIQ_1483A5E9E7927C74 ON users (email)');
  23.         $this->addSql('CREATE INDEX IDX_1483A5E99395C3F3 ON users (customer_id)');
  24.         $this->addSql('COMMENT ON COLUMN users.created_at IS \'Date of the entity creation. Should be fixed.\'');
  25.         $this->addSql('COMMENT ON COLUMN users.updated_at IS \'Date of the last change in entity. Shouldn’t be set to other dates.\'');
  26.         $this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E99395C3F3 FOREIGN KEY (customer_id) REFERENCES customers (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.         $this->addSql('DROP TABLE "user"');
  28.     }
  29.     public function down(Schema $schema) : void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  33.         $this->addSql('CREATE SCHEMA public');
  34.         $this->addSql('DROP SEQUENCE users_id_seq CASCADE');
  35.         $this->addSql('CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  36.         $this->addSql('CREATE TABLE "user" (id INT NOT NULL, customer_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, created_at TIMESTAMP(0) WITH TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITH TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
  37.         $this->addSql('CREATE INDEX idx_8d93d6499395c3f3 ON "user" (customer_id)');
  38.         $this->addSql('CREATE UNIQUE INDEX uniq_8d93d649e7927c74 ON "user" (email)');
  39.         $this->addSql('COMMENT ON COLUMN "user".created_at IS \'Date of the entity creation. Should be fixed.\'');
  40.         $this->addSql('COMMENT ON COLUMN "user".updated_at IS \'Date of the last change in entity. Shouldn’t be set to other dates.\'');
  41.         $this->addSql('ALTER TABLE "user" ADD CONSTRAINT fk_8d93d6499395c3f3 FOREIGN KEY (customer_id) REFERENCES customers (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  42.         $this->addSql('DROP TABLE users');
  43.     }
  44. }