40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
||
|
||
use Phinx\Migration\AbstractMigration;
|
||
|
||
/**
|
||
* game_user:档位权重、中大奖权重、抽奖券数量(JSON 文本)
|
||
*/
|
||
class GameUserTierBigwinTicket extends AbstractMigration
|
||
{
|
||
public function change(): void
|
||
{
|
||
if (!$this->hasTable('game_user')) {
|
||
return;
|
||
}
|
||
$table = $this->table('game_user');
|
||
if (!$table->hasColumn('tier_weight')) {
|
||
$table->addColumn('tier_weight', 'text', [
|
||
'null' => true,
|
||
'default' => null,
|
||
'comment' => '档位权重 JSON,如 [{"T1":"5"},{"T2":"20"}]',
|
||
]);
|
||
}
|
||
if (!$table->hasColumn('bigwin_weight')) {
|
||
$table->addColumn('bigwin_weight', 'text', [
|
||
'null' => true,
|
||
'default' => null,
|
||
'comment' => '中大奖权重 JSON',
|
||
]);
|
||
}
|
||
if (!$table->hasColumn('ticket_count')) {
|
||
$table->addColumn('ticket_count', 'text', [
|
||
'null' => true,
|
||
'default' => null,
|
||
'comment' => '抽奖券 JSON,如 [{"ante":1,"count":1}]',
|
||
]);
|
||
}
|
||
$table->update();
|
||
}
|
||
}
|