1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-28 05:11:39 +08:00
course-tencent-cloud/db/migrations/20201205091213_create_connect_table.php
jacky huang a93ce8e293
v1.2.3 (#19)
* 去除无用的auth_url

* 修改readme

* 修复计划任务生成sitemap.xml失败问题

* 增加课程推荐

* 增加后台刷新首页缓存小工具

* 调整公众号模板消息

* 增加刷新首页推荐课程缓存逻辑

* 更新课程综合评分算法

* 修复在线用户并发重复记录问题

* 增加限制共享帐号功能

* 修复数据迁移中无符号整型问题

* 更新版本为v1.2.3
2021-01-03 15:13:40 +08:00

101 lines
3.3 KiB
PHP

<?php
use Phinx\Db\Adapter\MysqlAdapter;
class CreateConnectTable extends Phinx\Migration\AbstractMigration
{
public function change()
{
$this->table('kg_connect', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'integer', [
'null' => false,
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'identity' => 'enable',
'comment' => '主键编号',
])
->addColumn('user_id', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'comment' => '用户编号',
'after' => 'id',
])
->addColumn('open_id', 'string', [
'null' => false,
'default' => '',
'limit' => 64,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'comment' => '开放ID',
'after' => 'user_id',
])
->addColumn('open_name', 'string', [
'null' => false,
'default' => '',
'limit' => 30,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'comment' => '开放名称',
'after' => 'open_id',
])
->addColumn('open_avatar', 'string', [
'null' => false,
'default' => '',
'limit' => 150,
'collation' => 'utf8mb4_general_ci',
'encoding' => 'utf8mb4',
'comment' => '开放头像',
'after' => 'open_name',
])
->addColumn('provider', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'comment' => '提供方',
'after' => 'open_avatar',
])
->addColumn('deleted', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'comment' => '删除标识',
'after' => 'provider',
])
->addColumn('create_time', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'comment' => '创建时间',
'after' => 'deleted',
])
->addColumn('update_time', 'integer', [
'null' => false,
'default' => '0',
'limit' => MysqlAdapter::INT_REGULAR,
'signed' => false,
'comment' => '更新时间',
'after' => 'create_time',
])
->addIndex(['open_id', 'provider'], [
'name' => 'open_provider',
'unique' => false,
])
->create();
}
}