<?php
use Migrations\AbstractMigration;
class TranslateInitialMigration extends AbstractMigration
{
public $autoId = false;
public function up()
{
$table = $this->table('i18n');
$table->addColumn('id', 'integer', [
'autoIncrement' => true,
'default' => null,
'limit' => 20,
'null' => false,
])
->addPrimaryKey(['id'])
->addColumn('locale', 'string', [
'default' => null,
'limit' => 5,
'null' => false,
])
->addColumn('model', 'string', [
'default' => null,
'limit' => 200,
'null' => false,
])
->addColumn('foreign_key', 'integer', [
'default' => null,
'limit' => 11,
'null' => false,
])
->addColumn('field', 'string', [
'default' => null,
'limit' => 255,
'null' => false,
])
->addColumn('content', 'text', [
'default' => null,
'limit' => null,
'null' => true,
])
->addTimestamps('created', 'updated')
->addColumn('created_by', 'integer', [
'default' => null,
'limit' => 20,
'null' => false,
])
->addColumn('updated_by', 'integer', [
'default' => null,
'limit' => 20,
'null' => true,
])
->addIndex(['locale', 'model', 'foreign_key'])
->create();
}
public function down()
{
$this->table('i18n')->drop()->save();
}
}