56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
use yii\db\Schema;
|
|
use yii\db\Migration;
|
|
|
|
class m151021_060337_add__table__sale 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('{{%sale}}', [
|
|
'id_sale' => $this->primaryKey(),
|
|
'id_discount' => $this->integer(11) ,
|
|
'id_currency' => $this->integer(11) ,
|
|
'id_discount' => $this->integer(11) ,
|
|
'id_product' => $this->integer(11) ,
|
|
'status' => $this->smallInteger(),
|
|
'type' => $this->smallInteger(),
|
|
'item_price' => $this->integer(11),
|
|
'count' => $this->integer(11),
|
|
'money' => $this->integer(11),
|
|
'money_currency' => $this->integer(11),
|
|
'rate' => $this->integer(11),
|
|
'id_user' => $this->integer(11),
|
|
'comment' => $this->string(255),
|
|
'created_at' => $this->dateTime()->notNull(),
|
|
'updated_at' => $this->dateTime()->notNull(),
|
|
], $tableOptions);
|
|
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
echo "m151021_060337_add__table__sale cannot be reverted.\n";
|
|
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
// Use safeUp/safeDown to run migration code within a transaction
|
|
public function safeUp()
|
|
{
|
|
}
|
|
|
|
public function safeDown()
|
|
{
|
|
}
|
|
*/
|
|
}
|