Created
February 13, 2017 10:47
-
-
Save borantula/29a9befebde2d57a89e7a4025f9693e8 to your computer and use it in GitHub Desktop.
CakePHP I18N Table Migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Migrations\AbstractMigration; | |
class ArticlesI18n extends AbstractMigration | |
{ | |
/** | |
* Change Method. | |
* | |
* More information on this method is available here: | |
* http://docs.phinx.org/en/latest/migrations.html#the-change-method | |
* @return void | |
*/ | |
public function change() | |
{ | |
$table = $this->table('articles_i18n'); | |
$table->addColumn('locale', 'string', [ | |
'default' => null, | |
'limit' => 6, | |
'null' => false, | |
]); | |
$table->addColumn('model', 'string', [ | |
'default' => null, | |
'limit' => 255, | |
'null' => false, | |
]); | |
$table->addColumn('foreign_key', 'integer', [ | |
'default' => null, | |
'limit' => 11, | |
'null' => false, | |
]); | |
$table->addColumn('field', 'string', [ | |
'default' => null, | |
'limit' => 255, | |
'null' => false, | |
]); | |
$table->addColumn('content', 'text', [ | |
'default' => null, | |
'null' => false, | |
]); | |
$table->addIndex(array('locale', 'model', 'foreign_key', 'field'), array('unique' => true, 'name' => 'I18N_LOCALE_FIELD')); | |
$table->addIndex(array('model', 'foreign_key', 'field'), array('unique' => false, 'name' => 'I18N_FIELD')); | |
$table->create(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment