38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
use yii\db\Schema;
|
|
use yii\db\Migration;
|
|
|
|
class m151102_175009_create__table__collection 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('{{%collection}}', [
|
|
'id_collection' => $this->primaryKey(),
|
|
'id_user' => $this->integer() ,
|
|
'created_by' => $this->integer() ,
|
|
'id_account' => $this->integer() ,
|
|
'money' => $this->integer()->notNull() ,
|
|
'start' => $this->dateTime(),
|
|
'end' => $this->dateTime(),
|
|
'type' => $this->integer(11)->notNull(),
|
|
'created_at' => $this->dateTime()->notNull(),
|
|
'updated_at' => $this->dateTime()->notNull(),
|
|
], $tableOptions);
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
echo "m151102_175009_create__table__collection cannot be reverted.\n";
|
|
|
|
return false;
|
|
}
|
|
|
|
}
|