From db8682bb92b5facf8b60e976dd1edbc1e5fd49bd Mon Sep 17 00:00:00 2001 From: kaioken Date: Sat, 27 Jul 2024 10:42:32 -0400 Subject: [PATCH] refact: add new index --- ..._27_144141_update_company_branch_index.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 database/migrations/2024_07_27_144141_update_company_branch_index.php diff --git a/database/migrations/2024_07_27_144141_update_company_branch_index.php b/database/migrations/2024_07_27_144141_update_company_branch_index.php new file mode 100644 index 000000000..e678ce980 --- /dev/null +++ b/database/migrations/2024_07_27_144141_update_company_branch_index.php @@ -0,0 +1,47 @@ +index(['companies_id', 'is_deleted']); + }); + + Schema::table('users_associated_apps', function (Blueprint $table) { + $table->index(['apps_id', 'companies_id']); + }); + + Schema::table('companies_branches', function (Blueprint $table) { + $table->index('is_deleted'); + $table->index(['companies_id', 'is_deleted']); + $table->index(['uuid', 'companies_id', 'is_deleted']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users_associated_company', function (Blueprint $table) { + $table->dropIndex(['companies_id', 'is_deleted']); + }); + + Schema::table('users_associated_apps', function (Blueprint $table) { + $table->dropIndex(['apps_id', 'companies_id']); + }); + + Schema::table('companies_branches', function (Blueprint $table) { + $table->dropIndex(['is_deleted']); + $table->dropIndex(['companies_id', 'is_deleted']); + $table->dropIndex(['uuid', 'companies_id', 'is_deleted']); + }); + } +};