| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M221110032022AddQimallAddonsStoreMiniCode
- */
- class M221110032022AddQimallAddonsStoreMiniCode extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_store_mini_code';
- $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_store_mini_code` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
- `mall_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
- `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
- `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:推广码;2:收银台二维码',
- `code` varchar(255) NOT NULL DEFAULT '' COMMENT '分享码',
- `content` varchar(255) NOT NULL DEFAULT '' COMMENT '二维码参数',
- `applet_code` varchar(255) DEFAULT '' COMMENT '小程序二维码图片地址',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态【1启用 0禁用 -1删除】',
- `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` int(10) NOT NULL DEFAULT '0' COMMENT '上次更新数据时间',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='门店小程序码生成表';";
- $this->execute($sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M221110032022AddQimallAddonsStoreMiniCode cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M221110032022AddQimallAddonsStoreMiniCode cannot be reverted.\n";
- return false;
- }
- */
- }
|