| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M231214102305AddQimallMallHost
- */
- class M231214102305AddQimallMallHost extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_mall_host';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="CREATE TABLE `qimall_mall_host` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT 0 COMMENT '商城id',
- `backend_url` varchar(255) NOT NULL DEFAULT '' COMMENT '后台管理域名',
- `h5_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'h5域名',
- `api_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'api域名',
- `static_url` varchar(255) NOT NULL DEFAULT '' COMMENT '静态资源域名',
- `is_custom_host` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否自定义域名',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='商城自定义域名';";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M231214102305AddQimallMallHost cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M231214102305AddQimallMallHost cannot be reverted.\n";
- return false;
- }
- */
- }
|