Files
CompanyProject/滴滴淘/diditao/database/migrations/20200510151559_user_id_card.php
2024-09-27 01:32:49 +08:00

47 lines
1.9 KiB
PHP

<?php
use think\migration\Migrator;
use think\migration\db\Column;
class UserIdCard 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('user_id_card')->setCollation('utf8mb4_general_ci')->setComment('用户身份证认证');
$table
->addColumn(Column::unsignedInteger('user_id')->setComment('关联用户ID'))
->addColumn(Column::unsignedInteger('front_image_id')->setComment('正面身份证图片ID'))
->addColumn(Column::unsignedInteger('bank_image_id')->setComment('反面身份证图片ID')->setNullable())
->addColumn(Column::string('true_name',20)->setComment('真实姓名'))
->addColumn(Column::char('id_card_num',18)->setComment('身份证号码'))
->addColumn(Column::tinyInteger('status')->setComment('状态0=待验证-1=未通过1=通过')->setDefault(0))
->addColumn(Column::unsignedInteger('api_record_id')->setComment('API请求ID')->setDefault(0))
->addColumn(Column::unsignedInteger("create_time")->setComment('创建时间'))
->addColumn(Column::unsignedInteger("update_time")->setComment('更新时间'))
->addIndex(['user_id'])
->addIndex(['id_card_num'])
->create();
}
}