recover
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class LoginLog 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('login_log',['engine'=>'Myisam', 'comment' => '登录日志', 'signed' => false]);
|
||||
$table->addColumn('login_name', 'string',['limit' => 50,'default'=>'','comment'=>'用户名'])
|
||||
->addColumn('login_ip', 'string',['default'=>0, 'limit' => 20, 'comment'=>'登录地点ip', 'signed' => false])
|
||||
->addColumn('browser', 'string',['default'=> '','comment'=>'浏览器'])
|
||||
->addColumn('os', 'string',['default'=> '','comment'=>'操作系统'])
|
||||
->addColumn('login_at', 'integer', array('default'=>0,'comment'=>'登录时间', 'signed' => false ))
|
||||
->addColumn('status', 'integer',['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY,'default'=> 1,'comment'=>'1 成功 2 失败'])
|
||||
->create();
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class OperateLog 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('operate_log',['engine'=>'Myisam', 'comment' => '操作日志', 'signed' => false]);
|
||||
$table->addColumn('module', 'string',['limit' => 50,'default'=>'','comment'=>'模块名称'])
|
||||
->addColumn('operate', 'string',['default'=> '', 'limit' => 20, 'comment'=>'操作模块'])
|
||||
->addColumn('route', 'string',['default'=> '','limit' => 100, 'comment'=>'路由'])
|
||||
->addColumn('params', 'string',['default'=> '','limit' => 1000, 'comment'=>'参数'])
|
||||
->addColumn('ip', 'string',['default'=>'', 'limit' => 20,'comment'=>'ip', 'signed' => false])
|
||||
->addColumn('creator_id', 'integer',['default'=> 0,'comment'=>'创建人ID', 'signed' => false])
|
||||
->addColumn('method', 'string',['default'=> '','comment'=>'请求方法'])
|
||||
->addColumn('created_at', 'integer', array('default'=>0,'comment'=>'登录时间', 'signed' => false ))
|
||||
->create();
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class Attachments 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('attachments',['engine'=>'Myisam', 'comment' => '附件管理', 'signed' => false]);
|
||||
$table->addColumn('path', 'string',['limit' => 50,'default'=>'','comment'=>'附件存储路径'])
|
||||
->addColumn('url', 'string',['default'=> '', 'limit' => 100, 'comment'=>'资源地址'])
|
||||
->addColumn('mime_type', 'string',['default'=> '', 'limit' => 100, 'comment'=>'资源mimeType'])
|
||||
->addColumn('file_ext', 'string',['default'=> '','limit' => 100, 'comment'=>'资源后缀'])
|
||||
->addColumn('file_size', 'integer',['default'=> 0, 'comment'=>'资源大小'])
|
||||
->addColumn('filename', 'string',['default'=>'', 'limit' => 255, 'comment'=>'资源名称'])
|
||||
->addColumn('driver', 'string',['default'=> 0, 'limit' => 20, 'comment' => 'local,oss,qcloud,qiniu'])
|
||||
->addColumn('created_at', 'integer', array('default'=>0, 'comment'=>'创建时间', 'signed' => false ))
|
||||
->addColumn('updated_at', 'integer', array('default'=>0, 'comment'=>'更新时间', 'signed' => false ))
|
||||
->addColumn('deleted_at', 'integer', array('default'=>0, 'comment'=>'删除时间', 'signed' => false ))
|
||||
->create();
|
||||
}
|
||||
}
|
44
catch/system/database/migrations/20200417083602_config.php
Normal file
44
catch/system/database/migrations/20200417083602_config.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class Config 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('config',['engine'=>'InnoDB', 'comment' => '配置管理', 'signed' => false]);
|
||||
$table->addColumn('name', 'string',['limit' => 50,'default'=>'','comment'=>'配置名称'])
|
||||
->addColumn('pid', 'integer', array('default'=> 0,'comment'=>'父级配置', 'signed' => false ))
|
||||
->addColumn('component', 'string', ['default'=> '', 'limit' => 100, 'comment'=>'tab 引入的组件名称'])
|
||||
->addColumn('key', 'string',['default'=> '', 'limit' => 100, 'comment'=>'配置键名'])
|
||||
->addColumn('value', 'string',['default'=> '', 'limit' => 255, 'comment'=>'配置键值'])
|
||||
->addColumn('status', 'integer',['limit' => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY,'default'=> 1,'comment'=>'1 启用 2 禁用'])
|
||||
->addColumn('creator_id', 'integer', array('default'=> 0,'comment'=>'创建人', 'signed' => false ))
|
||||
->addColumn('created_at', 'integer', ['default'=> 0,'comment'=>'创建时间', 'signed' => false])
|
||||
->addColumn('updated_at', 'integer', ['default'=> 0,'comment'=>'更新时间', 'signed' => false])
|
||||
->addColumn('deleted_at', 'integer', ['default'=> 0,'comment'=>'删除时间', 'signed' => false])
|
||||
->create();
|
||||
}
|
||||
}
|
36
catch/system/database/seeds/ConfigSeed.php
Normal file
36
catch/system/database/seeds/ConfigSeed.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Seeder;
|
||||
|
||||
class ConfigSeed extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run Method.
|
||||
*
|
||||
* Write your database seeder using this method.
|
||||
*
|
||||
* More information on writing seeders is available here:
|
||||
* http://docs.phinx.org/en/latest/seeding.html
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$data = [
|
||||
[
|
||||
'name' => '基础配置',
|
||||
'pid' => 0,
|
||||
'component' => 'basis',
|
||||
'key' => 'basis',
|
||||
],
|
||||
[
|
||||
'name' => '上传配置',
|
||||
'pid' => 0,
|
||||
'component' => 'upload',
|
||||
'key' => 'upload',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($data as $item) {
|
||||
\catchAdmin\system\model\Config::create($item);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user