add new tables: customer_cart, sale, alter timestamp fields in tables

This commit is contained in:
rocho 2015-10-21 08:30:30 +02:00
parent 4e04425403
commit baf7c79d04
11 changed files with 374 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_055338_add__table__customer_cart 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('{{%shopping_cart}}', [
'id_shopping_cart' => $this->primaryKey(),
'id_customer' => $this->integer(11) ,
'id_sale' => $this->integer(11) ,
], $tableOptions);
}
public function down()
{
echo "m151021_055338_add__table__customer_cart cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,55 @@
<?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()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_061514_alter__table__transfer__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('transfer', 'created_at', 'datetime' );
$this->alterColumn('transfer', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_061514_alter__table__transfer__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_061653_alter__table__card__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('card', 'created_at', 'datetime' );
$this->alterColumn('card', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_061653_alter__table__card__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_061831_alter__table__currency__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('currency', 'created_at', 'datetime' );
$this->alterColumn('currency', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_061831_alter__table__currency__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_061918_alter__table__customer__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('customer', 'created_at', 'datetime' );
$this->alterColumn('customer', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_061918_alter__table__customer__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_062026_alter__table__procurement__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('procurement', 'created_at', 'datetime' );
$this->alterColumn('procurement', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_062026_alter__table__procurement__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_062249_alter__table__product__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('product', 'created_at', 'datetime' );
$this->alterColumn('product', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_062249_alter__table__product__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_062314_alter__table__product_category__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('product_category', 'created_at', 'datetime' );
$this->alterColumn('product_category', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_062314_alter__table__product_category__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_062520_alter__table__ticket_type__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('ticket_type', 'created_at', 'datetime' );
$this->alterColumn('ticket_type', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_062520_alter__table__ticket_type__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151021_062816_alter__table__warehouse__timestamp__fields__to__date extends Migration
{
public function up()
{
$this->alterColumn('warehouse', 'created_at', 'datetime' );
$this->alterColumn('warehouse', 'updated_at', 'datetime' );
}
public function down()
{
echo "m151021_062816_alter__table__warehouse__timestamp__fields__to__date cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}