migrations/Version20260804170000.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 Version20260804170000 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Feature flags and ZipQuantum short-link foundation';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''This migration is MySQL only.');
  15.         $this->addSql("CREATE TABLE feature_flag (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(64) NOT NULL, enabled TINYINT(1) NOT NULL DEFAULT 0, config JSON DEFAULT NULL, updated_by_id INT DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_FEATURE_FLAG_CODE (code), INDEX IDX_FEATURE_FLAG_USER (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE=InnoDB");
  16.         $this->addSql("CREATE TABLE short_link (id BIGINT AUTO_INCREMENT NOT NULL, provider VARCHAR(32) NOT NULL, provider_id VARCHAR(191) DEFAULT NULL, provider_code VARCHAR(64) DEFAULT NULL, provider_url VARCHAR(500) DEFAULT NULL, content_type VARCHAR(16) NOT NULL, content_id INT NOT NULL, destination_url VARCHAR(1000) NOT NULL, short_url VARCHAR(500) DEFAULT NULL, legacy_url VARCHAR(500) DEFAULT NULL, status VARCHAR(24) NOT NULL DEFAULT 'pending', error_message VARCHAR(1000) DEFAULT NULL, created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_SHORT_LINK_CONTENT (provider, content_type, content_id), UNIQUE INDEX UNIQ_SHORT_LINK_CODE (provider, provider_code), INDEX IDX_SHORT_LINK_PROVIDER_ID (provider_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE=InnoDB");
  17.         $this->addSql("INSERT INTO feature_flag (code, enabled, config) VALUES ('zipquantum', 0, JSON_OBJECT())");
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         $this->addSql('DROP TABLE short_link');
  22.         $this->addSql('DROP TABLE feature_flag');
  23.     }
  24. }