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.

45 lines
1.2 KiB

7 years ago
<?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') {
3 years ago
$tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
}
$this->createTable(
'{{%settings}}',
[
3 years ago
//'id' => $this->primaryKey(),
'section' => $this->string(),
'key' => $this->string(),
'type' => $this->string()->notNull(),
'active' => $this->integer(1),
'created_at' => $this->integer()->unsigned(),
'updated_at' => $this->integer()->unsigned(),
],
$tableOptions
);
3 years ago
$this->addPrimaryKey('idx_setting_key', '{{%settings}}', ['section', 'key']);
//$this->createIndex('idx_setting_key', '{{%settings}}', ['section', 'key']);
7 years ago
}
/**
* @inheritdoc
*/
public function down()
{
3 years ago
//$this->dropIndex('idx_setting_key', '{{%settings}}');
$this->dropTable('{{%settings}}');
7 years ago
}
}