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.1 KiB

<?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 utf8 COLLATE utf8_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}}');
}
}