Skip to content

Commit

Permalink
fix(schema): add missing index administrateurs#groupe_gestionnaire_id
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux committed Nov 8, 2023
1 parent f1730e8 commit 5c7b867
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class AddMissingAdministrateursGroupeGestionnaireIndex < ActiveRecord::Migration[7.0]
disable_ddl_transaction!

def up
if !index_exists?(:administrateurs, :groupe_gestionnaire_id) # index may have already been added on other environments by a previous migration
add_index :administrateurs, :groupe_gestionnaire_id, algorithm: :concurrently
end
end

def down
if index_exists?(:administrateurs, :groupe_gestionnaire_id)
remove_index :administrateurs, :groupe_gestionnaire_id
end
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_11_08_120254) do
ActiveRecord::Schema[7.0].define(version: 2023_11_08_120731) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down Expand Up @@ -65,6 +65,7 @@
t.bigint "groupe_gestionnaire_id"
t.datetime "updated_at", precision: nil
t.bigint "user_id", null: false
t.index ["groupe_gestionnaire_id"], name: "index_administrateurs_on_groupe_gestionnaire_id"
t.index ["user_id"], name: "index_administrateurs_on_user_id"
end

Expand Down

0 comments on commit 5c7b867

Please sign in to comment.