| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230911020254QimallWechatSendMessageLog
- */
- class M230911020254QimallWechatSendMessageLog extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_wechat_send_message_log';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="
- CREATE TABLE `qimall_wechat_send_message_log` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
- `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
- `openid` varbinary(255) NOT NULL DEFAULT '' COMMENT 'openid',
- `send_data` text COMMENT '发送参数',
- `result_data` text COMMENT '返回参数',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- `created_at` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='公众号发送模板消息日志';
- ";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230911020254QimallWechatSendMessageLog cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230911020254QimallWechatSendMessageLog cannot be reverted.\n";
- return false;
- }
- */
- }
|