初始化
This commit is contained in:
38
db/migrations/20231019092731_create_api_error_log.php
Normal file
38
db/migrations/20231019092731_create_api_error_log.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Db\Adapter\MysqlAdapter;
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateApiErrorLog 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('api_error_log');
|
||||
if (!$exists) {
|
||||
$table = $this->table('api_error_log', ['comment' => 'api请求错误日志']);
|
||||
$table->addColumn('player_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '玩家id'])
|
||||
->addColumn('target', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '资源表'])
|
||||
->addColumn('target_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'null' => false, 'default' => 0, 'comment' => '资源id'])
|
||||
->addColumn('url', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '请求地址'])
|
||||
->addColumn('params', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '参数'])
|
||||
->addColumn('content', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '错误内容'])
|
||||
->addColumn('created_at', 'timestamp', ['comment' => '创建时间'])
|
||||
->addColumn('updated_at', 'timestamp', ['comment' => '更新时间'])
|
||||
->addIndex(['player_id'], ['name' => 'idx_player_id'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user