From 104017ed96caed282bf15172ac7c2422a3f9cb00 Mon Sep 17 00:00:00 2001 From: miroman-afk <74014189+miroman-afk@users.noreply.github.com> Date: Fri, 14 Jan 2022 14:24:19 +0300 Subject: [PATCH] v.2.5 Update migrations --- commands/POSTRestoreShift.php | 5 ++- ..._01_10_134554_create_table_subscribers.php | 22 +++++----- ...00_add_value_to_exchange_actions_table.php | 8 ++-- ...45053_add_foreign_key_to_clients_table.php | 2 +- ...0_145715_create_clients_barcodes_table.php | 22 +++++----- .../2021_08_02_132704_create_orders_table.php | 24 ++++++----- ..._08_02_133250_create_order_items_table.php | 24 ++++++----- ...227_add_columns_to_shift_online_orders.php | 40 ++++++++++++++----- ...01_10_150113_add_columns_to_units_list.php | 8 ++-- web/controllers/shifts.js | 2 +- 10 files changed, 95 insertions(+), 62 deletions(-) diff --git a/commands/POSTRestoreShift.php b/commands/POSTRestoreShift.php index 550f4b3..7616e00 100644 --- a/commands/POSTRestoreShift.php +++ b/commands/POSTRestoreShift.php @@ -171,10 +171,11 @@ class POSTRestoreShift extends HRCCommand implements HRCCommandInterface { $shift_online_deleted_item->units_id = $exchange_deleted_item["units_id"]; $shift_online_deleted_item->save(); } - + $exc_time = time(); + $diff_time = $exc_time - $nowTime; return [ 'status' => 'success', - 'message' => 'Смена восстановлена', + 'message' => 'Смена восстановлена за ' . $diff_time . ' сек', ]; } else { return [ diff --git a/database/migrations/2021_01_10_134554_create_table_subscribers.php b/database/migrations/2021_01_10_134554_create_table_subscribers.php index 08811d5..c0b72a5 100644 --- a/database/migrations/2021_01_10_134554_create_table_subscribers.php +++ b/database/migrations/2021_01_10_134554_create_table_subscribers.php @@ -11,16 +11,18 @@ class CreateTableSubscribers extends Migration { * @return void */ public function up() { - Schema::create('subscribers', function (Blueprint $table) { - $table->id(); - $table->string('code')->nullable(); - $table->string('destination_module')->nullable(); - $table->string('destination_method')->nullable(); - $table->string('source_module')->nullable(); - $table->string('source_method')->nullable(); - $table->integer('weight')->nullable(); - $table->timestamps(); - }); + if (!Schema::hasTable('subscribers')) { + Schema::create('subscribers', function (Blueprint $table) { + $table->id(); + $table->string('code')->nullable(); + $table->string('destination_module')->nullable(); + $table->string('destination_method')->nullable(); + $table->string('source_module')->nullable(); + $table->string('source_method')->nullable(); + $table->integer('weight')->nullable(); + $table->timestamps(); + }); + } } /** diff --git a/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php b/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php index 8fa417b..fbdc1ee 100644 --- a/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php +++ b/database/migrations/2021_02_25_144800_add_value_to_exchange_actions_table.php @@ -10,9 +10,11 @@ class AddValueToExchangeActionsTable extends Migration { * @return void */ public function up() { - Schema::table('exchange_actions', function (Blueprint $table) { - $table->string('value', 255)->nullable()->change(); - }); + if (!Schema::hasColumn('exchange_actions', 'value')) { + Schema::table('exchange_actions', function (Blueprint $table) { + $table->string('value', 255)->nullable()->change(); + }); + } } /** diff --git a/database/migrations/2021_02_25_145053_add_foreign_key_to_clients_table.php b/database/migrations/2021_02_25_145053_add_foreign_key_to_clients_table.php index 04788dc..ebd9bae 100644 --- a/database/migrations/2021_02_25_145053_add_foreign_key_to_clients_table.php +++ b/database/migrations/2021_02_25_145053_add_foreign_key_to_clients_table.php @@ -13,8 +13,8 @@ class AddForeignKeyToClientsTable extends Migration { Schema::table('clients', function (Blueprint $table) { $table->string('user_code')->unique()->change(); - }); + } /** diff --git a/database/migrations/2021_04_20_145715_create_clients_barcodes_table.php b/database/migrations/2021_04_20_145715_create_clients_barcodes_table.php index f3fea6b..021f4d0 100644 --- a/database/migrations/2021_04_20_145715_create_clients_barcodes_table.php +++ b/database/migrations/2021_04_20_145715_create_clients_barcodes_table.php @@ -11,16 +11,18 @@ class CreateClientsBarcodesTable extends Migration { * @return void */ public function up() { - Schema::create('clients_barcodes', function (Blueprint $table) { - $table->id(); - $table->string('client_guid'); - $table->string('code_id'); - $table->string('name'); - $table->string('block'); - $table->string('value'); - $table->string('symptom_block'); - $table->timestamps(); - }); + if (!Schema::hasTable('clients_barcodes')) { + Schema::create('clients_barcodes', function (Blueprint $table) { + $table->id(); + $table->string('client_guid'); + $table->string('code_id'); + $table->string('name'); + $table->string('block'); + $table->string('value'); + $table->string('symptom_block'); + $table->timestamps(); + }); + } } /** diff --git a/database/migrations/2021_08_02_132704_create_orders_table.php b/database/migrations/2021_08_02_132704_create_orders_table.php index 9998129..a7e770c 100644 --- a/database/migrations/2021_08_02_132704_create_orders_table.php +++ b/database/migrations/2021_08_02_132704_create_orders_table.php @@ -11,17 +11,19 @@ class CreateOrdersTable extends Migration { * @return void */ public function up() { - Schema::create('orders', function (Blueprint $table) { - $table->id(); - $table->integer('total_count')->nullable(); - $table->integer('total_price')->nullable(); - $table->integer('staff_id'); - $table->string('client_id')->nullable(); - $table->integer('is_send'); - $table->integer('is_delivery')->nullable(); - $table->integer('is_pickup')->nullable(); - $table->timestamps(); - }); + if (!Schema::hasTable('orders')) { + Schema::create('orders', function (Blueprint $table) { + $table->id(); + $table->integer('total_count')->nullable(); + $table->integer('total_price')->nullable(); + $table->integer('staff_id'); + $table->string('client_id')->nullable(); + $table->integer('is_send'); + $table->integer('is_delivery')->nullable(); + $table->integer('is_pickup')->nullable(); + $table->timestamps(); + }); + } } /** diff --git a/database/migrations/2021_08_02_133250_create_order_items_table.php b/database/migrations/2021_08_02_133250_create_order_items_table.php index febe0f6..2e17ef1 100644 --- a/database/migrations/2021_08_02_133250_create_order_items_table.php +++ b/database/migrations/2021_08_02_133250_create_order_items_table.php @@ -11,17 +11,19 @@ class CreateOrderItemsTable extends Migration { * @return void */ public function up() { - Schema::create('order_items', function (Blueprint $table) { - $table->id(); - $table->integer('order_id'); - $table->integer('item_id'); - $table->integer('modifier_id')->nullable(); - $table->integer('parent_id')->nullable(); - $table->integer('item_count'); - $table->integer('item_price'); - $table->integer('staff_id'); - $table->timestamps(); - }); + if (!Schema::hasTable('order_items')) { + Schema::create('order_items', function (Blueprint $table) { + $table->id(); + $table->integer('order_id'); + $table->integer('item_id'); + $table->integer('modifier_id')->nullable(); + $table->integer('parent_id')->nullable(); + $table->integer('item_count'); + $table->integer('item_price'); + $table->integer('staff_id'); + $table->timestamps(); + }); + } } /** diff --git a/database/migrations/2022_01_10_004227_add_columns_to_shift_online_orders.php b/database/migrations/2022_01_10_004227_add_columns_to_shift_online_orders.php index 6cd3587..695c340 100644 --- a/database/migrations/2022_01_10_004227_add_columns_to_shift_online_orders.php +++ b/database/migrations/2022_01_10_004227_add_columns_to_shift_online_orders.php @@ -12,24 +12,44 @@ class AddColumnsToShiftOnlineOrders extends Migration { */ public function up() { Schema::table('shift_online_orders', function (Blueprint $table) { - $table->integer('is_self')->nullable(); - $table->integer('is_block')->nullable(); - $table->integer('is_edit')->nullable(); - $table->string('guid')->nullable(); + if (!Schema::hasColumn('shift_online_orders', 'is_self')) { + $table->integer('is_self')->nullable(); + } + if (!Schema::hasColumn('shift_online_orders', 'is_block')) { + $table->integer('is_block')->nullable(); + } + if (!Schema::hasColumn('shift_online_orders', 'is_edit')) { + $table->integer('is_edit')->nullable(); + } + if (!Schema::hasColumn('shift_online_orders', 'guid')) { + $table->string('guid')->nullable(); + } }); Schema::table('shift_online_items', function (Blueprint $table) { - $table->decimal('count_real', $precision = 16, $scale = 2)->nullable(); - $table->decimal('count_return', $precision = 16, $scale = 2)->nullable(); - $table->integer('parent_id')->nullable(); + if (!Schema::hasColumn('shift_online_items', 'count_real')) { + $table->decimal('count_real', $precision = 16, $scale = 2)->nullable(); + } + if (!Schema::hasColumn('shift_online_items', 'count_return')) { + $table->decimal('count_return', $precision = 16, $scale = 2)->nullable(); + } + if (!Schema::hasColumn('shift_online_items', 'parent_id')) { + $table->integer('parent_id')->nullable(); + } }); Schema::table('shift_online_actions', function (Blueprint $table) { - $table->integer('terminal_id')->nullable(); + if (!Schema::hasColumn('shift_online_actions', 'terminal_id')) { + $table->integer('terminal_id')->nullable(); + } }); Schema::table('exchange_orders', function (Blueprint $table) { - $table->string('table_place')->nullable(); + if (!Schema::hasColumn('exchange_orders', 'table_place')) { + $table->string('table_place')->nullable(); + } }); Schema::table('exchange_items', function (Blueprint $table) { - $table->integer('modificator_code')->nullable(); + if (!Schema::hasColumn('exchange_items', 'modificator_code')) { + $table->integer('modificator_code')->nullable(); + } }); } diff --git a/database/migrations/2022_01_10_150113_add_columns_to_units_list.php b/database/migrations/2022_01_10_150113_add_columns_to_units_list.php index 3184a5d..65c2a02 100644 --- a/database/migrations/2022_01_10_150113_add_columns_to_units_list.php +++ b/database/migrations/2022_01_10_150113_add_columns_to_units_list.php @@ -11,9 +11,11 @@ class AddColumnsToUnitsList extends Migration { * @return void */ public function up() { - Schema::table('units_list', function (Blueprint $table) { - $table->string('legacy_code')->nullable(); - }); + if (!Schema::hasColumn('units_list', 'legacy_code')) { + Schema::table('units_list', function (Blueprint $table) { + $table->string('legacy_code')->nullable(); + }); + } } /** diff --git a/web/controllers/shifts.js b/web/controllers/shifts.js index 52d62ac..a977636 100644 --- a/web/controllers/shifts.js +++ b/web/controllers/shifts.js @@ -142,7 +142,7 @@ console.log(data.message); setTimeout(function() { location.reload(); - }, 2000); + }, 20000); } if ($scope.status == 'error') { Notification.error(data.message);