SuperSeller3000/migrations/Version20260520000000.php

38 lines
1 KiB
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260520000000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create app.translations table for DB-backed i18n';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
CREATE TABLE app.translations (
id UUID NOT NULL PRIMARY KEY,
locale VARCHAR(10) NOT NULL,
domain VARCHAR(50) NOT NULL,
translation_key VARCHAR(255) NOT NULL,
value TEXT NOT NULL,
CONSTRAINT uniq_translation UNIQUE (locale, domain, translation_key)
)
SQL);
$this->addSql('CREATE INDEX idx_translations_locale_domain ON app.translations (locale, domain)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE app.translations');
}
}