You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.4 KiB

<?php
use yii\db\Migration;
/**
* Handles the creation of table `settings_lng`.
*/
class m180910_182109_create_settings_lng_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%settings_lng}}', [
3 years ago
'id' => $this->primaryKey(),
'section' => $this->string(),
'key' => $this->string(),
'language' => $this->string(6),
'value' => $this->text(),
], $tableOptions);
3 years ago
$this->createIndex('idx_settings_lng_key', '{{%settings_lng}}', ['section', 'key']);
$this->createIndex('idx_settings_lng_language', '{{%settings_lng}}', 'language');
3 years ago
$this->addForeignKey('fk_settings_lng_settings_id', '{{%settings_lng}}', ['section', 'key'], '{{%settings}}', ['section', 'key'], 'CASCADE', 'CASCADE');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
3 years ago
$this->dropForeignKey('fk_settings_lng_settings_id', '{{%settings_lng}}');
$this->dropIndex('idx_settings_lng_language', '{{%settings_lng}}');
3 years ago
$this->dropIndex('idx_settings_lng_key', '{{%settings_lng}}');
$this->dropTable('{{%settings_lng}}');
}
}