59 lines
4.1 KiB
PHP
59 lines
4.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Db\Adapter\MysqlAdapter;
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class CreatePlayer 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');
|
|
if (!$exists) {
|
|
$table = $this->table('player', ['comment' => '玩家']);
|
|
$table->addColumn('talk_user_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'default' => null, 'comment' => '来聊聊账号id'])
|
|
->addColumn('uuid', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => 'uuid'])
|
|
->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '部门id'])
|
|
->addColumn('recommend_id', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'default' => null, 'comment' => '推广id'])
|
|
->addColumn('type', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'null' => false, 'default' => 1, 'comment' => '1 玩家'])
|
|
->addColumn('status', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 1, 'comment' => '帐号状态 1啟用 0停用'])
|
|
->addColumn('status_withdraw', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'signed' => false, 'null' => false, 'default' => 1, 'comment' => '取款状态 1啟用 0停用'])
|
|
->addColumn('status_transfer', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 1, 'comment' => '轉點功能'])
|
|
->addColumn('name', 'string', ['limit' => 50, 'null' => false, 'default' => '', 'comment' => '姓名'])
|
|
->addColumn('phone', 'string', ['limit' => 25, 'null' => false, 'default' => '', 'comment' => '手机号'])
|
|
->addColumn('country_code', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => '手機國際碼'])
|
|
->addColumn('recommend_code', 'string', ['limit' => 10, 'null' => false, 'default' => '', 'comment' => '玩家推广码'])
|
|
->addColumn('recommended_code', 'string', ['limit' => 10, 'null' => false, 'default' => '', 'comment' => '输入推广码'])
|
|
->addColumn('play_password', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '玩家支付密码'])
|
|
->addColumn('password', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '玩家密碼'])
|
|
->addColumn('currency', 'string', ['limit' => 5, 'null' => false, 'default' => '', 'comment' => '币别代码'])
|
|
->addColumn('flag', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '玩家標籤'])
|
|
->addColumn('avatar', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '头像'])
|
|
->addColumn('created_at', 'timestamp', ['comment' => '创建时间'])
|
|
->addColumn('updated_at', 'timestamp', ['comment' => '更新时间'])
|
|
->addColumn('deleted_at', 'timestamp', ['comment' => '删除时间'])
|
|
->addColumn('player_tag', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '玩家標籤'])
|
|
->addIndex(['status'], ['name' => 'idx_status'])
|
|
->addIndex(['currency'], ['name' => 'idx_currency'])
|
|
->addIndex(['talk_user_id'], ['name' => 'idx_talk_user_id'])
|
|
->addIndex(['recommend_id'], ['name' => 'idx_recommend_id'])
|
|
->addIndex(['department_id'], ['name' => 'idx_department_id'])
|
|
->addIndex(['uuid'], ['name' => 'idx_uuid'])
|
|
->addIndex(['phone'], ['name' => 'idx_phone'])
|
|
->create();
|
|
}
|
|
}
|
|
}
|