From f9efd3aafc1b9d973f846e5b8009495d5b0bc575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Thu, 29 Dec 2022 11:34:18 +0100 Subject: [PATCH] add index to permalink.about --- app/models/communication/website/permalink.rb | 5 +++-- app/models/communication/website/permalink/administrator.rb | 5 +++-- app/models/communication/website/permalink/author.rb | 5 +++-- app/models/communication/website/permalink/category.rb | 5 +++-- app/models/communication/website/permalink/diploma.rb | 5 +++-- app/models/communication/website/permalink/organization.rb | 5 +++-- app/models/communication/website/permalink/page.rb | 5 +++-- app/models/communication/website/permalink/person.rb | 5 +++-- app/models/communication/website/permalink/post.rb | 5 +++-- app/models/communication/website/permalink/program.rb | 5 +++-- app/models/communication/website/permalink/researcher.rb | 5 +++-- app/models/communication/website/permalink/teacher.rb | 5 +++-- ...38_add_about_index_in_communication_website_permalinks.rb | 5 +++++ db/schema.rb | 3 ++- 14 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 db/migrate/20221229103238_add_about_index_in_communication_website_permalinks.rb diff --git a/app/models/communication/website/permalink.rb b/app/models/communication/website/permalink.rb index e035be88f..e26ce4c82 100644 --- a/app/models/communication/website/permalink.rb +++ b/app/models/communication/website/permalink.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/administrator.rb b/app/models/communication/website/permalink/administrator.rb index 3ae3a90cf..d7ca0d708 100644 --- a/app/models/communication/website/permalink/administrator.rb +++ b/app/models/communication/website/permalink/administrator.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/author.rb b/app/models/communication/website/permalink/author.rb index 6f94a1153..64417b06e 100644 --- a/app/models/communication/website/permalink/author.rb +++ b/app/models/communication/website/permalink/author.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/category.rb b/app/models/communication/website/permalink/category.rb index 933dcd3a9..44fde9ae1 100644 --- a/app/models/communication/website/permalink/category.rb +++ b/app/models/communication/website/permalink/category.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/diploma.rb b/app/models/communication/website/permalink/diploma.rb index 9df94320c..651855a6b 100644 --- a/app/models/communication/website/permalink/diploma.rb +++ b/app/models/communication/website/permalink/diploma.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/organization.rb b/app/models/communication/website/permalink/organization.rb index b1b20dc23..85b3d3269 100644 --- a/app/models/communication/website/permalink/organization.rb +++ b/app/models/communication/website/permalink/organization.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/page.rb b/app/models/communication/website/permalink/page.rb index e615a2b5f..388f56280 100644 --- a/app/models/communication/website/permalink/page.rb +++ b/app/models/communication/website/permalink/page.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/person.rb b/app/models/communication/website/permalink/person.rb index 95ea4ba45..034fab57e 100644 --- a/app/models/communication/website/permalink/person.rb +++ b/app/models/communication/website/permalink/person.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/post.rb b/app/models/communication/website/permalink/post.rb index 43e79fa4f..55d91fb90 100644 --- a/app/models/communication/website/permalink/post.rb +++ b/app/models/communication/website/permalink/post.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/program.rb b/app/models/communication/website/permalink/program.rb index 7e4f7fd28..309e44aa3 100644 --- a/app/models/communication/website/permalink/program.rb +++ b/app/models/communication/website/permalink/program.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/researcher.rb b/app/models/communication/website/permalink/researcher.rb index a770f8e2a..16dae292f 100644 --- a/app/models/communication/website/permalink/researcher.rb +++ b/app/models/communication/website/permalink/researcher.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/app/models/communication/website/permalink/teacher.rb b/app/models/communication/website/permalink/teacher.rb index 37783685b..8d464df92 100644 --- a/app/models/communication/website/permalink/teacher.rb +++ b/app/models/communication/website/permalink/teacher.rb @@ -3,17 +3,18 @@ # Table name: communication_website_permalinks # # id :uuid not null, primary key -# about_type :string not null +# about_type :string not null, indexed => [about_id] # is_current :boolean default(TRUE) # path :string # created_at :datetime not null # updated_at :datetime not null -# about_id :uuid not null +# about_id :uuid not null, indexed => [about_type] # university_id :uuid not null, indexed # website_id :uuid not null, indexed # # Indexes # +# index_communication_website_permalinks_on_about (about_type,about_id) # index_communication_website_permalinks_on_university_id (university_id) # index_communication_website_permalinks_on_website_id (website_id) # diff --git a/db/migrate/20221229103238_add_about_index_in_communication_website_permalinks.rb b/db/migrate/20221229103238_add_about_index_in_communication_website_permalinks.rb new file mode 100644 index 000000000..d16383f31 --- /dev/null +++ b/db/migrate/20221229103238_add_about_index_in_communication_website_permalinks.rb @@ -0,0 +1,5 @@ +class AddAboutIndexInCommunicationWebsitePermalinks < ActiveRecord::Migration[7.0] + def change + add_index :communication_website_permalinks, [:about_type, :about_id], name: :index_communication_website_permalinks_on_about + end +end diff --git a/db/schema.rb b/db/schema.rb index bb15072bf..dd8b5176e 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.0].define(version: 2022_12_26_160909) do +ActiveRecord::Schema[7.0].define(version: 2022_12_29_103238) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -337,6 +337,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_12_26_160909) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "is_current", default: true + t.index ["about_type", "about_id"], name: "index_communication_website_permalinks_on_about" t.index ["university_id"], name: "index_communication_website_permalinks_on_university_id" t.index ["website_id"], name: "index_communication_website_permalinks_on_website_id" end -- GitLab