virtual_order_cards
This commit is contained in:
parent
b8d3f1bbcb
commit
2a6888bb31
@ -19,7 +19,28 @@ class CreateRealAddedOrderCardsTables extends Migration
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::unprepared(File::get(__DIR__ . '/create_real_added_order_cards_table.pgsql'));
|
Schema::create('real_added_order_cards_table_partition', function (Blueprint $table) {
|
||||||
|
$table->tinyInteger('type')->unsigned()->default(0)->comment('订单类型(1:套餐续费 2:续费包 3:加油包 4:可选包 5:附加包)');
|
||||||
|
$table->bigInteger('sim')->unsigned()->default(0)->comment('sim号');
|
||||||
|
$table->integer('order_id')->unsigned()->default(0)->comment('订单ID');
|
||||||
|
$table->integer('company_id')->unsigned()->default(0)->comment('企业ID');
|
||||||
|
$table->integer('package_id')->unsigned()->default(0)->comment('套餐ID');
|
||||||
|
$table->integer('counts')->unsigned()->default(0)->comment('数量');
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->unique(['sim', 'order_id']);
|
||||||
|
|
||||||
|
$table->comment("RD续费及增值包订单关联卡");
|
||||||
|
|
||||||
|
$table->partition('type', 'list');
|
||||||
|
$table->addPartition('real_added_order_renewal_cards', 'list', 1);
|
||||||
|
$table->addPartition('real_added_order_renewal_package_cards', 'list', 2);
|
||||||
|
$table->addPartition('real_added_order_flows_package_cards', 'list', 3);
|
||||||
|
$table->addPartition('real_added_order_optional_package_cards', 'list', 4);
|
||||||
|
$table->addPartition('real_added_order_additional_package_cards', 'list', 5);
|
||||||
|
});
|
||||||
|
|
||||||
|
// DB::unprepared(File::get(__DIR__ . '/create_real_added_order_cards_table.pgsql'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,29 @@ class CreateVirtualOrderCardsTables extends Migration
|
|||||||
}
|
}
|
||||||
|
|
||||||
DB::unprepared(File::get(__DIR__ . '/create_virtaul_order_cards_func.pgsql'));
|
DB::unprepared(File::get(__DIR__ . '/create_virtaul_order_cards_func.pgsql'));
|
||||||
DB::unprepared(File::get(__DIR__ . '/create_virtual_order_cards_table.pgsql'));
|
// DB::unprepared(File::get(__DIR__ . '/create_virtual_order_cards_table.pgsql'));
|
||||||
|
|
||||||
|
Schema::create('virtual_order_cards_partition', function (Blueprint $table) {
|
||||||
|
$table->increments('id')->comment('自增ID');
|
||||||
|
$table->tinyInteger('type')->unsigned()->default(0)->comment('订单类型(0:基础套餐 1:套餐续费 2:续费包 3:加油包 4:可选包 5:附加包)');
|
||||||
|
$table->bigInteger('sim')->unsigned()->default(0)->comment('sim号');
|
||||||
|
$table->integer('order_id')->unsigned()->default(0)->comment('订单ID');
|
||||||
|
$table->integer('company_id')->unsigned()->default(0)->comment('企业ID');
|
||||||
|
$table->integer('package_id')->unsigned()->default(0)->comment('套餐ID');
|
||||||
|
$table->integer('counts')->unsigned()->default(0)->comment('数量');
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->unique(['sim', 'order_id', 'deleted_at']);
|
||||||
|
|
||||||
|
$table->comment("RD续费及增值包订单关联卡");
|
||||||
|
|
||||||
|
$table->partition('type', 'list');
|
||||||
|
|
||||||
|
$table->addPartition('virtual_order_cards', 'list', 0);
|
||||||
|
$table->addPartition('virtual_order_renewal_cards', 'list', 1);
|
||||||
|
$table->addPartition('virtual_order_renewal_package_cards', 'list', 2);
|
||||||
|
$table->addPartition('virtual_order_flows_package_cards', 'list', 3);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,22 +13,6 @@ class CreateFlowPoolTables extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('virtual_card_flows')) {
|
|
||||||
Schema::create('virtual_card_flows', function (Blueprint $table) {
|
|
||||||
$table->integer('pool_id')->unsigned()->default(0)->comment('流量池ID');
|
|
||||||
$table->bigInteger('sim')->unsigned()->default(0)->comment('SIM号');
|
|
||||||
$table->integer('month')->unsigned()->default(0)->comment('月份');
|
|
||||||
$table->integer('kilobyte')->unsigned()->default(0)->comment('使用流量 单位KB');
|
|
||||||
$table->comment('VD卡流量使用情况');
|
|
||||||
|
|
||||||
$table->primary('month');
|
|
||||||
|
|
||||||
$table->partition('month', 'list');
|
|
||||||
$table->addPartition('virtual_card_flows_201801', 'list', [201801]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
if (!Schema::hasTable('real_flow_pools')) {
|
if (!Schema::hasTable('real_flow_pools')) {
|
||||||
Schema::create('real_flow_pools', function (Blueprint $table) {
|
Schema::create('real_flow_pools', function (Blueprint $table) {
|
||||||
$table->increments('id')->comment('自增ID');
|
$table->increments('id')->comment('自增ID');
|
||||||
@ -89,13 +73,17 @@ class CreateFlowPoolTables extends Migration
|
|||||||
|
|
||||||
if (!Schema::hasTable('virtual_card_flows')) {
|
if (!Schema::hasTable('virtual_card_flows')) {
|
||||||
Schema::create('virtual_card_flows', function (Blueprint $table) {
|
Schema::create('virtual_card_flows', function (Blueprint $table) {
|
||||||
|
$table->increments('id')->comment('订单ID');
|
||||||
$table->integer('pool_id')->unsigned()->default(0)->comment('流量池ID');
|
$table->integer('pool_id')->unsigned()->default(0)->comment('流量池ID');
|
||||||
$table->bigInteger('sim')->unsigned()->default(0)->comment('SIM号');
|
$table->bigInteger('sim')->unsigned()->default(0)->comment('SIM号');
|
||||||
$table->integer('month')->unsigned()->default(0)->comment('月份');
|
$table->integer('month')->unsigned()->default(0)->comment('月份');
|
||||||
$table->integer('kilobyte')->unsigned()->default(0)->comment('使用流量 单位KB');
|
$table->integer('kilobyte')->unsigned()->default(0)->comment('使用流量 单位KB');
|
||||||
$table->comment('VD卡流量使用情况');
|
$table->comment('VD卡流量使用情况');
|
||||||
|
|
||||||
$table->primary('sim');
|
$table->index('month');
|
||||||
|
$table->index('pool_id');
|
||||||
|
|
||||||
|
$table->partition('month', 'list');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,5 +96,8 @@ class CreateFlowPoolTables extends Migration
|
|||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('virtual_card_flows');
|
Schema::dropIfExists('virtual_card_flows');
|
||||||
|
Schema::dropIfExists('virtual_flow_pool_settings');
|
||||||
|
Schema::dropIfExists('virtual_flow_pools');
|
||||||
|
Schema::dropIfExists('real_flow_pools');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,4 +156,22 @@ class PostgresSchemaGrammar extends Grammar
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SQL for an auto-increment column modifier.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Schema\Blueprint $blueprint
|
||||||
|
* @param \Illuminate\Support\Fluent $column
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
|
||||||
|
{
|
||||||
|
if (in_array($column->type, $this->serials) && $column->autoIncrement) {
|
||||||
|
if ($blueprint->partition && $blueprint->partition['column'] !== $column->name) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ' primary key';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user