migrations/Version20250929073428.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. final class Version20250929073428 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add new entity Loyalty';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('CREATE TABLE loyalty (id INT AUTO_INCREMENT NOT NULL, shop_id INT DEFAULT NULL, login_message VARCHAR(255) DEFAULT NULL, successful_signup_message VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_7CC711964D16C4DD (shop_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  15.         $this->addSql('ALTER TABLE loyalty ADD CONSTRAINT FK_7CC711964D16C4DD FOREIGN KEY (shop_id) REFERENCES shop (id)');
  16.     }
  17.     public function down(Schema $schema): void
  18.     {
  19.         $this->addSql('ALTER TABLE loyalty DROP FOREIGN KEY FK_7CC711964D16C4DD');
  20.         $this->addSql('DROP TABLE loyalty');
  21.     }
  22. }