Files
dafuweng/db/migrations/20231020033110_create_player_bank.php
2026-03-02 13:44:38 +08:00

39 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Db\Adapter\MysqlAdapter;
use Phinx\Migration\AbstractMigration;
final class CreatePlayerBank 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_bank');
if (!$exists) {
$table = $this->table('player_bank', ['comment' => '玩家银行账户']);
$table->addColumn('player_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '玩家id'])
->addColumn('bank_name', 'string', ['limit' => 100, 'null' => false, 'default' => '', 'comment' => '银行名称'])
->addColumn('account', 'string', ['limit' => 100, 'null' => false, 'default' => '', 'comment' => '银行账号'])
->addColumn('account_name', 'string', ['limit' => 100, 'null' => false, 'default' => '', 'comment' => '账户所属人'])
->addColumn('status', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 1, 'comment' => '状态(0:禁用,1:启用)'])
->addColumn('created_at', 'datetime', ['comment' => '创建时间'])
->addColumn('updated_at', 'datetime', ['comment' => '更新时间'])
->addColumn('deleted_at', 'datetime', ['comment' => '删除时间'])
->addIndex(['player_id'], ['name' => 'idx_player_id'])
->create();
}
}
}