gamebackend/database/migrations/20220113104428_cdk_record.php

46 lines
1.9 KiB
PHP
Raw Permalink Normal View History

<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CdkRecord 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('cdk_record', ['comment' => '兑换记录', 'engine' => 'InnoDB', 'encoding' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci']);
$table->addColumn('cdk_code', 'string',['limit'=>10,'default'=>'','comment'=>'兑换码'])
->addColumn('account', 'string',['limit'=>30, 'default'=>'','comment'=>'玩家账号'])
->addColumn('role_id', 'integer',['limit'=>8, 'default'=>0,'comment'=>'角色id'])
->addColumn('money', 'decimal',['limit'=>[8,2], 'default'=>0,'comment'=>'价值'])
->addColumn('agency_account', 'string',['limit'=>30, 'default'=>'','comment'=>'代理账号'])
->addColumn('item_name', 'string',['limit'=>50, 'default'=>'','comment'=>'物品描述'])
->addColumn('type', 'integer',['limit'=>1, 'default'=>0,'comment'=>'兑换类型'])
->addColumn('status', 'boolean',['limit'=>1, 'default'=>0,'comment'=>'状态'])
->addColumn('create_time', 'integer',['limit'=>10, 'default'=>0,'comment'=>'创建时间'])
->addColumn('update_time', 'integer',['limit'=>10, 'default'=>0,'comment'=>'更新时间'])
->create();
}
}