fitness-web/console/migrations/m150925_201715_add__table__card.php

44 lines
1.1 KiB
PHP

<?php
use yii\db\Schema;
use yii\db\Migration;
class m150925_201715_add__table__card 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('{{%card}}', [
'id_card' => $this->primaryKey(),
'number' => $this->string(20)->notNull(),
'status' => $this->smallInteger()->notNull()->defaultValue(10),
'type' => $this->integer(11)->notNull(),
'created_at' => $this->timestamp()->notNull(),
'updated_at' => $this->timestamp()->notNull(),
], $tableOptions);
}
public function down()
{
echo "m150925_201715_add__table__card cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}