REAPI/database/migrations/20009999999991_install_order_table.php
mzeros b0fbd5c5a6 feat(database): 添加多个数据库迁移脚本
- 新增 test、taobao、system、suoka 和 stat 数据库表的迁移脚本- 包含各种数据表的创建和字段定义
- 为系统初始化、统计、对账等功能提供数据支持
2024-12-22 17:42:44 +08:00

45 lines
1.3 KiB
PHP

<?php
use think\admin\extend\PhinxExtend;
use think\migration\Migrator;
@set_time_limit(0);
@ini_set('memory_limit', -1);
class InstallOrderTable extends Migrator
{
/**
* 创建数据库
*/
public function change()
{
$this->_create_order_tk();
}
/**
* 创建数据对象
* @class OrderTk
* @table order_tk
* @return void
*/
private function _create_order_tk()
{
// 创建数据表对象
$table = $this->table('order_tk', [
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '',
]);
// 创建或更新数据表
PhinxExtend::upgrade($table, [
['mid', 'integer', ['default' => NULL, 'null' => false, 'comment' => '商户id']],
['order_id', 'string', ['limit' => 800, 'default' => NULL, 'null' => true, 'comment' => '本站订单id']],
['merchant_order_id', 'string', ['limit' => 1000, 'default' => NULL, 'null' => true, 'comment' => '商户订单id']],
['status', 'tinyinteger', ['limit' => 1, 'default' => 1, 'null' => false, 'comment' => '1待处理2退款成功3退款失败']],
['create_at', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'null' => false, 'comment' => '']],
], [
'status', 'order_id', 'merchant_order_id',
], false);
}
}