migrations/Version20200325105234.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 Version20200325105234 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('CREATE SEQUENCE user_settings_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  20.         $this->addSql('CREATE TABLE user_settings (id INT NOT NULL, user_id VARCHAR(255) NOT NULL, standard_recipe_id VARCHAR(255) NOT NULL, language TEXT DEFAULT \'en\' NOT NULL, created_at TIMESTAMP(0) WITH TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITH TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
  21.         $this->addSql('COMMENT ON COLUMN user_settings.language IS \'Application language.\'');
  22.         $this->addSql('COMMENT ON COLUMN user_settings.created_at IS \'Date of the entity creation. Should be fixed.\'');
  23.         $this->addSql('COMMENT ON COLUMN user_settings.updated_at IS \'Date of the last change in entity. Shouldn’t be set to other dates.\'');
  24.         $this->addSql('ALTER TABLE devices ADD is_used BOOLEAN DEFAULT \'true\' NOT NULL');
  25.         $this->addSql('COMMENT ON COLUMN devices.is_used IS \'Did used marked this devices as used.\'');
  26.     }
  27.     public function down(Schema $schema) : void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  31.         $this->addSql('CREATE SCHEMA public');
  32.         $this->addSql('DROP SEQUENCE user_settings_id_seq CASCADE');
  33.         $this->addSql('DROP TABLE user_settings');
  34.         $this->addSql('ALTER TABLE devices DROP is_used');
  35.     }
  36. }