| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M221007083213AddQimallAddonsStoreOrderGive
- */
- class M221007083213AddQimallAddonsStoreOrderGive extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try{
- $table = 'qimall_addons_store_order_give';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="CREATE TABLE `{$table}` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT 'mall_id',
- `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
- `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id',
- `give_score` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '赠送积分',
- `give_coupon` text COMMENT '赠送优惠券(json字符串保存)',
- `give_currency` text COMMENT '赠送货币(json字符串保存)',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `order_id` (`order_id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='订单赠送表';
- ";
- $this->execute($sql);
- }catch (\Exception $e){}
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M221007083213AddQimallAddonsStoreOrderGive cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M221007083213AddQimallAddonsStoreOrderGive cannot be reverted.\n";
- return false;
- }
- */
- }
|