From baf7c79d04797a2d932e1927a73e47a05debe317 Mon Sep 17 00:00:00 2001 From: rocho Date: Wed, 21 Oct 2015 08:30:30 +0200 Subject: [PATCH] add new tables: customer_cart, sale, alter timestamp fields in tables --- ...51021_055338_add__table__customer_cart.php | 40 ++++++++++++++ .../m151021_060337_add__table__sale.php | 55 +++++++++++++++++++ ..._transfer__timestamp__fields__to__date.php | 31 +++++++++++ ...ble__card__timestamp__fields__to__date.php | 31 +++++++++++ ..._currency__timestamp__fields__to__date.php | 31 +++++++++++ ..._customer__timestamp__fields__to__date.php | 31 +++++++++++ ...ocurement__timestamp__fields__to__date.php | 31 +++++++++++ ...__product__timestamp__fields__to__date.php | 31 +++++++++++ ..._category__timestamp__fields__to__date.php | 31 +++++++++++ ...cket_type__timestamp__fields__to__date.php | 31 +++++++++++ ...warehouse__timestamp__fields__to__date.php | 31 +++++++++++ 11 files changed, 374 insertions(+) create mode 100644 console/migrations/m151021_055338_add__table__customer_cart.php create mode 100644 console/migrations/m151021_060337_add__table__sale.php create mode 100644 console/migrations/m151021_061514_alter__table__transfer__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_061653_alter__table__card__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_061831_alter__table__currency__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_061918_alter__table__customer__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_062026_alter__table__procurement__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_062249_alter__table__product__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_062314_alter__table__product_category__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_062520_alter__table__ticket_type__timestamp__fields__to__date.php create mode 100644 console/migrations/m151021_062816_alter__table__warehouse__timestamp__fields__to__date.php diff --git a/console/migrations/m151021_055338_add__table__customer_cart.php b/console/migrations/m151021_055338_add__table__customer_cart.php new file mode 100644 index 0000000..3527fba --- /dev/null +++ b/console/migrations/m151021_055338_add__table__customer_cart.php @@ -0,0 +1,40 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_060337_add__table__sale.php b/console/migrations/m151021_060337_add__table__sale.php new file mode 100644 index 0000000..e703a13 --- /dev/null +++ b/console/migrations/m151021_060337_add__table__sale.php @@ -0,0 +1,55 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_061514_alter__table__transfer__timestamp__fields__to__date.php b/console/migrations/m151021_061514_alter__table__transfer__timestamp__fields__to__date.php new file mode 100644 index 0000000..eb2a286 --- /dev/null +++ b/console/migrations/m151021_061514_alter__table__transfer__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_061653_alter__table__card__timestamp__fields__to__date.php b/console/migrations/m151021_061653_alter__table__card__timestamp__fields__to__date.php new file mode 100644 index 0000000..3275664 --- /dev/null +++ b/console/migrations/m151021_061653_alter__table__card__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_061831_alter__table__currency__timestamp__fields__to__date.php b/console/migrations/m151021_061831_alter__table__currency__timestamp__fields__to__date.php new file mode 100644 index 0000000..b4931cb --- /dev/null +++ b/console/migrations/m151021_061831_alter__table__currency__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_061918_alter__table__customer__timestamp__fields__to__date.php b/console/migrations/m151021_061918_alter__table__customer__timestamp__fields__to__date.php new file mode 100644 index 0000000..296b188 --- /dev/null +++ b/console/migrations/m151021_061918_alter__table__customer__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_062026_alter__table__procurement__timestamp__fields__to__date.php b/console/migrations/m151021_062026_alter__table__procurement__timestamp__fields__to__date.php new file mode 100644 index 0000000..984504b --- /dev/null +++ b/console/migrations/m151021_062026_alter__table__procurement__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_062249_alter__table__product__timestamp__fields__to__date.php b/console/migrations/m151021_062249_alter__table__product__timestamp__fields__to__date.php new file mode 100644 index 0000000..5cfda93 --- /dev/null +++ b/console/migrations/m151021_062249_alter__table__product__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_062314_alter__table__product_category__timestamp__fields__to__date.php b/console/migrations/m151021_062314_alter__table__product_category__timestamp__fields__to__date.php new file mode 100644 index 0000000..6bab311 --- /dev/null +++ b/console/migrations/m151021_062314_alter__table__product_category__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_062520_alter__table__ticket_type__timestamp__fields__to__date.php b/console/migrations/m151021_062520_alter__table__ticket_type__timestamp__fields__to__date.php new file mode 100644 index 0000000..33617ca --- /dev/null +++ b/console/migrations/m151021_062520_alter__table__ticket_type__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +} diff --git a/console/migrations/m151021_062816_alter__table__warehouse__timestamp__fields__to__date.php b/console/migrations/m151021_062816_alter__table__warehouse__timestamp__fields__to__date.php new file mode 100644 index 0000000..697eec9 --- /dev/null +++ b/console/migrations/m151021_062816_alter__table__warehouse__timestamp__fields__to__date.php @@ -0,0 +1,31 @@ +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() + { + } + */ +}