| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace addons\CloudStock\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230606010207QimallAddonsCloudStockFillOrderRelation
- */
- class M230606010207QimallAddonsCloudStockFillOrderRelation extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_cloud_stock_fill_order_relation';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="CREATE TABLE `qimall_addons_cloud_stock_fill_order_relation` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL COMMENT '商城id',
- `user_id` int(11) NOT NULL COMMENT '补货代理商用户id',
- `order_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '订单id',
- `fill_order_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '补货订单id',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='购买升级礼包,订单-补货订单关联表';";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230606010207QimallAddonsCloudStockFillOrderRelation cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230606010207QimallAddonsCloudStockFillOrderRelation cannot be reverted.\n";
- return false;
- }
- */
- }
|