44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 20260906030100_i18n_strings.php
|
||
|
|
*
|
||
|
|
* Author: Funky Waddle
|
||
|
|
* Date: 2026-09-06
|
||
|
|
*
|
||
|
|
* Purpose: Migration that creates the `i18n_strings` table backing the
|
||
|
|
* database-backed i18n Translation Engine's `t('key')` helper (see
|
||
|
|
* `app.notes` -> "i18n Translation Engine" and `scope_v1_boundaries.i18n_translation_workflow`
|
||
|
|
* in APP.yaml). Each row is a single UI string translated into a single locale.
|
||
|
|
*/
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
use Phinx\Migration\AbstractMigration;
|
||
|
|
|
||
|
|
final class I18nStrings extends AbstractMigration
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Change Method.
|
||
|
|
*
|
||
|
|
* Write your reversible migrations using this method.
|
||
|
|
*
|
||
|
|
* More information on writing migrations is available here:
|
||
|
|
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
||
|
|
*
|
||
|
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||
|
|
* with the Table class.
|
||
|
|
*/
|
||
|
|
public function change(): void
|
||
|
|
{
|
||
|
|
$table = $this->table('i18n_strings');
|
||
|
|
$table->addColumn('key', 'string', ['limit' => 255, 'null' => false, 'comment' => "the t('key') lookup key"])
|
||
|
|
->addColumn('locale', 'string', ['limit' => 10, 'null' => false])
|
||
|
|
->addColumn('value', 'text', ['null' => false])
|
||
|
|
->addColumn('created_at', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])
|
||
|
|
->addColumn('updated_at', 'datetime', ['null' => true])
|
||
|
|
->addIndex(['key', 'locale'], ['unique' => true])
|
||
|
|
->create();
|
||
|
|
}
|
||
|
|
}
|