['account_id'], 'accounts' => ['user_id', 'user_group_id', 'account_type_id'], 'budgets' => ['user_id', 'user_group_id'], 'journal_meta' => ['transaction_journal_id', 'data', 'name'], 'category_transaction_journal' => ['transaction_journal_id'], 'categories' => ['user_id', 'user_group_id'], 'transaction_groups' => ['user_id', 'user_group_id'], 'transaction_journals' => ['user_id', 'user_group_id', 'date', 'transaction_group_id', 'transaction_type_id', 'transaction_currency_id', 'bill_id'], 'transactions' => ['account_id', 'transaction_journal_id', 'transaction_currency_id', 'foreign_currency_id'], ]; foreach ($set as $table => $fields) { foreach ($fields as $field) { try { Schema::table( $table, static function (Blueprint $blueprint) use ($field): void { $blueprint->index($field); } ); } catch (QueryException $e) { app('log')->error(sprintf(self::QUERY_ERROR, $table, $field, $e->getMessage())); app('log')->error(self::EXPL); } } } } /** * Reverse the migrations. */ public function down(): void {} };