96 lines
3.1 KiB
PHP
96 lines
3.1 KiB
PHP
<?php
|
|
|
|
use think\admin\extend\PhinxExtend;
|
|
use think\migration\Migrator;
|
|
|
|
@set_time_limit(0);
|
|
@ini_set('memory_limit', -1);
|
|
|
|
class InstallTestTable extends Migrator
|
|
{
|
|
|
|
/**
|
|
* 创建数据库
|
|
*/
|
|
public function change()
|
|
{
|
|
$this->_create_test_daochu();
|
|
$this->_create_test_error();
|
|
$this->_create_test_kami_zm();
|
|
}
|
|
|
|
/**
|
|
* 创建数据对象
|
|
* @class TestDaochu
|
|
* @table test_daochu
|
|
* @return void
|
|
*/
|
|
private function _create_test_daochu()
|
|
{
|
|
// 创建数据表对象
|
|
$table = $this->table('test_daochu', [
|
|
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '',
|
|
]);
|
|
// 创建或更新数据表
|
|
PhinxExtend::upgrade($table, [
|
|
['merchant_order_id', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['订单付款时间', 'time', ['default' => NULL, 'null' => true, 'comment' => '']],
|
|
['买家实际支付金额', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']],
|
|
['宝贝标题', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['cardno', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['cardpwd', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
], [
|
|
|
|
], false);
|
|
}
|
|
|
|
/**
|
|
* 创建数据对象
|
|
* @class TestError
|
|
* @table test_error
|
|
* @return void
|
|
*/
|
|
private function _create_test_error()
|
|
{
|
|
// 创建数据表对象
|
|
$table = $this->table('test_error', [
|
|
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '',
|
|
]);
|
|
// 创建或更新数据表
|
|
PhinxExtend::upgrade($table, [
|
|
['order_id', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['merchant_order_id', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['status', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['time', 'time', ['default' => NULL, 'null' => true, 'comment' => '']],
|
|
['cash', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']],
|
|
['num', 'integer', ['default' => NULL, 'null' => true, 'comment' => '']],
|
|
['card', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
], [
|
|
|
|
], false);
|
|
}
|
|
|
|
/**
|
|
* 创建数据对象
|
|
* @class TestKamiZm
|
|
* @table test_kami_zm
|
|
* @return void
|
|
*/
|
|
private function _create_test_kami_zm()
|
|
{
|
|
// 创建数据表对象
|
|
$table = $this->table('test_kami_zm', [
|
|
'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '',
|
|
]);
|
|
// 创建或更新数据表
|
|
PhinxExtend::upgrade($table, [
|
|
['cardno', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['cardpwd', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
['ex', 'string', ['limit' => 255, 'default' => NULL, 'null' => true, 'comment' => '']],
|
|
], [
|
|
|
|
], false);
|
|
}
|
|
|
|
}
|