45 lines
1.9 KiB
PHP

<?php
use think\migration\Migrator;
use think\migration\db\Column;
class CdkCode 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_code', ['comment' => '兑换码', 'engine' => 'InnoDB', 'encoding' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci']);
$table->addColumn('cdk_code', 'string',['limit'=>10,'default'=>'','comment'=>'兑换码'])
->addColumn('type', 'integer',['limit'=>1, 'default'=>0,'comment'=>'兑换类型'])
->addColumn('money', 'decimal',['limit'=>[8,2], 'default'=>0,'comment'=>'价值'])
->addColumn('item_id', 'integer',['limit'=>8, 'default'=>0,'comment'=>'物品id'])
->addColumn('item_name', 'string',['limit'=>50, 'default'=>'','comment'=>'物品描述'])
->addColumn('mail', 'string',['limit'=>150, 'default'=>'','comment'=>'邮件物品'])
->addColumn('num', 'integer',['limit'=>5, '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();
}
}