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(); } } }