migrations/Version20251027105014.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 Version20251027105014 extends AbstractMigration
  10. {
  11.    public function getDescription(): string
  12.     {
  13.         return 'Create table std_ads_zones to store ad display zones and their allowed formats';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql(<<<'SQL'
  18.             CREATE TABLE `std_ads_zones` (
  19.               `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  20.               `machine_name` VARCHAR(100) NOT NULL,
  21.               `name` VARCHAR(255) NOT NULL,
  22.               `description` VARCHAR(255) DEFAULT NULL,
  23.               `allowed_formats` JSON DEFAULT NULL,
  24.               `is_active` TINYINT(1) NOT NULL DEFAULT 1,
  25.               `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  26.               `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  27.               PRIMARY KEY (`id`),
  28.               UNIQUE KEY `uniq_ads_zone_machine_name` (`machine_name`)
  29.             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  30.         SQL);
  31.     }
  32.     public function down(Schema $schema): void
  33.     {
  34.         $this->addSql('DROP TABLE IF EXISTS `std_ads_zones`');
  35.     }
  36. }