m160321_232402_orders.php
1.03 KB
<?php
use yii\db\Migration;
class m160321_232402_orders 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('{{%orders}}', [
'id' => $this->primaryKey(),
'name' => $this->string()->notNull(),
'email' => $this->string()->notNull(),
'phone' => $this->string(32)->notNull(),
'delivery' => $this->integer(),
'payment' => $this->integer(),
'code' => $this->string(),
'status' => $this->smallInteger(),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
}
public function down()
{
$this->dropTable('{{%orders}}');
}
}