From 4552c728607cb1654e124df117ccf09ff807b2d8 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 24 Jun 2024 13:27:14 +0300 Subject: [PATCH] add index on external id --- app/models/submitter.rb | 1 + app/models/template.rb | 9 +++++---- db/migrate/20240624102526_add_index_on_external_id.rb | 8 ++++++++ db/schema.rb | 4 +++- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20240624102526_add_index_on_external_id.rb diff --git a/app/models/submitter.rb b/app/models/submitter.rb index 2b46274f..2a9ef7f1 100644 --- a/app/models/submitter.rb +++ b/app/models/submitter.rb @@ -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) # diff --git a/app/models/template.rb b/app/models/template.rb index bfa21fae..54d29a43 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -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 # diff --git a/db/migrate/20240624102526_add_index_on_external_id.rb b/db/migrate/20240624102526_add_index_on_external_id.rb new file mode 100644 index 00000000..95ffc511 --- /dev/null +++ b/db/migrate/20240624102526_add_index_on_external_id.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 86642211..bfebcf29 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" @@ -200,6 +200,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_06_04_070648) do 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 @@ -242,6 +243,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_06_04_070648) do 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