add key crud

This commit is contained in:
rocho
2015-11-29 12:07:21 +01:00
parent ed80f8720d
commit d7c08ec60b
13 changed files with 645 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151129_101441_add_table_key extends Migration
{
public function up()
{
$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('{{%key}}', [
'id_key' => $this->primaryKey(),
'number' => $this->string(255),
'status' => $this->smallInteger(),
'type' => $this->smallInteger(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
}
public function down()
{
echo "m151129_101441_add_table_key cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}