mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 20:52:44 +08:00
Merge branch 'xiaochong0302/wx-oa' into demo
This commit is contained in:
commit
c37055445d
141
db/migrations/20201212102844_schema_202012121830.php
Normal file
141
db/migrations/20201212102844_schema_202012121830.php
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Phinx\Db\Adapter\MysqlAdapter;
|
||||||
|
|
||||||
|
class Schema202012121830 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('union_id', 'string', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '',
|
||||||
|
'limit' => 50,
|
||||||
|
'collation' => 'utf8mb4_general_ci',
|
||||||
|
'encoding' => 'utf8mb4',
|
||||||
|
'comment' => 'union_id',
|
||||||
|
'after' => 'user_id',
|
||||||
|
])
|
||||||
|
->changeColumn('open_id', 'string', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '',
|
||||||
|
'limit' => 50,
|
||||||
|
'collation' => 'utf8mb4_general_ci',
|
||||||
|
'encoding' => 'utf8mb4',
|
||||||
|
'comment' => '开放ID',
|
||||||
|
'after' => 'union_id',
|
||||||
|
])
|
||||||
|
->changeColumn('open_name', 'string', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '',
|
||||||
|
'limit' => 30,
|
||||||
|
'collation' => 'utf8mb4_general_ci',
|
||||||
|
'encoding' => 'utf8mb4',
|
||||||
|
'comment' => '开放名称',
|
||||||
|
'after' => 'open_id',
|
||||||
|
])
|
||||||
|
->changeColumn('open_avatar', 'string', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '',
|
||||||
|
'limit' => 150,
|
||||||
|
'collation' => 'utf8mb4_general_ci',
|
||||||
|
'encoding' => 'utf8mb4',
|
||||||
|
'comment' => '开放头像',
|
||||||
|
'after' => 'open_name',
|
||||||
|
])
|
||||||
|
->changeColumn('provider', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '提供方',
|
||||||
|
'after' => 'open_avatar',
|
||||||
|
])
|
||||||
|
->changeColumn('deleted', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '删除标识',
|
||||||
|
'after' => 'provider',
|
||||||
|
])
|
||||||
|
->changeColumn('create_time', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '创建时间',
|
||||||
|
'after' => 'deleted',
|
||||||
|
])
|
||||||
|
->changeColumn('update_time', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '更新时间',
|
||||||
|
'after' => 'create_time',
|
||||||
|
])
|
||||||
|
->addIndex(['user_id'], [
|
||||||
|
'name' => 'user_id',
|
||||||
|
'unique' => false,
|
||||||
|
])
|
||||||
|
->save();
|
||||||
|
$this->table('kg_wechat_subscribe', [
|
||||||
|
'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,
|
||||||
|
'identity' => 'enable',
|
||||||
|
'comment' => '主键编号',
|
||||||
|
])
|
||||||
|
->addColumn('user_id', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '用户编号',
|
||||||
|
'after' => 'id',
|
||||||
|
])
|
||||||
|
->addColumn('open_id', 'string', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '',
|
||||||
|
'limit' => 50,
|
||||||
|
'collation' => 'utf8mb4_general_ci',
|
||||||
|
'encoding' => 'utf8mb4',
|
||||||
|
'comment' => '开放ID',
|
||||||
|
'after' => 'user_id',
|
||||||
|
])
|
||||||
|
->addColumn('deleted', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '删除标识',
|
||||||
|
'after' => 'open_id',
|
||||||
|
])
|
||||||
|
->addColumn('create_time', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '创建时间',
|
||||||
|
'after' => 'deleted',
|
||||||
|
])
|
||||||
|
->addColumn('update_time', 'integer', [
|
||||||
|
'null' => false,
|
||||||
|
'default' => '0',
|
||||||
|
'limit' => MysqlAdapter::INT_REGULAR,
|
||||||
|
'comment' => '更新时间',
|
||||||
|
'after' => 'create_time',
|
||||||
|
])
|
||||||
|
->create();
|
||||||
|
}
|
||||||
|
}
|
53
db/migrations/20201212112717_data_202012121830.php
Normal file
53
db/migrations/20201212112717_data_202012121830.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
final class Data202012121830 extends AbstractMigration
|
||||||
|
{
|
||||||
|
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$rows = [
|
||||||
|
[
|
||||||
|
'section' => 'wechat.oa',
|
||||||
|
'item_key' => 'enabled',
|
||||||
|
'item_value' => '0',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'section' => 'wechat.oa',
|
||||||
|
'item_key' => 'app_id',
|
||||||
|
'item_value' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'section' => 'wechat.oa',
|
||||||
|
'item_key' => 'app_secret',
|
||||||
|
'item_value' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'section' => 'wechat.oa',
|
||||||
|
'item_key' => 'app_token',
|
||||||
|
'item_value' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'section' => 'wechat.oa',
|
||||||
|
'item_key' => 'aes_key',
|
||||||
|
'item_value' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'section' => 'wechat.oa',
|
||||||
|
'item_key' => 'notify_url',
|
||||||
|
'item_value' => '',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->table('kg_setting')->insert($rows)->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->execute("DELETE FROM kg_setting WHERE section = 'wechat.oa'");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user