65 lines
2.5 KiB
PHP
65 lines
2.5 KiB
PHP
<?php
|
||
|
||
use Illuminate\Support\Facades\DB;
|
||
use Illuminate\Support\Facades\Schema;
|
||
use Illuminate\Database\Schema\Blueprint;
|
||
|
||
require_once realpath(dirname(__FILE__) . '/TestCase.php');
|
||
|
||
DB::table('virtual_orders')->truncate();
|
||
|
||
DB::table('virtual_order_cards_partition')->truncate();
|
||
|
||
dd();
|
||
|
||
Schema::dropIfExists('real_order_cards_partition');
|
||
|
||
Schema::create('real_order_cards_partition', function (Blueprint $table) {
|
||
$table->increments('id')->comment('关联表ID');
|
||
$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->integer('unit_price')->unsigned()->default(0)->comment('单价');
|
||
$table->integer('virtual_order_id')->unsigned()->default(0)->comment('VD 订单ID');
|
||
$table->timestamps();
|
||
$table->softDeletes();
|
||
|
||
$table->comment("RD订单企业套餐卡关联表");
|
||
|
||
$table->partition('type', 'list');
|
||
$table->addPartition('real_order_cards', 'list', [0]);
|
||
$table->addPartition('real_order_renewal_cards', 'list', [1]);
|
||
$table->addPartition('real_order_renewal_package_cards', 'list', [2]);
|
||
$table->addPartition('real_order_flows_package_cards', 'list', [3]);
|
||
$table->addPartition('real_order_optional_package_cards', 'list', [4]);
|
||
$table->addPartition('real_order_additional_package_cards', 'list', [5]);
|
||
});
|
||
|
||
Schema::table('real_order_cards', function (Blueprint $table) {
|
||
$table->unique(['sim', 'order_id']);
|
||
$table->unique(['sim', 'deleted_at']);
|
||
});
|
||
|
||
Schema::table('real_order_renewal_cards', function (Blueprint $table) {
|
||
$table->unique(['sim', 'order_id']);
|
||
});
|
||
|
||
Schema::table('real_order_renewal_package_cards', function (Blueprint $table) {
|
||
$table->unique(['sim', 'order_id']);
|
||
});
|
||
|
||
Schema::table('real_order_flows_package_cards', function (Blueprint $table) {
|
||
$table->unique(['sim', 'order_id']);
|
||
});
|
||
|
||
Schema::table('real_order_optional_package_cards', function (Blueprint $table) {
|
||
$table->unique(['sim', 'order_id']);
|
||
});
|
||
|
||
Schema::table('real_order_additional_package_cards', function (Blueprint $table) {
|
||
$table->unique(['sim', 'order_id']);
|
||
});
|