guild/console/migrations/m181003_082730_create_additional_fields_table.php

35 lines
843 B
PHP
Raw Normal View History

2018-10-11 11:15:09 +03:00
<?php
use yii\db\Migration;
/**
* Handles the creation of table `additional_fields`.
*/
class m181003_082730_create_additional_fields_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('additional_fields', [
'id' => $this->primaryKey(),
'name' => $this->string(100)->notNull(),
], $tableOptions);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('additional_fields');
}
}