|
|
|
<?php
|
|
|
|
|
|
|
|
use yii\db\Migration;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the creation of table `settings`.
|
|
|
|
*/
|
|
|
|
class m180604_124108_create_settings_table extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
$tableOptions = null;
|
|
|
|
if ($this->db->driverName === 'mysql') {
|
|
|
|
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ENGINE=InnoDB';
|
|
|
|
}
|
|
|
|
$this->createTable(
|
|
|
|
'{{%settings}}',
|
|
|
|
[
|
|
|
|
'id' => $this->primaryKey(),
|
|
|
|
'type' => $this->string(255)->notNull(),
|
|
|
|
'section' => $this->string(255)->notNull(),
|
|
|
|
'key' => $this->string(255)->notNull(),
|
|
|
|
'value' => $this->text(),
|
|
|
|
'active' => $this->integer(1),
|
|
|
|
'created_at' => $this->integer()->unsigned(),
|
|
|
|
'updated_at' => $this->integer()->unsigned(),
|
|
|
|
],
|
|
|
|
$tableOptions
|
|
|
|
);
|
|
|
|
$this->createIndex('settings_unique_key_section', '{{%settings}}', ['section', 'key'], true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
$this->dropIndex('settings_unique_key_section', '{{%settings}}');
|
|
|
|
$this->dropTable('{{%settings}}');
|
|
|
|
}
|
|
|
|
}
|