| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230531082246QimallGoodsServiceSyncLogs
- */
- class M230531082246QimallCommonSyncLogs extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_common_sync_logs';
- $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if (!empty($res)) return '';
- $sql = "CREATE TABLE `qimall_common_sync_logs` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `type` varchar(255) NOT NULL DEFAULT '' COMMENT '类型',
- `self_mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身商城ID',
- `source_mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '源商城ID',
- `type_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身商城的类型id',
- `source_type_id` int(11) NOT NULL DEFAULT '0' COMMENT '源商城的的类型id',
- `created_at` bigint(20) NOT NULL DEFAULT '0',
- `updated_at` bigint(20) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `idx_index` (`type`,`self_mall_id`,`source_mall_id`,`source_type_id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商城公共信息同步日志表';";
- $this->execute($sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230531082246QimallGoodsServiceSyncLogs cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230531082246QimallGoodsServiceSyncLogs cannot be reverted.\n";
- return false;
- }
- */
- }
|