From f999b8777774f68e2481f0157f99447c71d9df85 Mon Sep 17 00:00:00 2001 From: fateme Date: Sat, 28 Nov 2020 20:03:22 +0330 Subject: [PATCH] fix database --- app/Providers/AppServiceProvider.php | 2 + ...6_temp_bussiness_add_is_virtual_column.php | 34 ------------- ...054915_temp_append_role_name_en_column.php | 34 ------------- ...nd_permission_name_en_module_id_column.php | 36 ------------- ...temp_module_business_column_expires_at.php | 37 -------------- ...9_09_05_192945_add_load_in_home_column.php | 31 ------------ .../2019_10_06_173827_temp_update_columns.php | 50 ------------------- ...180355_add_first_name_last_name_column.php | 38 -------------- .../2020_05_13_073148_update_table_users.php | 45 ----------------- ...20_06_13_110825_new_update_table_users.php | 42 ---------------- database/seeds/DatabaseSeeder.php | 10 +++- 11 files changed, 11 insertions(+), 348 deletions(-) delete mode 100644 database/migrations/2019_08_06_170736_temp_bussiness_add_is_virtual_column.php delete mode 100644 database/migrations/2019_08_12_054915_temp_append_role_name_en_column.php delete mode 100644 database/migrations/2019_08_12_055107_temp_append_permission_name_en_module_id_column.php delete mode 100644 database/migrations/2019_08_17_133716_temp_module_business_column_expires_at.php delete mode 100644 database/migrations/2019_09_05_192945_add_load_in_home_column.php delete mode 100644 database/migrations/2019_10_06_173827_temp_update_columns.php delete mode 100644 database/migrations/2019_12_04_180355_add_first_name_last_name_column.php delete mode 100644 database/migrations/2020_05_13_073148_update_table_users.php delete mode 100644 database/migrations/2020_06_13_110825_new_update_table_users.php diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index d52268f..f12c8e1 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,6 +3,7 @@ namespace App\Providers; use App\Services\MorphModelFinder; +use Illuminate\Support\Facades\Schema; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -15,6 +16,7 @@ class AppServiceProvider extends ServiceProvider public function boot() { app(MorphModelFinder::class)->map(); + Schema::defaultStringLength(191); } /** diff --git a/database/migrations/2019_08_06_170736_temp_bussiness_add_is_virtual_column.php b/database/migrations/2019_08_06_170736_temp_bussiness_add_is_virtual_column.php deleted file mode 100644 index 34f290e..0000000 --- a/database/migrations/2019_08_06_170736_temp_bussiness_add_is_virtual_column.php +++ /dev/null @@ -1,34 +0,0 @@ -enum('is_virtual', ['yes', 'no'])->default('yes'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - if (Schema::hasColumn('businesses', 'is_virtual')) { - Schema::table('businesses', function (Blueprint $table) { - $table->dropColumn('is_virtual'); - }); - } - } -} diff --git a/database/migrations/2019_08_12_054915_temp_append_role_name_en_column.php b/database/migrations/2019_08_12_054915_temp_append_role_name_en_column.php deleted file mode 100644 index e602f5c..0000000 --- a/database/migrations/2019_08_12_054915_temp_append_role_name_en_column.php +++ /dev/null @@ -1,34 +0,0 @@ -string('name_en'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - if (Schema::hasColumn('tbl_roles', 'name_en')) { - Schema::table('tbl_roles', function (Blueprint $table) { - $table->dropColumn('name_en'); - }); - } - } -} diff --git a/database/migrations/2019_08_12_055107_temp_append_permission_name_en_module_id_column.php b/database/migrations/2019_08_12_055107_temp_append_permission_name_en_module_id_column.php deleted file mode 100644 index 2c65786..0000000 --- a/database/migrations/2019_08_12_055107_temp_append_permission_name_en_module_id_column.php +++ /dev/null @@ -1,36 +0,0 @@ -string('name_en'); - $table->unsignedInteger('module_id')->nullable(); - $table->index('module_id'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - if (Schema::hasColumn('tbl_permissions', 'name_en')) { - Schema::table('tbl_roles', function (Blueprint $table) { - $table->dropColumn('name_en'); - }); - } - } -} diff --git a/database/migrations/2019_08_17_133716_temp_module_business_column_expires_at.php b/database/migrations/2019_08_17_133716_temp_module_business_column_expires_at.php deleted file mode 100644 index a2f7424..0000000 --- a/database/migrations/2019_08_17_133716_temp_module_business_column_expires_at.php +++ /dev/null @@ -1,37 +0,0 @@ -timestamp('expires_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - $dbName = config('core.db_name'); - if (Schema::hasColumn($dbName . '.module_business', 'expires_at')) { - Schema::table($dbName . '.module_business', function (Blueprint $table) { - $table->dropColumn('expires_at'); - }); - } - } -} diff --git a/database/migrations/2019_09_05_192945_add_load_in_home_column.php b/database/migrations/2019_09_05_192945_add_load_in_home_column.php deleted file mode 100644 index ddc3b3c..0000000 --- a/database/migrations/2019_09_05_192945_add_load_in_home_column.php +++ /dev/null @@ -1,31 +0,0 @@ -enum('load_in_home', ['yes', 'no'])->default('yes'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - - } -} diff --git a/database/migrations/2019_10_06_173827_temp_update_columns.php b/database/migrations/2019_10_06_173827_temp_update_columns.php deleted file mode 100644 index ad4a96d..0000000 --- a/database/migrations/2019_10_06_173827_temp_update_columns.php +++ /dev/null @@ -1,50 +0,0 @@ -string('father_name', 255)->nullable(); - $table->string('telegram', 255)->nullable(); - $table->string('website', 255)->nullable(); - $table->text('description')->nullable(); - $table->unsignedInteger('client_title_id')->nullable(); - $table->foreign('client_title_id')->references('id')->on('client_titles'); - $table->dropColumn('client_category_id'); - }); - - Schema::table("$dbName.client_statuses", function (Blueprint $table) { - $table->string('color', 255)->nullable(); - $table->string('icon', 255)->nullable(); - }); - - $dbName = config('common.db_name'); - - Schema::table("$dbName.task_statuses", function (Blueprint $table) { - $table->string('color', 255)->nullable(); - $table->string('icon', 255)->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - - } -} diff --git a/database/migrations/2019_12_04_180355_add_first_name_last_name_column.php b/database/migrations/2019_12_04_180355_add_first_name_last_name_column.php deleted file mode 100644 index ba439e0..0000000 --- a/database/migrations/2019_12_04_180355_add_first_name_last_name_column.php +++ /dev/null @@ -1,38 +0,0 @@ -string('first_name', 255)->nullable()->after('name'); - $table->string('last_name', 255)->nullable()->after('first_name'); - }); - - $dbName = config("crm.db_name"); - Schema::table($dbName . ".clients", function (Blueprint $table) { - $table->string('first_name', 255)->nullable()->after('name'); - $table->string('last_name', 255)->nullable()->after('first_name'); - $table->string('file_code', 255)->nullable()->after('last_name'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/migrations/2020_05_13_073148_update_table_users.php b/database/migrations/2020_05_13_073148_update_table_users.php deleted file mode 100644 index 8f9c3b6..0000000 --- a/database/migrations/2020_05_13_073148_update_table_users.php +++ /dev/null @@ -1,45 +0,0 @@ -string('file_code')->nullable(); - $table->enum('user_type', ['natural','juridical'])->default('natural'); - $table->string('responsibility')->default('client'); - $table->string('father_name')->nullable(); - $table->string('website')->nullable(); - $table->text('description')->nullable(); - $table->unsignedInteger('user_status_id')->nullable(); - $table->unsignedInteger('user_title_id')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('users', function (Blueprint $table) { - $table->dropColumn('file_code'); - $table->dropColumn('user_type'); - $table->dropColumn('father_name'); - $table->dropColumn('website'); - $table->dropColumn('description'); - $table->dropColumn('user_status_id'); - $table->dropColumn('user_title_id'); - }); - } -} diff --git a/database/migrations/2020_06_13_110825_new_update_table_users.php b/database/migrations/2020_06_13_110825_new_update_table_users.php deleted file mode 100644 index bfc2145..0000000 --- a/database/migrations/2020_06_13_110825_new_update_table_users.php +++ /dev/null @@ -1,42 +0,0 @@ -date('marriage_date')->nullable(); - $table->string('company_type', 50)->nullable(); - $table->enum('sex', ['male','female'])->nullable(); - $table->string('registration_number',50)->nullable(); - $table->string('economic_code', 50)->nullable(); - $table->timestamp('modified_at')->nullable()->default(\DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP')); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('users', function (Blueprint $table) { - $table->dropColumn('marriage_date'); - $table->dropColumn('company_type'); - $table->dropColumn('sex'); - $table->dropColumn('registration_number'); - $table->dropColumn('economic_code'); - $table->dropColumn('modified_at'); - }); - } -} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 757f745..43264e8 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,7 +11,15 @@ class DatabaseSeeder extends Seeder */ public function run() { - // $this->call(ModuleSeeder::class); + $this->call(UserSeeder::class); + $this->call(BusinessSeeder::class); + $this->call(CategorySeeder::class); + $this->call(CitiesSeeder::class); + $this->call(DistrictSeeder::class); + $this->call(DomainSeeder::class); $this->call(HelpSeeder::class); + $this->call(ModuleSeeder::class); + $this->call(PermissionCategorySeeder::class); + $this->call(RoleSeeder::class); } }