first commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class UserCreditPoint 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_credit_point')->setCollation('utf8mb4_general_ci')->setComment('买家信用积分');
|
||||
$table
|
||||
->addColumn(Column::unsignedInteger('user_id')->setComment('关联用户ID'))
|
||||
->addMorphs('action')
|
||||
->addColumn(Column::tinyInteger('sub_id')->setComment('行为子类型')->setDefault(0))
|
||||
->addColumn(Column::integer('origin_point')->setComment('原始信用分'))
|
||||
->addColumn(Column::integer('point')->setComment('发生信用分'))
|
||||
->addColumn(Column::unsignedInteger("create_time")->setComment('创建时间'))
|
||||
->addColumn(Column::unsignedInteger("update_time")->setComment('更新时间'))
|
||||
->addIndex(['user_id'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user