1 Star 0 Fork 78

xiaotu996/laytp

forked from JunStar/laytp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
20201013152732_adminRoleUser.php 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
JunStar 提交于 2022-01-18 20:12 . 2.0发版
<?php
use think\migration\Migrator;
class AdminRoleUser 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_role_user', [
'engine' => 'InnoDB',
'comment' => '角色与管理员关系',
'collation' => 'utf8mb4_general_ci',
]);
if ($table->exists()) {
$table->drop();
}
$table
->addColumn('admin_user_id', 'integer', ['length' => 11, 'default' => 0, 'comment' => '用户ID'])
->addColumn('admin_role_id', 'integer', ['length' => 11, 'default' => 0, 'comment' => '角色ID'])
->create();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/xiaotu996/laytp.git
git@gitee.com:xiaotu996/laytp.git
xiaotu996
laytp
laytp
2.1

搜索帮助