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

51 lines
3.4 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Db\Adapter\MysqlAdapter;
use Phinx\Migration\AbstractMigration;
final class CreatePlayerMoneyEditLog 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_money_edit_log');
if (!$exists) {
$table = $this->table('player_money_edit_log', ['comment' => '玩家钱包管理员调整日志']);
$table->addColumn('player_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '玩家id'])
->addColumn('type', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 0, 'comment' => '類型 1=存 0=出'])
->addColumn('action', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => '手動輸入類型'])
->addColumn('tradeno', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => '單號'])
->addColumn('currency', 'string', ['limit' => 10, 'null' => false, 'default' => '', 'comment' => '幣種'])
->addColumn('money', 'decimal', ['precision' => 14, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '金額'])
->addColumn('origin_money', 'decimal', ['precision' => 14, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '原始金額'])
->addColumn('after_money', 'decimal', ['precision' => 14, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '異動後金額'])
->addColumn('inmoney', 'decimal', ['precision' => 14, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '實際金額'])
->addColumn('subsidy_money', 'decimal', ['precision' => 14, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '補助金額'])
->addColumn('bet_multiple', 'decimal', ['precision' => 8, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '流水倍數'])
->addColumn('bet_num', 'decimal', ['precision' => 14, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '流水'])
->addColumn('remark', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '資金調整備註'])
->addColumn('user_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '管理员id'])
->addColumn('user_name', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => '管理员名称'])
->addColumn('deleted_at', 'timestamp', ['comment' => '更新时间'])
->addColumn('created_at', 'timestamp', ['comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['comment' => '更新时间'])
->addIndex(['tradeno'], ['name' => 'idx_tradeno', 'unique' => true])
->addIndex(['user_id'], ['name' => 'idx_user_id'])
->addIndex(['player_id'], ['name' => 'idx_player_id'])
->create();
}
}
}