修改表结构
This commit is contained in:
parent
0d40d74935
commit
bfc4904379
@ -36,7 +36,7 @@ class Rbac extends Migrator
|
||||
{
|
||||
$table = $this->table(config('permissions.table.role'), [ 'engine'=>'InnoDB']);
|
||||
$table->addColumn('name', 'string',['limit' => 50, 'default'=>'','comment'=>'角色名称'])
|
||||
->addColumn('created_at', 'timestamp', [ 'comment' => '创建时间'])
|
||||
->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'timestamp', [ 'comment' => '更新时间'])
|
||||
->addIndex(['name'], ['unique' => true])
|
||||
->create();
|
||||
@ -49,7 +49,7 @@ class Rbac extends Migrator
|
||||
->addColumn('controller', 'string',['limit' => 50, 'default'=>'','comment'=>'控制器名称'])
|
||||
->addColumn('action', 'string',['limit' => 50, 'default'=>'1','comment'=>'方法名称'])
|
||||
->addColumn('is_show', 'integer',['limit' => MysqlAdapter::INT_TINY, 'default'=> 1,'comment'=>'1 展示 2 隐藏'])
|
||||
->addColumn('created_at', 'timestamp', [ 'comment' => '创建时间'])
|
||||
->addColumn('created_at', 'timestamp', [ 'default' => 'CURRENT_TIMESTAMP','comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'timestamp', [ 'comment' => '更新时间'])
|
||||
->addIndex(['name'], ['unique' => true])
|
||||
->create();
|
||||
|
@ -34,7 +34,7 @@ class Users extends Migrator
|
||||
->addColumn('password', 'string',['limit' => 255, 'default'=>'','comment'=>'密码'])
|
||||
->addColumn('remember_token', 'string',['limit' => 255, 'default'=>'','comment'=>'记住token'])
|
||||
->addColumn('login_ip', 'string',['limit' => 50, 'default'=>'','comment'=>'登录IP'])
|
||||
->addColumn('created_at', 'timestamp', [ 'comment' => '更新时间'])
|
||||
->addColumn('created_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '更新时间'])
|
||||
->addColumn('login_at', 'timestamp', [ 'comment' => '最近登录时间'])
|
||||
->addIndex(['name', 'email'], ['unique' => true])
|
||||
->create();
|
||||
|
43
database/migrations/20190117094442_log.php
Normal file
43
database/migrations/20190117094442_log.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
use Phinx\Db\Adapter\MysqlAdapter;
|
||||
|
||||
class Log 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('option_log', ['engine' => 'InnoDB']);
|
||||
$table->addColumn('user_name', 'string',['limit' => 50, 'default'=>'','comment'=>'用户名'])
|
||||
->addColumn('user_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'comment' => '用户ID'])
|
||||
->addColumn('module', 'string',['limit' => 20, 'default'=>'','comment'=>'模块'])
|
||||
->addColumn('controller', 'string',['limit' => 20, 'default'=>'','comment'=>'控制器'])
|
||||
->addColumn('action', 'string',['limit' => 20, 'default'=>'','comment'=>'方法'])
|
||||
->addColumn('option', 'string',['limit' => 50, 'default'=>'','comment'=>'操作'])
|
||||
->addColumn('created_at', 'timestamp', [ 'default' => 'CURRENT_TIMESTAMP','comment' => '更新时间'])
|
||||
->create();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user