From 6af8f0cf46e992dfa51db8edf4cbb3f9280f003f Mon Sep 17 00:00:00 2001 From: denghy Date: Tue, 29 Jan 2019 18:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E5=88=9B=E5=BB=BA=E5=88=86?= =?UTF-8?q?=E5=8C=BA=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...9_create_real_added_order_cards_tables.php | 32 +++++++++++++++---- ...0946_create_virtual_order_cards_tables.php | 26 +++++++++++---- ...9_01_24_175246_create_flow_pool_tables.php | 2 +- 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/database/migrations/2018_12_24_164459_create_real_added_order_cards_tables.php b/database/migrations/2018_12_24_164459_create_real_added_order_cards_tables.php index 5e4bdc06..bb40082f 100644 --- a/database/migrations/2018_12_24_164459_create_real_added_order_cards_tables.php +++ b/database/migrations/2018_12_24_164459_create_real_added_order_cards_tables.php @@ -28,16 +28,34 @@ class CreateRealAddedOrderCardsTables extends Migration $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); + $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]); + }); + + Schema::table('real_added_order_renewal_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id']); + }); + + Schema::table('real_added_order_renewal_package_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id']); + }); + + Schema::table('real_added_order_flows_package_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id']); + }); + + Schema::table('real_added_order_optional_package_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id']); + }); + + Schema::table('real_added_order_additional_package_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id']); }); // DB::unprepared(File::get(__DIR__ . '/create_real_added_order_cards_table.pgsql')); diff --git a/database/migrations/2018_12_31_170946_create_virtual_order_cards_tables.php b/database/migrations/2018_12_31_170946_create_virtual_order_cards_tables.php index b722ba5b..88847bfd 100644 --- a/database/migrations/2018_12_31_170946_create_virtual_order_cards_tables.php +++ b/database/migrations/2018_12_31_170946_create_virtual_order_cards_tables.php @@ -33,16 +33,30 @@ class CreateVirtualOrderCardsTables extends Migration $table->timestamps(); $table->softDeletes(); - $table->unique(['sim', 'order_id', 'deleted_at']); - $table->comment("VD卡关联套餐订单"); $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); + $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]); + }); + + Schema::table('virtual_order_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id', 'deleted_at']); + }); + + Schema::table('virtual_order_renewal_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id', 'deleted_at']); + }); + + Schema::table('virtual_order_renewal_package_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id', 'deleted_at']); + }); + + Schema::table('virtual_order_flows_package_cards', function (Blueprint $table) { + $table->unique(['sim', 'order_id', 'deleted_at']); }); } diff --git a/database/migrations/2019_01_24_175246_create_flow_pool_tables.php b/database/migrations/2019_01_24_175246_create_flow_pool_tables.php index ba302788..b31d56de 100644 --- a/database/migrations/2019_01_24_175246_create_flow_pool_tables.php +++ b/database/migrations/2019_01_24_175246_create_flow_pool_tables.php @@ -55,7 +55,7 @@ class CreateFlowPoolTables extends Migration } if (!Schema::hasTable('virtual_flow_pool_settings')) { - Schema::create('virtual_flow_pools', function (Blueprint $table) { + Schema::create('virtual_flow_pool_settings', function (Blueprint $table) { $table->increments('id')->comment('自增ID'); $table->integer('pool_id')->unsigned()->default(0)->comment('流量池ID'); $table->text('minimum_settings')->nullable()->comment('套餐保底配置');