Skip to content

Commit

Permalink
add index on external id
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Jun 24, 2024
1 parent 85f8a92 commit 4552c72
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/models/submitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# Indexes
#
# index_submitters_on_email (email)
# index_submitters_on_external_id (external_id)
# index_submitters_on_slug (slug) UNIQUE
# index_submitters_on_submission_id (submission_id)
#
Expand Down
9 changes: 5 additions & 4 deletions app/models/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
#
# Indexes
#
# index_templates_on_account_id (account_id)
# index_templates_on_author_id (author_id)
# index_templates_on_folder_id (folder_id)
# index_templates_on_slug (slug) UNIQUE
# index_templates_on_account_id (account_id)
# index_templates_on_author_id (author_id)
# index_templates_on_external_id (external_id)
# index_templates_on_folder_id (folder_id)
# index_templates_on_slug (slug) UNIQUE
#
# Foreign Keys
#
Expand Down
8 changes: 8 additions & 0 deletions db/migrate/20240624102526_add_index_on_external_id.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class AddIndexOnExternalId < ActiveRecord::Migration[7.1]
def change
add_index :submitters, :external_id
add_index :templates, :external_id
end
end
4 changes: 3 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.1].define(version: 2024_06_04_070648) do
ActiveRecord::Schema[7.1].define(version: 2024_06_24_102526) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -200,6 +200,7 @@
t.text "preferences", null: false
t.text "metadata", null: false
t.index ["email"], name: "index_submitters_on_email"
t.index ["external_id"], name: "index_submitters_on_external_id"
t.index ["slug"], name: "index_submitters_on_slug", unique: true
t.index ["submission_id"], name: "index_submitters_on_submission_id"
end
Expand Down Expand Up @@ -242,6 +243,7 @@
t.text "preferences", null: false
t.index ["account_id"], name: "index_templates_on_account_id"
t.index ["author_id"], name: "index_templates_on_author_id"
t.index ["external_id"], name: "index_templates_on_external_id"
t.index ["folder_id"], name: "index_templates_on_folder_id"
t.index ["slug"], name: "index_templates_on_slug", unique: true
end
Expand Down

0 comments on commit 4552c72

Please sign in to comment.