38 lines
1.7 KiB
PHP
Executable File
38 lines
1.7 KiB
PHP
Executable File
<?php
|
|
|
|
use think\migration\Migrator;
|
|
|
|
class Member extends Migrator
|
|
{
|
|
public function change()
|
|
{
|
|
$table = $this->table('member', [
|
|
'engine' => 'InnoDB',
|
|
'comment' => '会员管理',
|
|
'collation' => 'utf8mb4_general_ci'
|
|
]);
|
|
|
|
//删除表
|
|
if ($table->exists()) {
|
|
$table->drop();
|
|
}
|
|
|
|
$table
|
|
->addColumn('email', 'string', ['limit' => 2551, 'null' => 1, 'default' => '','comment' => '邮箱'])
|
|
->addColumn('password', 'string', ['limit' => 255, 'null' => 1, 'default' => '','comment' => '密码'])
|
|
->addColumn('nickname', 'string', ['limit' => 255, 'null' => 1, 'default' => '','comment' => '昵称'])
|
|
->addColumn('sex', 'boolean', ['limit' => 4, 'null' => 1, 'default' => '0','comment' => '性别.1=男,2=女,'])
|
|
->addColumn('vip_time', 'integer', ['limit' => 11, 'null' => 1, 'default' => '0','comment' => 'vip到期时间'])
|
|
->addColumn('avatar_pic', 'string', ['limit' => 255, 'null' => 1, 'default' => '0','comment' => '头像'])
|
|
->addColumn('login_time', 'datetime', ['null' => 1, 'comment' => '注册时间'])
|
|
->addColumn('login_ip', 'string', ['limit' => 255, 'null' => 1, 'default' => '','comment' => '登录IP'])
|
|
->addColumn('status', 'boolean', ['limit' => 4, 'null' => 1, 'default' => '0','comment' => '账号状态.2=锁定,1=正常,默认:1'])
|
|
->addColumn('create_time', 'datetime', ['null' => 1, 'comment' => '创建时间'])
|
|
->addColumn('update_time', 'datetime', ['null' => 1, 'comment' => '更新时间'])
|
|
->addColumn('delete_time', 'datetime', ['null' => 1, 'comment' => '删除时间'])
|
|
|
|
;
|
|
|
|
$table->create();
|
|
}
|
|
} |