初始化
This commit is contained in:
41
db/migrations/20240511032731_create_chip_changes.php
Normal file
41
db/migrations/20240511032731_create_chip_changes.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Db\Adapter\MysqlAdapter;
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateChipChanges 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('chip_changes');
|
||||
if (!$exists) {
|
||||
$table = $this->table('chip_changes', ['comment' => '打码量变化']);
|
||||
$table->addColumn('player_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '玩家id'])
|
||||
->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '渠道/部门id'])
|
||||
->addColumn('type', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 1, 'comment' => '1 增加 2减少'])
|
||||
->addColumn('source_type', 'string', ['limit' => 125, 'null' => false, 'default' => '', 'comment' => '来源'])
|
||||
->addColumn('source_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '0 充值 1活动 2游戏'])
|
||||
->addColumn('chip_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '打码量'])
|
||||
->addColumn('before_chip_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '变化前打码量'])
|
||||
->addColumn('after_chip_amount', 'decimal', ['precision' => 10, 'scale' => 2, 'null' => false, 'default' => 0, 'comment' => '变化后打码量'])
|
||||
->addColumn('created_at', 'timestamp', ['comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'timestamp', ['comment' => '更新时间'])
|
||||
->addIndex(['player_id'], ['name' => 'idx_player_id'])
|
||||
->addIndex(['department_id'], ['name' => 'idx_department_id'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user