migrations/Version20251122135555.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 Version20251122135555 extends AbstractMigration
  10. {
  11.     /**
  12.      * @return string
  13.      */
  14.     public function getDescription() : string
  15.     {
  16.         return 'Add recipe brand column';
  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('ALTER TABLE recipes ADD brand TEXT DEFAULT \'\'');
  28.         $this->addSql('COMMENT ON COLUMN recipes.brand IS \'Recipe brand.\'');
  29.         $this->addSql('ALTER TABLE customers ADD brand TEXT DEFAULT NULL');
  30.         $this->addSql('COMMENT ON COLUMN customers.brand IS \'Brand\'');
  31.     }
  32.     /**
  33.      * @param Schema $schema
  34.      *
  35.      * @throws \Doctrine\DBAL\DBALException
  36.      */
  37.     public function down(Schema $schema) : void
  38.     {
  39.         // this down() migration is auto-generated, please modify it to your needs
  40.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  41.         $this->addSql('CREATE SCHEMA public');
  42.         $this->addSql('ALTER TABLE recipes DROP brand');
  43.         $this->addSql('ALTER TABLE customers DROP brand');
  44.     }
  45. }