mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-05-23 21:39:36 +08:00
modified 添加数据表迁移
This commit is contained in:
parent
b1ece57b69
commit
dfe8929abc
@ -34,11 +34,11 @@ class AdminAuthGroupAccess extends Migrator {
|
||||
'default' => 0,
|
||||
'signed' => false,
|
||||
'comment' => ''
|
||||
])->addColumn('groupId', 'string', [
|
||||
])->addColumn('group_id', 'string', [
|
||||
'limit' => 255,
|
||||
'default' => '',
|
||||
'comment' => ''
|
||||
])->addIndex(['uid'])->addIndex(['groupId'])->create();
|
||||
])->addIndex(['uid'])->addIndex(['group_id'])->create();
|
||||
|
||||
$table->changeColumn('id', 'integer', ['signed' => false]);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class AdminAuthRule extends Migrator {
|
||||
'limit' => 80,
|
||||
'default' => '',
|
||||
'comment' => '规则唯一标识'
|
||||
])->addColumn('groupId', 'integer', [
|
||||
])->addColumn('group_id', 'integer', [
|
||||
'limit' => 11,
|
||||
'default' => 0,
|
||||
'signed' => false,
|
||||
|
72
database/migrations/20190508152801_admin_fields.php
Normal file
72
database/migrations/20190508152801_admin_fields.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AdminFields extends Migrator {
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||
*
|
||||
* The following commands can be used in this method and Phinx will
|
||||
* automatically reverse them when rolling back:
|
||||
*
|
||||
* createTable
|
||||
* renameTable
|
||||
* addColumn
|
||||
* renameColumn
|
||||
* addIndex
|
||||
* addForeignKey
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change() {
|
||||
$table = $this->table('admin_fields', [
|
||||
'comment' => '用于保存各个API的字段规则'
|
||||
])->setCollation('utf8mb4_general_ci');
|
||||
$table->addColumn('field_name', 'string', [
|
||||
'limit' => 50,
|
||||
'default' => '',
|
||||
'comment' => '字段名称'
|
||||
])->addColumn('hash', 'string', [
|
||||
'limit' => 50,
|
||||
'default' => '',
|
||||
'comment' => '权限所属组的ID'
|
||||
])->addColumn('data_type', 'integer', [
|
||||
'limit' => 2,
|
||||
'default' => 0,
|
||||
'comment' => '数据类型,来源于DataType类库'
|
||||
])->addColumn('default', 'string', [
|
||||
'limit' => 500,
|
||||
'default' => '',
|
||||
'comment' => '默认值'
|
||||
])->addColumn('is_must', 'integer', [
|
||||
'limit' => 2,
|
||||
'default' => 0,
|
||||
'comment' => '是否必须 0为不必须,1为必须'
|
||||
])->addColumn('range', 'string', [
|
||||
'limit' => 500,
|
||||
'default' => '',
|
||||
'comment' => '范围,Json字符串,根据数据类型有不一样的含义'
|
||||
])->addColumn('info', 'string', [
|
||||
'limit' => 500,
|
||||
'default' => '',
|
||||
'comment' => '字段说明'
|
||||
])->addColumn('type', 'integer', [
|
||||
'limit' => 2,
|
||||
'default' => 0,
|
||||
'comment' => '字段用处:0为request,1为response'
|
||||
])->addColumn('show_name', 'string', [
|
||||
'limit' => 50,
|
||||
'default' => '',
|
||||
'comment' => 'wiki显示用字段'
|
||||
])->addIndex(['hash'])->create();
|
||||
|
||||
$table->changeColumn('id', 'integer', ['signed' => false]);
|
||||
}
|
||||
}
|
67
database/migrations/20190508153800_admin_group.php
Normal file
67
database/migrations/20190508153800_admin_group.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class AdminGroup extends Migrator {
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||
*
|
||||
* The following commands can be used in this method and Phinx will
|
||||
* automatically reverse them when rolling back:
|
||||
*
|
||||
* createTable
|
||||
* renameTable
|
||||
* addColumn
|
||||
* renameColumn
|
||||
* addIndex
|
||||
* addForeignKey
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change() {
|
||||
$table = $this->table('admin_group', [
|
||||
'comment' => '接口组管理'
|
||||
])->setCollation('utf8mb4_general_ci');
|
||||
$table->addColumn('name', 'string', [
|
||||
'limit' => 128,
|
||||
'default' => '',
|
||||
'comment' => '组名称'
|
||||
])->addColumn('description', 'text', [
|
||||
'comment' => '组说明',
|
||||
'null' => true
|
||||
])->addColumn('status', 'integer', [
|
||||
'limit' => 1,
|
||||
'default' => 1,
|
||||
'comment' => '状态:为1正常,为0禁用'
|
||||
])->addColumn('hash', 'string', [
|
||||
'limit' => 128,
|
||||
'default' => '',
|
||||
'comment' => '组标识'
|
||||
])->addColumn('create_time', 'integer', [
|
||||
'limit' => 11,
|
||||
'default' => 0,
|
||||
'comment' => '创建时间'
|
||||
])->addColumn('update_time', 'integer', [
|
||||
'limit' => 11,
|
||||
'default' => 0,
|
||||
'comment' => '修改时间'
|
||||
])->addColumn('image', 'string', [
|
||||
'limit' => 256,
|
||||
'null' => true,
|
||||
'comment' => '分组封面图'
|
||||
])->addColumn('hot', 'integer', [
|
||||
'limit' => 11,
|
||||
'default' => 0,
|
||||
'comment' => '分组热度'
|
||||
])->create();
|
||||
|
||||
$table->changeColumn('id', 'integer', ['signed' => false]);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user