54 lines
4.0 KiB
PHP
54 lines
4.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Db\Adapter\MysqlAdapter;
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class CreatePlayerExtend extends AbstractMigration
|
|
{
|
|
/**
|
|
* Change Method.
|
|
*
|
|
* Write your reversible migrations using this method.
|
|
*
|
|
* More information on writing migrations is available here:
|
|
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
|
|
*
|
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
|
* with the Table class.
|
|
*/
|
|
public function change(): void
|
|
{
|
|
$exists = $this->hasTable('player_extend');
|
|
if (!$exists) {
|
|
$table = $this->table('player_extend', ['comment' => '玩家扩展数据']);
|
|
$table->addColumn('player_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '玩家id'])
|
|
->addColumn('sex', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'default' => null, 'comment' => '性別 1男 2女 3三性'])
|
|
->addColumn('email', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '信箱'])
|
|
->addColumn('ip', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '注册IP'])
|
|
->addColumn('qq', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => 'qq号'])
|
|
->addColumn('telegram', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => 'telegram'])
|
|
->addColumn('birthday', 'date', ['default' => null, 'comment' => '生日'])
|
|
->addColumn('id_number', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => '身分證'])
|
|
->addColumn('address', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '地址'])
|
|
->addColumn('wechat', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '微信号'])
|
|
->addColumn('facebook', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => 'facebook'])
|
|
->addColumn('line', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => 'line'])
|
|
->addColumn('remark', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '备注'])
|
|
->addColumn('recharge_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => true, 'null' => false, 'default' => 0, 'comment' => '总充值金额'])
|
|
->addColumn('withdraw_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => true, 'null' => false, 'default' => 0, 'comment' => '总提现金额'])
|
|
->addColumn('present_in_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => true, 'null' => false, 'default' => 0, 'comment' => '总提转入金额'])
|
|
->addColumn('present_out_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => true, 'null' => false, 'default' => 0, 'comment' => '总提转出金额'])
|
|
->addColumn('third_recharge_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => true, 'null' => false, 'default' => 0, 'comment' => '第三方总充值金额'])
|
|
->addColumn('third_withdraw_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => true, 'null' => false, 'default' => 0, 'comment' => '第三方总提现金额'])
|
|
->addColumn('coin_recharge_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => true, 'null' => false, 'default' => 0, 'comment' => '币商充值总金额'])
|
|
->addColumn('created_at', 'timestamp', ['comment' => '创建时间'])
|
|
->addColumn('updated_at', 'timestamp', ['comment' => '更新时间'])
|
|
->addColumn('deleted_at', 'timestamp', ['comment' => '删除时间'])
|
|
->addIndex(['player_id'], ['name' => 'uni_player_id', 'unique' => true])
|
|
->create();
|
|
}
|
|
}
|
|
}
|