From 3be53b599bde442acacb0b004ef8803ade8f69b7 Mon Sep 17 00:00:00 2001 From: adonis Date: Wed, 10 Jun 2026 20:53:18 +0330 Subject: [PATCH] added merge wallet 6 --- database/migrations/.gitkeep | 0 .../2014_10_12_000000_create_users_table.php | 43 - ...12_100000_create_password_resets_table.php | 32 - ..._08_19_000000_create_failed_jobs_table.php | 36 - ...01_create_personal_access_tokens_table.php | 36 - ...23_11_30_071902_create_customers_table.php | 55 - .../2023_12_09_183053_create_const.php | 34 - .../2023_12_09_194437_create_orders_table.php | 46 - .../2023_12_12_183319_create_prices_table.php | 35 - ...2_12_183618_create_price_candles_table.php | 36 - .../2023_12_14_115025_create_logs_table.php | 34 - .../2023_12_14_144824_create_funds_table.php | 35 - ...23_12_24_062013_create_withdraws_table.php | 38 - ...1_19_131402_create_bank_accounts_table.php | 38 - ...01_add_provider_fields_to_orders_table.php | 44 - ...price_offset_percent_to_products_table.php | 34 - ...add_total_referrals_to_customers_table.php | 30 - ..._06_000002_alter_logs_data_to_longtext.php | 17 - ..._order_limit_columns_to_products_table.php | 43 - ...1_add_show_in_assets_to_products_table.php | 42 - ...e_last_price_if_zero_to_products_table.php | 36 - database/schema/mysql-schema.sql | 1009 +++++++++++++++++ database/sql/baseline_migrations.sql | 13 + database/sql/deploy_settings_const.sql | 579 ++++++++++ 24 files changed, 1601 insertions(+), 744 deletions(-) create mode 100644 database/migrations/.gitkeep delete mode 100644 database/migrations/2014_10_12_000000_create_users_table.php delete mode 100644 database/migrations/2014_10_12_100000_create_password_resets_table.php delete mode 100644 database/migrations/2019_08_19_000000_create_failed_jobs_table.php delete mode 100644 database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php delete mode 100644 database/migrations/2023_11_30_071902_create_customers_table.php delete mode 100644 database/migrations/2023_12_09_183053_create_const.php delete mode 100644 database/migrations/2023_12_09_194437_create_orders_table.php delete mode 100644 database/migrations/2023_12_12_183319_create_prices_table.php delete mode 100644 database/migrations/2023_12_12_183618_create_price_candles_table.php delete mode 100644 database/migrations/2023_12_14_115025_create_logs_table.php delete mode 100644 database/migrations/2023_12_14_144824_create_funds_table.php delete mode 100644 database/migrations/2023_12_24_062013_create_withdraws_table.php delete mode 100644 database/migrations/2024_01_19_131402_create_bank_accounts_table.php delete mode 100644 database/migrations/2026_05_25_163201_add_provider_fields_to_orders_table.php delete mode 100644 database/migrations/2026_06_02_000001_add_price_offset_percent_to_products_table.php delete mode 100644 database/migrations/2026_06_06_000001_add_total_referrals_to_customers_table.php delete mode 100644 database/migrations/2026_06_06_000002_alter_logs_data_to_longtext.php delete mode 100644 database/migrations/2026_06_06_000003_add_order_limit_columns_to_products_table.php delete mode 100644 database/migrations/2026_06_09_000001_add_show_in_assets_to_products_table.php delete mode 100644 database/migrations/2026_06_10_000001_add_use_last_price_if_zero_to_products_table.php create mode 100644 database/schema/mysql-schema.sql create mode 100644 database/sql/baseline_migrations.sql create mode 100644 database/sql/deploy_settings_const.sql diff --git a/database/migrations/.gitkeep b/database/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php deleted file mode 100644 index 105bc2d..0000000 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ /dev/null @@ -1,43 +0,0 @@ -id(); - $table->string('fname',100)->nullable(); - $table->string('lname',100)->nullable(); - $table->string('name',200)->nullable(); - $table->boolean('active')->default(true); - $table->string('mobile',20)->nullable(); - $table->integer('avatar_id')->nullable()->unsigned(); - $table->timestamp('last_seen_at')->nullable(); - $table->tinyInteger('sts')->nullable()->unsigned(); - $table->integer('user_type')->nullable()->unsigned(); - $table->string('token_sms',10)->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('users'); - } -} diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php deleted file mode 100644 index 0ee0a36..0000000 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ /dev/null @@ -1,32 +0,0 @@ -string('email')->index(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('password_resets'); - } -} diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php deleted file mode 100644 index 6aa6d74..0000000 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ /dev/null @@ -1,36 +0,0 @@ -id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('failed_jobs'); - } -} diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php deleted file mode 100644 index 4315e16..0000000 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ /dev/null @@ -1,36 +0,0 @@ -id(); - $table->morphs('tokenable'); - $table->string('name'); - $table->string('token', 64)->unique(); - $table->text('abilities')->nullable(); - $table->timestamp('last_used_at')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('personal_access_tokens'); - } -} diff --git a/database/migrations/2023_11_30_071902_create_customers_table.php b/database/migrations/2023_11_30_071902_create_customers_table.php deleted file mode 100644 index e9da3c5..0000000 --- a/database/migrations/2023_11_30_071902_create_customers_table.php +++ /dev/null @@ -1,55 +0,0 @@ -id(); - $table->string('fname',100)->nullable(); - $table->string('lname',100)->nullable(); - $table->string('name',200)->nullable(); - $table->boolean('active')->default(true); - $table->string('mobile',20)->nullable(); - $table->integer('avatar_id')->nullable()->unsigned(); - $table->timestamp('last_seen_at')->nullable(); - $table->integer('default_address_id')->nullable()->unsigned(); - $table->tinyInteger('sts')->nullable()->unsigned(); - $table->tinyInteger('type')->default(1); - $table->integer('total_transaction')->default(0); - $table->string('token_sms',10)->nullable(); - $table->string('password')->nullable(); - $table->integer('orders_count')->default(0); - $table->timestamp('birth_date')->nullable(); - $table->string('shop_name',100)->nullable(); - $table->string('phone_number',20)->nullable(); - $table->string('city',50)->nullable(); - $table->string('province',50)->nullable(); - $table->string('n_code',20)->nullable(); - $table->boolean('is_archive')->default(0); - $table->boolean('trade_active')->default(0); - $table->integer('gram')->default(0); - $table->timestamps(); - $table->softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('customers'); - } -} diff --git a/database/migrations/2023_12_09_183053_create_const.php b/database/migrations/2023_12_09_183053_create_const.php deleted file mode 100644 index 020a743..0000000 --- a/database/migrations/2023_12_09_183053_create_const.php +++ /dev/null @@ -1,34 +0,0 @@ -id(); - $table->string('key',50)->nullable(); - $table->string('title_fa',50)->nullable(); - $table->string('value',100)->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('const'); - } -} diff --git a/database/migrations/2023_12_09_194437_create_orders_table.php b/database/migrations/2023_12_09_194437_create_orders_table.php deleted file mode 100644 index a8460b7..0000000 --- a/database/migrations/2023_12_09_194437_create_orders_table.php +++ /dev/null @@ -1,46 +0,0 @@ -id(); - $table->integer('customer_id')->nullable()->unsigned(); - $table->tinyInteger('sts')->nullable()->unsigned(); - $table->tinyInteger('direction')->nullable()->unsigned(); - $table->tinyInteger('payment_sts')->nullable()->unsigned(); - $table->tinyInteger('type')->default(1); - $table->double('amount',15,6)->nullable()->unsigned(); - $table->integer('total_fee')->nullable()->unsigned(); - $table->integer('price')->nullable()->unsigned(); - $table->integer('price_original')->nullable()->unsigned(); - $table->integer('total_price')->nullable()->unsigned(); - $table->integer('total_price_original')->nullable()->unsigned(); - $table->integer('fee')->nullable()->unsigned(); - $table->integer('payment_remind')->nullable()->unsigned(); - $table->integer('payment_amount')->nullable()->unsigned(); - $table->string('description',1024)->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('orders'); - } -} diff --git a/database/migrations/2023_12_12_183319_create_prices_table.php b/database/migrations/2023_12_12_183319_create_prices_table.php deleted file mode 100644 index f4e932d..0000000 --- a/database/migrations/2023_12_12_183319_create_prices_table.php +++ /dev/null @@ -1,35 +0,0 @@ -id(); - $table->integer('price')->nullable()->unsigned(); - $table->date('date_at')->nullable(); - $table->time('time_at')->nullable(); - $table->integer('user_id')->nullable()->unsigned(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('prices'); - } -} diff --git a/database/migrations/2023_12_12_183618_create_price_candles_table.php b/database/migrations/2023_12_12_183618_create_price_candles_table.php deleted file mode 100644 index 54d334b..0000000 --- a/database/migrations/2023_12_12_183618_create_price_candles_table.php +++ /dev/null @@ -1,36 +0,0 @@ -id(); - $table->integer('start')->nullable()->unsigned(); - $table->integer('end')->nullable()->unsigned(); - $table->integer('high')->nullable()->unsigned(); - $table->integer('low')->nullable()->unsigned(); - $table->date('date_at')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('price_candles'); - } -} diff --git a/database/migrations/2023_12_14_115025_create_logs_table.php b/database/migrations/2023_12_14_115025_create_logs_table.php deleted file mode 100644 index 203ae2f..0000000 --- a/database/migrations/2023_12_14_115025_create_logs_table.php +++ /dev/null @@ -1,34 +0,0 @@ -id(); - $table->integer('user_id')->unsigned()->nullable(); - $table->integer('customer_id')->unsigned()->nullable(); - $table->string('data',1024)->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('logs'); - } -} diff --git a/database/migrations/2023_12_14_144824_create_funds_table.php b/database/migrations/2023_12_14_144824_create_funds_table.php deleted file mode 100644 index 490574c..0000000 --- a/database/migrations/2023_12_14_144824_create_funds_table.php +++ /dev/null @@ -1,35 +0,0 @@ -id(); - $table->string('title',100)->nullable(); - $table->integer('file_id')->nullable()->unsigned(); - $table->integer('customer_id')->nullable()->unsigned(); - $table->timestamps(); - $table->softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('funds'); - } -} diff --git a/database/migrations/2023_12_24_062013_create_withdraws_table.php b/database/migrations/2023_12_24_062013_create_withdraws_table.php deleted file mode 100644 index 52300f4..0000000 --- a/database/migrations/2023_12_24_062013_create_withdraws_table.php +++ /dev/null @@ -1,38 +0,0 @@ -id(); - $table->integer('customer_id')->unsigned()->nullable(); - $table->integer('user_id')->unsigned()->nullable(); - $table->bigInteger('cash')->unsigned()->nullable(); - $table->double('gold')->unsigned()->nullable(); - $table->string('tracked_number',50)->nullable(); - $table->timestamp('date_at')->nullable(); - $table->tinyInteger('sts')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('withdraws'); - } -} diff --git a/database/migrations/2024_01_19_131402_create_bank_accounts_table.php b/database/migrations/2024_01_19_131402_create_bank_accounts_table.php deleted file mode 100644 index 7aee40e..0000000 --- a/database/migrations/2024_01_19_131402_create_bank_accounts_table.php +++ /dev/null @@ -1,38 +0,0 @@ -id(); - $table->integer('customer_id')->nullable()->unsigned(); - $table->string('cart_number')->nullable(); - $table->string('shaba_number')->nullable(); - $table->string('bank_name')->nullable(); - $table->string('account_number')->nullable(); - $table->tinyInteger('sts')->default(1); - $table->timestamps(); - $table->softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('bank_accounts'); - } -} diff --git a/database/migrations/2026_05_25_163201_add_provider_fields_to_orders_table.php b/database/migrations/2026_05_25_163201_add_provider_fields_to_orders_table.php deleted file mode 100644 index b557113..0000000 --- a/database/migrations/2026_05_25_163201_add_provider_fields_to_orders_table.php +++ /dev/null @@ -1,44 +0,0 @@ -unsignedBigInteger('provider_id') - ->nullable() - ->after('id') - ->index(); - }); - } - - if (!Schema::hasColumn('orders', 'total_price_montzar')) { - Schema::table('orders', function (Blueprint $table) { - $table->decimal('total_price_montzar', 20, 4) - ->nullable() - ->after('total_price'); - }); - } - } - - public function down() - { - if (Schema::hasColumn('orders', 'total_price_montzar')) { - Schema::table('orders', function (Blueprint $table) { - $table->dropColumn('total_price_montzar'); - }); - } - - if (Schema::hasColumn('orders', 'provider_id')) { - Schema::table('orders', function (Blueprint $table) { - $table->dropIndex(['provider_id']); - $table->dropColumn('provider_id'); - }); - } - } -} \ No newline at end of file diff --git a/database/migrations/2026_06_02_000001_add_price_offset_percent_to_products_table.php b/database/migrations/2026_06_02_000001_add_price_offset_percent_to_products_table.php deleted file mode 100644 index e142195..0000000 --- a/database/migrations/2026_06_02_000001_add_price_offset_percent_to_products_table.php +++ /dev/null @@ -1,34 +0,0 @@ -decimal('price_offset_percent', 8, 2)->default(0)->after('price_profit'); - } - }); - } - - public function down(): void - { - if (!Schema::hasTable('products')) { - return; - } - - if (Schema::hasColumn('products', 'price_offset_percent')) { - Schema::table('products', function (Blueprint $table) { - $table->dropColumn('price_offset_percent'); - }); - } - } -}; diff --git a/database/migrations/2026_06_06_000001_add_total_referrals_to_customers_table.php b/database/migrations/2026_06_06_000001_add_total_referrals_to_customers_table.php deleted file mode 100644 index bda332b..0000000 --- a/database/migrations/2026_06_06_000001_add_total_referrals_to_customers_table.php +++ /dev/null @@ -1,30 +0,0 @@ -unsignedInteger('total_referrals')->default(0)->after('referral_to_id'); - }); - } - - public function down() - { - if (!Schema::hasColumn('customers', 'total_referrals')) { - return; - } - - Schema::table('customers', function (Blueprint $table) { - $table->dropColumn('total_referrals'); - }); - } -} diff --git a/database/migrations/2026_06_06_000002_alter_logs_data_to_longtext.php b/database/migrations/2026_06_06_000002_alter_logs_data_to_longtext.php deleted file mode 100644 index 6eab641..0000000 --- a/database/migrations/2026_06_06_000002_alter_logs_data_to_longtext.php +++ /dev/null @@ -1,17 +0,0 @@ -boolean('order_limit_enabled')->default(false)->after('percent_fee_buy'); - } - if (!Schema::hasColumn('products', 'min_order_cash')) { - $table->unsignedBigInteger('min_order_cash')->nullable()->after('order_limit_enabled'); - } - if (!Schema::hasColumn('products', 'max_order_cash')) { - $table->unsignedBigInteger('max_order_cash')->nullable()->after('min_order_cash'); - } - }); - } - - public function down(): void - { - if (!Schema::hasTable('products')) { - return; - } - - Schema::table('products', function (Blueprint $table) { - $columns = ['order_limit_enabled', 'min_order_cash', 'max_order_cash']; - foreach ($columns as $column) { - if (Schema::hasColumn('products', $column)) { - $table->dropColumn($column); - } - } - }); - } -}; diff --git a/database/migrations/2026_06_09_000001_add_show_in_assets_to_products_table.php b/database/migrations/2026_06_09_000001_add_show_in_assets_to_products_table.php deleted file mode 100644 index aa9043b..0000000 --- a/database/migrations/2026_06_09_000001_add_show_in_assets_to_products_table.php +++ /dev/null @@ -1,42 +0,0 @@ -boolean('show_in_assets')->default(false)->after('show'); - } else { - $table->boolean('show_in_assets')->default(false); - } - }); - } else { - DB::statement( - 'ALTER TABLE `products` MODIFY COLUMN `show_in_assets` TINYINT(1) NOT NULL DEFAULT 0' - ); - DB::table('products')->update(['show_in_assets' => 0]); - } - } - - public function down(): void - { - if (!Schema::hasTable('products') || !Schema::hasColumn('products', 'show_in_assets')) { - return; - } - - Schema::table('products', function (Blueprint $table) { - $table->dropColumn('show_in_assets'); - }); - } -}; diff --git a/database/migrations/2026_06_10_000001_add_use_last_price_if_zero_to_products_table.php b/database/migrations/2026_06_10_000001_add_use_last_price_if_zero_to_products_table.php deleted file mode 100644 index 0a05480..0000000 --- a/database/migrations/2026_06_10_000001_add_use_last_price_if_zero_to_products_table.php +++ /dev/null @@ -1,36 +0,0 @@ -boolean('use_last_price_if_zero')->default(false)->after('show_in_assets'); - } else { - $table->boolean('use_last_price_if_zero')->default(false); - } - }); - } - } - - public function down(): void - { - if (!Schema::hasTable('products') || !Schema::hasColumn('products', 'use_last_price_if_zero')) { - return; - } - - Schema::table('products', function (Blueprint $table) { - $table->dropColumn('use_last_price_if_zero'); - }); - } -}; diff --git a/database/schema/mysql-schema.sql b/database/schema/mysql-schema.sql new file mode 100644 index 0000000..2932321 --- /dev/null +++ b/database/schema/mysql-schema.sql @@ -0,0 +1,1009 @@ +/* + Navicat Premium Data Transfer + + Source Server : khanegi + Source Server Type : MySQL + Source Server Version : 80045 (8.0.45-0ubuntu0.24.04.1) + Source Host : 91.212.174.137:3030 + Source Schema : groosy + + Target Server Type : MySQL + Target Server Version : 80045 (8.0.45-0ubuntu0.24.04.1) + File Encoding : 65001 + + Date: 10/06/2026 20:16:58 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for addresses +-- ---------------------------- +DROP TABLE IF EXISTS `addresses`; +CREATE TABLE `addresses` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `province` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `address` varchar(2028) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `zip` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `customer_id` int unsigned DEFAULT NULL, + `default_address` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `major_id` int DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for addresses_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `addresses_01/15`; +CREATE TABLE `addresses_01/15` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `province` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `address` varchar(2028) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `zip` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `customer_id` int unsigned DEFAULT NULL, + `default_address` tinyint(1) NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `major_id` int DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for bank_accounts +-- ---------------------------- +DROP TABLE IF EXISTS `bank_accounts`; +CREATE TABLE `bank_accounts` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int unsigned DEFAULT NULL, + `cart_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shaba_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `bank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `account_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `sts` tinyint NOT NULL DEFAULT '1', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for bank_accounts_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `bank_accounts_01/15`; +CREATE TABLE `bank_accounts_01/15` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int unsigned DEFAULT NULL, + `cart_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `shaba_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `bank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `account_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `sts` tinyint NOT NULL DEFAULT '1', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for cities +-- ---------------------------- +DROP TABLE IF EXISTS `cities`; +CREATE TABLE `cities` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `parent_id` int unsigned DEFAULT NULL, + `has_children` tinyint(1) NOT NULL DEFAULT '0', + `level` tinyint DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for const +-- ---------------------------- +DROP TABLE IF EXISTS `const`; +CREATE TABLE `const` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `title_fa` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for const_copy1 +-- ---------------------------- +DROP TABLE IF EXISTS `const_copy1`; +CREATE TABLE `const_copy1` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `title_fa` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `value` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for customers +-- ---------------------------- +DROP TABLE IF EXISTS `customers`; +CREATE TABLE `customers` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `fname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `lname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `active` tinyint(1) NOT NULL DEFAULT '0', + `finger_print` tinyint(1) NOT NULL DEFAULT '0', + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_id` int unsigned DEFAULT NULL, + `last_seen_at` timestamp NULL DEFAULT NULL, + `default_address_id` int unsigned DEFAULT NULL, + `sts` tinyint unsigned DEFAULT NULL, + `type` tinyint NOT NULL DEFAULT '2', + `total_transaction` int NOT NULL DEFAULT '0', + `token_sms` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `orders_count` int NOT NULL DEFAULT '0', + `birth_date` timestamp NULL DEFAULT NULL, + `shop_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `city` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `province` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `n_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_archive` tinyint(1) NOT NULL DEFAULT '0', + `trade_active` tinyint(1) NOT NULL DEFAULT '1', + `gram` int NOT NULL DEFAULT '0', + `is_legal` tinyint NOT NULL DEFAULT '0', + `referral_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `referral_to_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `total_referrals` int unsigned NOT NULL DEFAULT '0', + `profit_count` int NOT NULL DEFAULT '1', + `add_user_limit` int NOT NULL DEFAULT '0', + `profit_amount` float NOT NULL DEFAULT '0.01', + `profit_amount_by_lvl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `order_reward_limit` int DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `credential_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `sum_gold` decimal(10,3) DEFAULT NULL, + `gold` decimal(10,4) DEFAULT NULL, + `moshtari_code` int DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for customers_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `customers_01/15`; +CREATE TABLE `customers_01/15` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `fname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `lname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `active` tinyint(1) NOT NULL DEFAULT '0', + `finger_print` tinyint(1) NOT NULL DEFAULT '0', + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_id` int unsigned DEFAULT NULL, + `last_seen_at` timestamp NULL DEFAULT NULL, + `default_address_id` int unsigned DEFAULT NULL, + `sts` tinyint unsigned DEFAULT NULL, + `type` tinyint NOT NULL DEFAULT '2', + `total_transaction` int NOT NULL DEFAULT '0', + `token_sms` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `orders_count` int NOT NULL DEFAULT '0', + `birth_date` timestamp NULL DEFAULT NULL, + `shop_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `phone_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `city` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `province` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `n_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `is_archive` tinyint(1) NOT NULL DEFAULT '0', + `trade_active` tinyint(1) NOT NULL DEFAULT '1', + `gram` int NOT NULL DEFAULT '0', + `is_legal` tinyint NOT NULL DEFAULT '0', + `referral_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `referral_to_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `profit_count` int NOT NULL DEFAULT '1', + `add_user_limit` int NOT NULL DEFAULT '0', + `profit_amount` float NOT NULL DEFAULT '0.01', + `profit_amount_by_lvl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `order_reward_limit` int DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `credential_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `sum_gold` decimal(10,3) DEFAULT NULL, + `gold` decimal(10,4) DEFAULT NULL, + `moshtari_code` int DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for customers_settings +-- ---------------------------- +DROP TABLE IF EXISTS `customers_settings`; +CREATE TABLE `customers_settings` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `agent_id` int DEFAULT NULL, + `customer_id` int DEFAULT NULL, + `product_id` int DEFAULT NULL, + `group` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `lvl` int DEFAULT NULL, + `profit_buy` int DEFAULT NULL, + `profit_sell` int DEFAULT NULL, + `auto_buy` int DEFAULT NULL, + `auto_sell` int DEFAULT NULL, + `credit_buy` int DEFAULT NULL, + `credit_sell` int DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `is_active` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '1', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +-- ---------------------------- +-- Table structure for failed_jobs +-- ---------------------------- +DROP TABLE IF EXISTS `failed_jobs`; +CREATE TABLE `failed_jobs` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `connection` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `queue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `exception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for files +-- ---------------------------- +DROP TABLE IF EXISTS `files`; +CREATE TABLE `files` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `original_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `ext` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `src` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `size` int unsigned DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, + `document_id` int unsigned DEFAULT NULL, + `type` tinyint unsigned DEFAULT NULL, + `has_thumb` tinyint(1) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +-- ---------------------------- +-- Table structure for funds +-- ---------------------------- +DROP TABLE IF EXISTS `funds`; +CREATE TABLE `funds` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `file_id` int unsigned DEFAULT NULL, + `customer_id` int unsigned DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for giftcard_codes +-- ---------------------------- +DROP TABLE IF EXISTS `giftcard_codes`; +CREATE TABLE `giftcard_codes` ( + `id` int NOT NULL AUTO_INCREMENT, + `giftcard_id` int DEFAULT NULL, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `sts` tinyint DEFAULT NULL, + `unit` tinyint DEFAULT NULL, + `amount` float DEFAULT NULL, + `assigned_to` int DEFAULT NULL, + `used_at` timestamp NULL DEFAULT NULL, + `expiry_date` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for giftcards +-- ---------------------------- +DROP TABLE IF EXISTS `giftcards`; +CREATE TABLE `giftcards` ( + `id` int NOT NULL AUTO_INCREMENT, + `customer_id` int DEFAULT NULL, + `count` int DEFAULT NULL, + `amount` float DEFAULT NULL, + `total` bigint DEFAULT NULL, + `unit` int DEFAULT NULL, + `unique_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `sts` tinyint DEFAULT NULL, + `expiry_date` timestamp NULL DEFAULT NULL, + `used_count` int DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `mobile` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC; + +-- ---------------------------- +-- Table structure for gold_supplier +-- ---------------------------- +DROP TABLE IF EXISTS `gold_supplier`; +CREATE TABLE `gold_supplier` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `fname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `active` tinyint(1) NOT NULL DEFAULT '1', + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_id` int unsigned DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Table structure for logs +-- ---------------------------- +DROP TABLE IF EXISTS `logs`; +CREATE TABLE `logs` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `user_id` int unsigned DEFAULT NULL, + `customer_id` int unsigned DEFAULT NULL, + `data` longtext COLLATE utf8mb4_unicode_ci, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for messages +-- ---------------------------- +DROP TABLE IF EXISTS `messages`; +CREATE TABLE `messages` ( + `id` int NOT NULL AUTO_INCREMENT, + `sms` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `receiver` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + `platforms` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for migrations +-- ---------------------------- +DROP TABLE IF EXISTS `migrations`; +CREATE TABLE `migrations` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `migration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `batch` int NOT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for offer_codes +-- ---------------------------- +DROP TABLE IF EXISTS `offer_codes`; +CREATE TABLE `offer_codes` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `start_at` timestamp NULL DEFAULT NULL, + `end_at` timestamp NULL DEFAULT NULL, + `type` tinyint unsigned DEFAULT NULL, + `discount_percent` int unsigned DEFAULT NULL, + `discount_price` int unsigned DEFAULT NULL, + `is_active` tinyint(1) NOT NULL DEFAULT '0', + `use_only` bigint NOT NULL DEFAULT '1', + `use_count` bigint NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +-- ---------------------------- +-- Table structure for orders +-- ---------------------------- +DROP TABLE IF EXISTS `orders`; +CREATE TABLE `orders` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `provider_id` bigint unsigned DEFAULT NULL, + `price_id` bigint DEFAULT NULL, + `customer_id` bigint unsigned DEFAULT NULL, + `sts` tinyint unsigned DEFAULT NULL, + `direction` tinyint unsigned DEFAULT NULL, + `payment_sts` tinyint unsigned DEFAULT NULL, + `type` tinyint NOT NULL DEFAULT '1', + `amount` double(15,6) unsigned DEFAULT NULL, + `fee` int unsigned DEFAULT NULL, + `price` int unsigned DEFAULT NULL, + `price_original` int unsigned DEFAULT NULL, + `total_fee` int unsigned DEFAULT NULL, + `total_price` bigint unsigned DEFAULT NULL, + `total_price_montzar` decimal(20,4) DEFAULT NULL, + `total_price_liman` int DEFAULT NULL, + `total_price_original` bigint unsigned DEFAULT NULL, + `service_charge_percentage` decimal(5,4) DEFAULT '0.0000', + `service_charge_price` bigint DEFAULT '0', + `service_charge` decimal(20,8) DEFAULT '0.00000000', + `payment_amount` bigint NOT NULL DEFAULT '0', + `payment_remind` int DEFAULT '0', + `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `pay_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + KEY `orders_provider_id_index` (`provider_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for orders_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `orders_01/15`; +CREATE TABLE `orders_01/15` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `price_id` bigint DEFAULT NULL, + `customer_id` bigint unsigned DEFAULT NULL, + `sts` tinyint unsigned DEFAULT NULL, + `direction` tinyint unsigned DEFAULT NULL, + `payment_sts` tinyint unsigned DEFAULT NULL, + `type` tinyint NOT NULL DEFAULT '1', + `amount` double(15,6) unsigned DEFAULT NULL, + `fee` int unsigned DEFAULT NULL, + `price` int unsigned DEFAULT NULL, + `price_original` int unsigned DEFAULT NULL, + `total_fee` int unsigned DEFAULT NULL, + `total_price` bigint unsigned DEFAULT NULL, + `total_price_liman` int DEFAULT NULL, + `total_price_original` bigint unsigned DEFAULT NULL, + `service_charge_percentage` decimal(5,4) DEFAULT '0.0000', + `service_charge_price` bigint DEFAULT '0', + `service_charge` decimal(20,8) DEFAULT '0.00000000', + `payment_amount` bigint NOT NULL DEFAULT '0', + `payment_remind` int DEFAULT '0', + `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `pay_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for orders_copy1 +-- ---------------------------- +DROP TABLE IF EXISTS `orders_copy1`; +CREATE TABLE `orders_copy1` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `price_id` bigint DEFAULT NULL, + `customer_id` bigint unsigned DEFAULT NULL, + `sts` tinyint unsigned DEFAULT NULL, + `direction` tinyint unsigned DEFAULT NULL, + `payment_sts` tinyint unsigned DEFAULT NULL, + `type` tinyint NOT NULL DEFAULT '1', + `amount` double(15,6) unsigned DEFAULT NULL, + `fee` int unsigned DEFAULT NULL, + `price` int unsigned DEFAULT NULL, + `price_original` int unsigned DEFAULT NULL, + `total_fee` int unsigned DEFAULT NULL, + `total_price` bigint unsigned DEFAULT NULL, + `total_price_liman` int DEFAULT NULL, + `total_price_original` bigint unsigned DEFAULT NULL, + `service_charge_percentage` decimal(5,4) DEFAULT '0.0000', + `service_charge_price` bigint DEFAULT '0', + `service_charge` decimal(20,8) DEFAULT '0.00000000', + `payment_amount` bigint NOT NULL DEFAULT '0', + `payment_remind` int DEFAULT '0', + `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `pay_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for paping_transactions +-- ---------------------------- +DROP TABLE IF EXISTS `paping_transactions`; +CREATE TABLE `paping_transactions` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Table structure for password_resets +-- ---------------------------- +DROP TABLE IF EXISTS `password_resets`; +CREATE TABLE `password_resets` ( + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + KEY `password_resets_email_index` (`email`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for personal_access_tokens +-- ---------------------------- +DROP TABLE IF EXISTS `personal_access_tokens`; +CREATE TABLE `personal_access_tokens` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `tokenable_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `tokenable_id` bigint unsigned NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `token` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `abilities` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `last_used_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `personal_access_tokens_token_unique` (`token`) USING BTREE, + KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for price_candles +-- ---------------------------- +DROP TABLE IF EXISTS `price_candles`; +CREATE TABLE `price_candles` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `start` int unsigned DEFAULT NULL, + `end` int unsigned DEFAULT NULL, + `high` int unsigned DEFAULT NULL, + `low` int unsigned DEFAULT NULL, + `date_at` date DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for price_triggers +-- ---------------------------- +DROP TABLE IF EXISTS `price_triggers`; +CREATE TABLE `price_triggers` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `customer_id` bigint unsigned NOT NULL, + `target_price` bigint NOT NULL, + `price_condition` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, + `action` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, + `direction` tinyint(1) DEFAULT NULL, + `is_active` tinyint(1) DEFAULT '1', + `triggered_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Table structure for prices +-- ---------------------------- +DROP TABLE IF EXISTS `prices`; +CREATE TABLE `prices` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `price` int unsigned DEFAULT NULL, + `date_at` date DEFAULT NULL, + `time_at` time DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for products +-- ---------------------------- +DROP TABLE IF EXISTS `products`; +CREATE TABLE `products` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `amount` float NOT NULL DEFAULT '1', + `metal_id` int DEFAULT NULL, + `group_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `file_id` bigint unsigned DEFAULT NULL, + `price` bigint DEFAULT '0', + `price_profit` int DEFAULT NULL, + `price_offset_percent` decimal(8,2) NOT NULL DEFAULT '0.00', + `active` tinyint(1) NOT NULL DEFAULT '1', + `show` tinyint(1) DEFAULT '1', + `show_in_assets` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'نمایش در صفحه دارایی‌ها', + `use_last_price_if_zero` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'استفاده از آخرین قیمت وقتی provider صفر است', + `open_sell` tinyint(1) NOT NULL DEFAULT '1', + `open_buy` tinyint(1) NOT NULL DEFAULT '1', + `auto_open_at` time DEFAULT NULL, + `auto_close_at` time DEFAULT NULL, + `percent_fee_buy` float DEFAULT NULL, + `order_limit_enabled` tinyint(1) NOT NULL DEFAULT '0', + `min_order_cash` bigint unsigned DEFAULT NULL, + `max_order_cash` bigint unsigned DEFAULT NULL, + `percent_fee_sell` float DEFAULT NULL, + `cash_fee_buy` int DEFAULT NULL, + `cash_fee_sell` int DEFAULT NULL, + `reading_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `bubble` tinyint NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Table structure for products_copy1 +-- ---------------------------- +DROP TABLE IF EXISTS `products_copy1`; +CREATE TABLE `products_copy1` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `amount` float NOT NULL DEFAULT '1', + `metal_id` int DEFAULT NULL, + `group_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `file_id` bigint unsigned DEFAULT NULL, + `price` bigint DEFAULT '0', + `price_profit` int DEFAULT NULL, + `active` tinyint(1) NOT NULL DEFAULT '1', + `show` tinyint(1) DEFAULT '1', + `open_sell` tinyint(1) NOT NULL DEFAULT '1', + `open_buy` tinyint(1) NOT NULL DEFAULT '1', + `auto_open_at` time DEFAULT NULL, + `auto_close_at` time DEFAULT NULL, + `percent_fee_buy` float DEFAULT NULL, + `percent_fee_sell` float DEFAULT NULL, + `cash_fee_buy` int DEFAULT NULL, + `cash_fee_sell` int DEFAULT NULL, + `reading_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `bubble` tinyint NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Table structure for settings +-- ---------------------------- +DROP TABLE IF EXISTS `settings`; +CREATE TABLE `settings` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title_fa` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `can_edit` tinyint DEFAULT '0', + `is_exist` tinyint(1) NOT NULL DEFAULT '0', + `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `is_active` tinyint DEFAULT NULL, + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Table structure for settings_copy1 +-- ---------------------------- +DROP TABLE IF EXISTS `settings_copy1`; +CREATE TABLE `settings_copy1` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title_fa` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `can_edit` tinyint DEFAULT '0', + `is_exist` tinyint(1) NOT NULL DEFAULT '0', + `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `description` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `is_active` tinyint DEFAULT NULL, + `type` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Table structure for tahesab +-- ---------------------------- +DROP TABLE IF EXISTS `tahesab`; +CREATE TABLE `tahesab` ( + `id` int NOT NULL AUTO_INCREMENT, + `customer_id` int DEFAULT NULL, + `amount` float DEFAULT NULL, + `desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `order_id` int DEFAULT NULL, + `date` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `sh_factor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `tahesab_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `tah_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `factor_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `res` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, + `data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Table structure for tahesab_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `tahesab_01/15`; +CREATE TABLE `tahesab_01/15` ( + `id` int NOT NULL AUTO_INCREMENT, + `customer_id` int DEFAULT NULL, + `amount` float DEFAULT NULL, + `desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `order_id` int DEFAULT NULL, + `date` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `sh_factor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `tahesab_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + `tah_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `factor_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `res` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, + `data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci, + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Table structure for transaction_metas +-- ---------------------------- +DROP TABLE IF EXISTS `transaction_metas`; +CREATE TABLE `transaction_metas` ( + `transaction` bigint unsigned NOT NULL, + `order_id` bigint unsigned DEFAULT NULL, + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for transaction_metas_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `transaction_metas_01/15`; +CREATE TABLE `transaction_metas_01/15` ( + `transaction` bigint unsigned NOT NULL, + `order_id` bigint unsigned DEFAULT NULL, + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for transactions +-- ---------------------------- +DROP TABLE IF EXISTS `transactions`; +CREATE TABLE `transactions` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `wallet` bigint unsigned DEFAULT NULL, + `transaction_type` enum('1','2','3') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `cash` bigint DEFAULT NULL, + `expire_at` datetime DEFAULT NULL, + `hash` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `customer_id` bigint unsigned DEFAULT NULL, + `order_id` int DEFAULT NULL, + `type` int NOT NULL, + `product_id` int DEFAULT NULL, + `fund_id` int DEFAULT NULL, + `start_at` timestamp NULL DEFAULT NULL, + `end_at` timestamp NULL DEFAULT NULL, + `gold` float DEFAULT '0', + `balance_cash` bigint DEFAULT NULL, + `balance_gold` int DEFAULT NULL, + `withdraw_id` int unsigned DEFAULT NULL, + `active` tinyint(1) DEFAULT NULL, + `number` int DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for transactions_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `transactions_01/15`; +CREATE TABLE `transactions_01/15` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `wallet` bigint unsigned DEFAULT NULL, + `transaction_type` enum('1','2','3') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '1', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `cash` bigint DEFAULT NULL, + `expire_at` datetime DEFAULT NULL, + `hash` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `customer_id` bigint unsigned DEFAULT NULL, + `order_id` int DEFAULT NULL, + `type` int NOT NULL, + `product_id` int DEFAULT NULL, + `fund_id` int DEFAULT NULL, + `start_at` timestamp NULL DEFAULT NULL, + `end_at` timestamp NULL DEFAULT NULL, + `gold` float DEFAULT '0', + `balance_cash` bigint DEFAULT NULL, + `balance_gold` int DEFAULT NULL, + `withdraw_id` int unsigned DEFAULT NULL, + `active` tinyint(1) DEFAULT NULL, + `number` int DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for transactions_admins +-- ---------------------------- +DROP TABLE IF EXISTS `transactions_admins`; +CREATE TABLE `transactions_admins` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `customer_id` bigint unsigned DEFAULT NULL, + `order_id` int DEFAULT NULL, + `customer_to_id` bigint unsigned DEFAULT NULL, + `user_id` bigint unsigned DEFAULT NULL, + `wallet` bigint unsigned DEFAULT NULL, + `transaction_id` bigint unsigned DEFAULT NULL, + `cash` bigint DEFAULT NULL, + `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `type` int NOT NULL, + `gold` float DEFAULT '0', + `balance_cash` bigint DEFAULT NULL, + `balance_gold` int DEFAULT NULL, + `withdraw_id` int unsigned DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for users +-- ---------------------------- +DROP TABLE IF EXISTS `users`; +CREATE TABLE `users` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `fname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `lname` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `active` tinyint(1) NOT NULL DEFAULT '1', + `telegram` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `send_sms` tinyint DEFAULT '1', + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `avatar_id` int unsigned DEFAULT NULL, + `last_seen_at` timestamp NULL DEFAULT NULL, + `sts` tinyint unsigned DEFAULT NULL, + `user_type` int unsigned DEFAULT NULL, + `token_sms` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `remember_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `deleted_at` timestamp NULL DEFAULT NULL, + `gold` int DEFAULT NULL, + `bale` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for wallets +-- ---------------------------- +DROP TABLE IF EXISTS `wallets`; +CREATE TABLE `wallets` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `owner_type` tinyint NOT NULL DEFAULT '1', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `owner` bigint NOT NULL, + `cash` bigint NOT NULL, + `hash` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `gold` float NOT NULL, + `fund_id` int DEFAULT NULL, + `product_id` int DEFAULT NULL, + `number` int NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for wallets_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `wallets_01/15`; +CREATE TABLE `wallets_01/15` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `owner_type` tinyint NOT NULL DEFAULT '1', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `owner` bigint NOT NULL, + `cash` bigint NOT NULL, + `hash` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `gold` float NOT NULL, + `fund_id` int DEFAULT NULL, + `product_id` int DEFAULT NULL, + `number` int NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for withdraws +-- ---------------------------- +DROP TABLE IF EXISTS `withdraws`; +CREATE TABLE `withdraws` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int unsigned DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, + `cash` bigint DEFAULT NULL, + `gold` double DEFAULT NULL, + `note` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tracked_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `zify_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `date_at` timestamp NULL DEFAULT NULL, + `sts` tinyint DEFAULT NULL, + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `bank_account_id` bigint DEFAULT NULL, + `address_id` bigint DEFAULT NULL, + `priority` tinyint NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Table structure for withdraws_01/15 +-- ---------------------------- +DROP TABLE IF EXISTS `withdraws_01/15`; +CREATE TABLE `withdraws_01/15` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int unsigned DEFAULT NULL, + `user_id` int unsigned DEFAULT NULL, + `cash` bigint DEFAULT NULL, + `gold` double DEFAULT NULL, + `note` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `tracked_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `zify_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `date_at` timestamp NULL DEFAULT NULL, + `sts` tinyint DEFAULT NULL, + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `bank_account_id` bigint DEFAULT NULL, + `address_id` bigint DEFAULT NULL, + `priority` tinyint NOT NULL DEFAULT '0', + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/database/sql/baseline_migrations.sql b/database/sql/baseline_migrations.sql new file mode 100644 index 0000000..670fc1c --- /dev/null +++ b/database/sql/baseline_migrations.sql @@ -0,0 +1,13 @@ +-- ============================================================================= +-- baseline migrations — برای دیتابیس‌هایی که schema از قبل دارند (مثل groosy) +-- ============================================================================= +-- بعد از import یا روی DB موجود اجرا کنید تا Laravel schema dump را دوباره +-- load نکند و فقط migrationهای جدید با php artisan migrate اجرا شوند. +-- +-- USE `نام_دیتابیس`; +-- ============================================================================= + +TRUNCATE TABLE `migrations`; + +INSERT INTO `migrations` (`migration`, `batch`) VALUES +('0000_00_00_000000_baseline_schema', 1); diff --git a/database/sql/deploy_settings_const.sql b/database/sql/deploy_settings_const.sql new file mode 100644 index 0000000..98e1d62 --- /dev/null +++ b/database/sql/deploy_settings_const.sql @@ -0,0 +1,579 @@ +-- ============================================================================= +-- deploy_settings_const.sql — آپدیت settings + const (بدون تغییر schema) +-- +-- workflow deploy: +-- 1) php artisan migrate +-- 2) mysql -u USER -p DATABASE < database/sql/deploy_settings_const.sql +-- +-- اصول: +-- • چند بار قابل اجرا (idempotent) +-- • value کلیدهای موجود دست نخورده (فقط INSERT اگر key نبود) +-- • title_fa / type / description / can_edit به‌روز می‌شود +-- • schema (جدول/ستون) فقط با migrate — نه این فایل +-- +-- قبل از اجرا: USE `نام_دیتابیس`; + بکاپ +-- ============================================================================= + +START TRANSACTION; + +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- --------------------------------------------------------------------------- +-- charset — نمایش فارسی در پنل ادمین +-- --------------------------------------------------------------------------- +ALTER TABLE `settings` + MODIFY COLUMN `description` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL, + MODIFY COLUMN `title_fa` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL, + MODIFY COLUMN `type` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL; + +ALTER TABLE `const` + MODIFY COLUMN `title_fa` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL; + +-- --------------------------------------------------------------------------- +-- اصلاح باگ‌ها / rename کلیدهای قدیمی +-- --------------------------------------------------------------------------- +UPDATE `settings` SET `key` = 'logo_login', `value` = 'logo_login' WHERE `key` LIKE 'logo_login%'; + +DELETE s1 FROM `settings` s1 +INNER JOIN `settings` s2 ON s1.`key` = s2.`key` AND s1.`id` < s2.`id` +WHERE s1.`key` = 'montzar_closed'; + +UPDATE `settings` SET `key` = 'support_messenger_id' WHERE `key` = 'bale_support_id'; +UPDATE `settings` SET `key` = 'support_messenger_text' WHERE `key` = 'bale_support_text'; + +UPDATE `settings` AS r +SET r.`value` = 'required', r.`is_active` = 1, r.`updated_at` = NOW() +WHERE r.`key` = 'referral_id' + AND EXISTS ( + SELECT 1 FROM ( + SELECT `value`, `is_active` FROM `settings` + WHERE `key` = 'is_requaire_referral' LIMIT 1 + ) AS leg + WHERE leg.`is_active` = 1 + AND LOWER(TRIM(COALESCE(leg.`value`, ''))) IN ('true', '1', 'yes') + ) + AND TRIM(COALESCE(r.`value`, '')) <> 'required'; + + +-- SETTINGS — کلیدهای جدید (مقادیر پیش‌فرض گلد علی / zaarbox) +-- ============================================================================= + +-- قیمت zaarbox (اگر از قبل دارید value دست نخورده) +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'chart_id', '', 'UUID نمودار Zaarbox', 1, 1, 'خالی = ca3800a0-1f57-3528-b963-178f9168e04f' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'chart_id' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'etehadie_api_url', 'https://price.zaarbox.ir/api/free', 'آدرس API اتحادیه (پشتیبان)', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'etehadie_api_url' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'show_last_price', 'true', 'نمایش آخرین قیمت DB اگر API قطع شد', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'show_last_price' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'main_product_price', 'false', 'قیمت از محصول (legacy)', 1, 1, 'از price_provider استفاده کنید' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'main_product_price' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'tabanGohar_price', 'false', 'قیمت تابان گوهر', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'tabanGohar_price' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_price', 'false', 'قیمت از همکار (montzar)', 1, 1, 'معمولاً false وقتی price_provider=zaarbox' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_price' LIMIT 1); + +-- Montzar — برای تعویض provider یا پر شدن خودکار توسط cron +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_mobile', '', 'موبایل API همکار', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_mobile' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_password', '', 'رمز API همکار', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_password' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_product_id', '25', 'کد محصول همکار', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_product_id' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_base_url', 'https://limangold.ir', 'آدرس سرور همکار', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_base_url' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_token', '', 'توکن همکار (خودکار)', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_token' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_open_buy', 'true', 'باز بودن خرید همکار', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_open_buy' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_open_sell', 'true', 'باز بودن فروش همکار', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_open_sell' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_diff', '0', 'اختلاف قیمت همکار', 0, 1, 'سیستم پر می‌کند' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_diff' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_live_price', '0', 'قیمت لحظه‌ای همکار', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_live_price' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_mazaneh', '0', 'مظنه همکار', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_mazaneh' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_truly_buy_mazaneh', '0', 'مظنه خرید همکار', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_truly_buy_mazaneh' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'montzar_truly_sell_mazaneh', '0', 'مظنه فروش همکار', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'montzar_truly_sell_mazaneh' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'display_montzar', 'false', 'نمایش بلوک همکار در UI', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'display_montzar' LIMIT 1); + +-- API خارجی Node (HMAC) — معادل NODE_CLIENT_ID / NODE_SHARED_SECRET در .env +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'node_client_id', '', 'شناسه کلاینت API خارجی (X-Client-Id)', 1, 1, 'مقدار قبلی .env: NODE_CLIENT_ID' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'node_client_id' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'node_shared_secret', '', 'کلید امضای HMAC API خارجی', 1, 1, 'مقدار قبلی .env: NODE_SHARED_SECRET' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'node_shared_secret' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'external_order_api_enabled', 'true', 'فعال‌سازی API سفارش خارجی (get_wallet / order)', 1, 1, 'true + node_client_id + node_shared_secret' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'external_order_api_enabled' LIMIT 1); + +-- Jibit +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'jibit_verification', 'true', 'تأیید کارت بانکی با جیبیت', 1, 1, 'true/false — BankAccountController' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'jibit_verification' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'register_jibit_verify', 'true', 'تأیید کدملی/موبایل در ثبت‌نام', 1, 1, 'AuthController' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'register_jibit_verify' LIMIT 1); + +-- ساعات معامله +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'close_price', 'false', 'بستن قیمت در بازه زمانی', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'close_price' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'startDay', '09:00', 'شروع بازه معامله', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'startDay' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'endDay', '22:00', 'پایان بازه معامله', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'endDay' LIMIT 1); + +-- ثبت‌نام / معرف +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'auto_active_customer', 'false', 'فعال‌سازی خودکار کاربر', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'auto_active_customer' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'fee_free', '0', 'تعداد سفارش اول بدون کارمزد', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'fee_free' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'charge_notif', 'false', 'پیامک شارژ ادمین', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'charge_notif' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'gift_for_referrer', '0.005', 'پاداش معرف', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'gift_for_referrer' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'gift_for_referral', '0', 'پاداش معرف‌شونده', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'gift_for_referral' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'register_referral_sms_to_referrer', 'false', 'SMS به معرف هنگام ثبت‌نام', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'register_referral_sms_to_referrer' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'register_referral_bonus_message', 'false', 'پیام پاداش در SMS ثبت‌نام', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'register_referral_bonus_message' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'referral_limit', '', 'محدودیت دعوت', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'referral_limit' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'group_sms', 'false', 'پیامک گروهی', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'group_sms' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'tahesab_token', '', 'توکن ته‌حساب', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'tahesab_token' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'tahesab_db', '', 'دیتابیس ته‌حساب', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'tahesab_db' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'tahesab_bank_account', '', 'حساب بانکی ته‌حساب', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'tahesab_bank_account' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'telegram_bot_token', '', 'توکن بات تلگرام', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'telegram_bot_token' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'bale_bot_token', '', 'توکن بات بله', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'bale_bot_token' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'support_messenger_id', '', 'شناسه پشتیبانی پیام‌رسان', 1, 0, 'بله: یوزرنیم ble.ir | تلگرام: یوزرنیم | واتساپ: شماره با کد کشور | روبیکا/ایتا/سروش: یوزرنیم' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'support_messenger_id' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'support_messenger_text', '', 'متن پشتیبانی پیام‌رسان', 1, 0, 'متن دکمه یا توضیح پشتیبانی در اپ کاربر' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'support_messenger_text' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'support_messenger', 'bale', 'پیام‌رسان پشتیبانی', 1, 1, 'bale,telegram,whatsapp,rubika,eitaa,soroush' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'support_messenger' LIMIT 1); + +-- min/max قیمت روز (سیستم) +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'up_price', '0', 'بیشترین قیمت امروز', 0, 1, 'ReportController' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'up_price' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'down_price', '0', 'کمترین قیمت امروز', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'down_price' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'price_extreme_date', '', 'تاریخ min/max روز', 0, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'price_extreme_date' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'product_update_price_on_list', 'true', 'بروز قیمت در لیست محصول', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'product_update_price_on_list' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'product_auto_close_open_on_list', 'true', 'باز/بسته خودکار محصول', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'product_auto_close_open_on_list' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'metal_type', 'طلای آبشده', 'عنوان فلز در UI', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'metal_type' LIMIT 1); + +-- درگاه — کلیدهای اختیاری payping +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'payping_fin_sync_enabled', 'false', 'همگام‌سازی fin لیمان', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_fin_sync_enabled' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'payping_fin_url', 'https://limangold.ir/kernel/admin/fin', 'URL fin', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_fin_url' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'payping_fin_token', '', 'توکن fin', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_fin_token' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'payping_fin_customer_id', '23', 'customer_id fin', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_fin_customer_id' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'payping_gateway_item', 'gp1Q', 'item تکی (legacy)', 1, 1, NULL +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'payping_gateway_item' LIMIT 1); + +-- ============================================================================= +-- عنوان فارسی + can_edit (value دست نخورده) +-- ============================================================================= + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'منبع قیمت'), `can_edit` = 1, + `description` = 'zaarbox | main_product | montzar | etehadie | taban_gohar' +WHERE `key` = 'price_provider'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'محصول / UUID تابلو'), `can_edit` = 1 +WHERE `key` = 'main_product'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'آدرس API Zaarbox'), `can_edit` = 1 +WHERE `key` = 'zaarbox_api_url'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'شناسه ردیف Zaarbox'), `can_edit` = 1, + `value` = TRIM(REPLACE(REPLACE(`value`, CHAR(10), ''), CHAR(13), '')) +WHERE `key` = 'zaarbox_price_key'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'اختلاف پایه نمایش'), `can_edit` = 1 +WHERE `key` = 'fee_single'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'سود خرید نمایش'), `can_edit` = 1 +WHERE `key` = 'buy_fee'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'سود فروش نمایش'), `can_edit` = 1 +WHERE `key` = 'sell_fee'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'کارمزد ریالی سفارش (legacy)'), `can_edit` = 1 +WHERE `key` = 'fee_cash'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'درصد کارمزد سفارش'), `can_edit` = 1 +WHERE `key` = 'fee_service_charge_percentage'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'تأیید کارت جیبیت'), `can_edit` = 1 +WHERE `key` = 'jibit_verification'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'تأیید ثبت‌نام جیبیت'), `can_edit` = 1 +WHERE `key` = 'register_jibit_verify'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'شناسه کلاینت API خارجی'), `can_edit` = 1 +WHERE `key` = 'node_client_id'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'کلید HMAC API خارجی'), `can_edit` = 1 +WHERE `key` = 'node_shared_secret'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'API سفارش خارجی'), `can_edit` = 1 +WHERE `key` = 'external_order_api_enabled'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'بسته بودن همکار'), `can_edit` = 1 +WHERE `key` = 'montzar_closed'; + +UPDATE `settings` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'نام Montify'), `can_edit` = 1, + `description` = 'RequestsController — اختیاری' +WHERE `key` = 'montify_name'; + +-- ============================================================================= +-- CONST — کلیدهای مورد استفاده کد +-- ============================================================================= + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'jibit_counter', '0', 'شمارنده API جیبیت' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'jibit_counter' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'app_closed', 'false', 'بسته بودن اپ (ساعات)' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'app_closed' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'gram', '1', 'گرم هدیه ثبت‌نام' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'gram' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'first_customer_wallet_value', '0', 'حداقل اولین خرید (const)' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'first_customer_wallet_value' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'price', '[]', 'لیست قیمت TGJU (JSON)' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'price' LIMIT 1); + +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'شمارنده جیبیت') +WHERE `key` = 'jibit_counter'; + +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'سقف واریز اولیه') +WHERE `key` = 'limited_price'; + +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'باز بودن درگاه') +WHERE `key` = 'is_gateway_open'; + +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'محصول آبشده (fallback)') +WHERE `key` = 'main_product'; + +-- ============================================================================= +-- نوع فیلد پنل ادمین (type) — value دست نخورده +-- ============================================================================= + +-- longtext +UPDATE `settings` SET `type` = 'longtext' WHERE `key` IN ('text_rule', 'text_about'); + +-- select (+ گزینه‌ها در description) +UPDATE `settings` SET `type` = 'select', `description` = 'montzar,zaarbox,main_product,etehadie,taban_gohar' WHERE `key` = 'price_provider'; +UPDATE `settings` SET `type` = 'select', `description` = 'required = اجباری؛ خالی = اختیاری|required,', `can_edit` = 1 WHERE `key` = 'referral_id'; +UPDATE `settings` SET `type` = 'select', `description` = 'sepal,' WHERE `key` = 'payping_gateway_name'; +UPDATE `settings` SET `type` = 'select', `description` = 'bale,telegram,whatsapp,rubika,eitaa,soroush' WHERE `key` = 'support_messenger'; + +-- switch +UPDATE `settings` SET `type` = 'switch' WHERE `key` IN ( + 'jibit_verification', 'register_jibit_verify', 'open_register', 'auto_active_customer', + 'close_price', 'montzar_price', 'main_product_price', 'tabanGohar_price', 'show_last_price', + 'send_to_tahesab', 'profit_gold_api_enabled', 'payping_round_toman', 'payping_strict_failed_withdraw', + 'has_page_earn_money', 'has_page_fund', 'has_page_permission', 'has_page_price_trigger', + 'has_page_physical_gold', 'has_chat', 'charge_notif', 'group_sms', 'display_montzar', + 'montzar_closed', 'montzar_open_buy', 'montzar_open_sell', + 'product_update_price_on_list', 'product_auto_close_open_on_list', 'payping_fin_sync_enabled', + 'fee_free', 'external_order_api_enabled' +); + +-- number +UPDATE `settings` SET `type` = 'number' WHERE `key` IN ( + 'fee_single', 'buy_fee', 'sell_fee', 'fee_cash', 'fee_service_charge_percentage', + 'min_withdraw', 'min_first_buy', 'minimum_sell', 'referral_count_for_gift', + 'montzar_product_id', 'balance_report_exclude_customer_id', 'gift_for_referrer', + 'gift_for_referral', 'up_price', 'down_price', 'payping_fin_customer_id' +); + +-- text (بقیه — URL، توکن، کلید API، ساعت، ...) +UPDATE `settings` SET `type` = 'text' WHERE `key` IN ( + 'name_fa', 'name_en', 'app_url', 'bace_url', 'logo_register', 'admin_url', 'title_pwa', 'title_fav', + 'server_url', 'key', 'main_product', 'zaarbox_api_url', 'zaarbox_price_key', 'chart_id', + 'etehadie_api_url', 'montzar_mobile', 'montzar_password', 'montzar_base_url', + 'montzar_token', 'montzar_diff', 'montzar_live_price', 'montzar_mazaneh', + 'montzar_truly_buy_mazaneh', 'montzar_truly_sell_mazaneh', 'startDay', 'endDay', + 'payping_start_url', 'payping_verify_url', 'payping_gateway_items', 'payping_fin_url', + 'payping_fin_token', 'payping_gateway_item', 'tahesab_token', 'tahesab_db', + 'node_client_id', 'node_shared_secret', + 'tahesab_bank_account', 'telegram_bot_token', 'bale_bot_token', 'support_messenger_id', 'support_messenger_text', 'referral_limit', + 'referral_bonus_amount', 'metal_type', 'montify_name', 'price_extreme_date', + 'liman_token' +); + +-- پیش‌فرض برای ردیف‌های بدون type +UPDATE `settings` SET `type` = 'text' WHERE `type` IS NULL OR TRIM(`type`) = ''; + +-- ============================================================================= + + +-- --------------------------------------------------------------------------- +-- کلیدهای modular اضافی (INSERT اگر نبود) +-- --------------------------------------------------------------------------- +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`, `description`) +SELECT 'price_provider', 'منبع قیمت', 'montzar', 1, 0, 1, 'select', 'منبع فعال قیمت|montzar,zaarbox,main_product,taban_gohar,etehadie' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'price_provider' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'service_charge_percentage', 'کارمزد درصدی (alias)', COALESCE( + (SELECT `value` FROM `settings` WHERE `key` = 'fee_service_charge_percentage' LIMIT 1), '0.005' +), 0, 0, 1, 'number' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'service_charge_percentage' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'title_pwa', 'عنوان PWA', '', 1, 0, 1, 'text' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'title_pwa' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'title_fav', 'عنوان favicon', '', 1, 0, 1, 'text' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'title_fav' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'text_rule', 'متن قوانین', '', 1, 0, 1, 'longtext' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'text_rule' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'text_about', 'متن درباره ما', '', 1, 0, 1, 'longtext' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'text_about' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'zaarbox_api_url', 'آدرس API تابلو Zaarbox', '', 1, 0, 1, 'text' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'zaarbox_api_url' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'zaarbox_price_key', 'شناسه ردیف تابلو (key یا UUID)', '', 1, 0, 1, 'text' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'zaarbox_price_key' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'main_product', 'محصول آبشده', '', 1, 0, 1, 'text' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'main_product' LIMIT 1); + +INSERT INTO `settings` (`key`, `title_fa`, `value`, `can_edit`, `is_exist`, `is_active`, `type`) +SELECT 'profit_gold_api_enabled', 'API سود طلا', 'false', 1, 0, 0, 'switch' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'profit_gold_api_enabled' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`, `type`) +SELECT 'unit', '', 'واحد وزن دارایی و معاملات', 1, 1, + 'واحد نمایش وزن فلز در دارایی‌ها، کیف پول و تراکنش‌ها|گرم,کیلوگرم', 'select' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'unit' LIMIT 1); + +INSERT INTO `settings` (`key`, `value`, `title_fa`, `can_edit`, `is_active`, `description`) +SELECT 'main_wallet_products', '', 'محصولات متصل به کیف اصلی', 0, 1, + 'idهای محصول با کاما (مثل 13,25). موجودی = gold کیف اصلی. خالی = غیرفعال' +WHERE NOT EXISTS (SELECT 1 FROM `settings` WHERE `key` = 'main_wallet_products' LIMIT 1); + +UPDATE `settings` SET `can_edit` = 0 WHERE `key` = 'main_wallet_products'; + +-- --------------------------------------------------------------------------- +-- const — کلیدهای اضافی +-- --------------------------------------------------------------------------- +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'limited_price', '', 'سقف واریز اولیه' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'limited_price' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'is_gateway_open', 'true', 'باز بودن درگاه پرداخت' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'is_gateway_open' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'header_banner', '', 'بنر بالای صفحه' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'header_banner' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'last_order_log', '', 'لاگ آخرین سفارش همکار' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'last_order_log' LIMIT 1); + +INSERT INTO `const` (`key`, `value`, `title_fa`) +SELECT 'liman', '', 'توکن لیمان (legacy)' +WHERE NOT EXISTS (SELECT 1 FROM `const` WHERE `key` = 'liman' LIMIT 1); + +-- --------------------------------------------------------------------------- +-- پاکسازی کلیدهای legacy / تست +-- --------------------------------------------------------------------------- +DELETE FROM `settings` WHERE `key` IN ( + 'test', 'test2', 'test22', 'test3', 'test33', 'longtest', 'longtest2', + 'is_requaire_referral', 'send_to_goldir', 'goldir_price', 'liman_token', + 'melted_product_id', 'display_montzar' +); + +DELETE FROM `const` WHERE `key` = 'log' OR `key` LIKE 'goldir%'; + +-- --------------------------------------------------------------------------- +-- metadata — description و type +-- --------------------------------------------------------------------------- +UPDATE `settings` SET `description` = NULL +WHERE LOWER(TRIM(COALESCE(`description`, ''))) IN ('true', 'false', '0', '1', 'yes', 'no', 'in server') + OR TRIM(COALESCE(`description`, '')) LIKE 'count of%'; + +UPDATE `settings` SET `description` = 'منبع فعال قیمت|montzar,zaarbox,main_product,taban_gohar,etehadie' +WHERE `key` = 'price_provider'; + +UPDATE `settings` SET `description` = 'required = اجباری|required,', `title_fa` = 'کد معرف', `type` = 'select' +WHERE `key` = 'referral_id'; + +UPDATE `settings` SET `description` = 'جایگزین: price_provider=main_product' WHERE `key` = 'main_product_price'; +UPDATE `settings` SET `description` = 'true یا price_provider=montzar' WHERE `key` = 'montzar_price'; +UPDATE `settings` SET `description` = 'تعداد سفارش اول بدون کارمزد' WHERE `key` = 'fee_free'; +UPDATE `settings` SET `description` = 'id یا reading_method محصول آبشده' WHERE `key` = 'main_product'; + +UPDATE `settings` SET + `title_fa` = 'شناسه پشتیبانی پیام‌رسان', + `can_edit` = 1, + `type` = 'text', + `description` = 'بله: یوزرنیم ble.ir | تلگرام: یوزرنیم | واتساپ: شماره با کد کشور | روبیکا/ایتا/سروش: یوزرنیم' +WHERE `key` = 'support_messenger_id'; + +UPDATE `settings` SET + `title_fa` = 'متن پشتیبانی پیام‌رسان', + `can_edit` = 1, + `type` = 'text', + `description` = 'متن دکمه یا توضیح پشتیبانی در اپ کاربر' +WHERE `key` = 'support_messenger_text'; + +UPDATE `settings` SET + `title_fa` = 'پیام‌رسان پشتیبانی', + `can_edit` = 1, + `type` = 'select', + `description` = 'bale,telegram,whatsapp,rubika,eitaa,soroush', + `value` = COALESCE(NULLIF(TRIM(`value`), ''), 'bale'), + `is_active` = 1 +WHERE `key` = 'support_messenger'; + +UPDATE `settings` SET `is_active` = 1 WHERE `key` IN ('zaarbox_api_url', 'zaarbox_price_key', 'chart_id', 'jibit_verification') AND `is_active` IS NULL; + +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'بنر بالای صفحه') WHERE `key` = 'header_banner'; +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'باز بودن درگاه') WHERE `key` = 'is_gateway_open'; +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'سقف واریز اولیه') WHERE `key` = 'limited_price'; +UPDATE `const` SET `title_fa` = COALESCE(NULLIF(TRIM(`title_fa`), ''), 'لاگ آخرین سفارش') WHERE `key` = 'last_order_log'; + +COMMIT; + +SELECT 'deploy_settings_const.sql finished' AS status; + +-- بعد از اجرا (اختیاری): +-- SELECT `key`, `title_fa`, `value`, `type`, `is_active` FROM `settings` ORDER BY `key`; +-- SELECT `key`, `value`, `title_fa` FROM `const` ORDER BY `key`;