From 8605f29b98d43c494a2529c89afa3eb228ef6d53 Mon Sep 17 00:00:00 2001 From: Anna Buianova Date: Fri, 14 Jun 2019 16:29:15 +0300 Subject: [PATCH] Added organization_id index to notifications (#3155) --- ...190614093041_add_notifications_organization_id_index.rb | 7 +++++++ db/schema.rb | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190614093041_add_notifications_organization_id_index.rb diff --git a/db/migrate/20190614093041_add_notifications_organization_id_index.rb b/db/migrate/20190614093041_add_notifications_organization_id_index.rb new file mode 100644 index 000000000..1999fcdb5 --- /dev/null +++ b/db/migrate/20190614093041_add_notifications_organization_id_index.rb @@ -0,0 +1,7 @@ +class AddNotificationsOrganizationIdIndex < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + add_index :notifications, :organization_id, algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index abfe6e118..482be93f3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_06_12_095959) do +ActiveRecord::Schema.define(version: 2019_06_14_093041) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -527,6 +527,7 @@ ActiveRecord::Schema.define(version: 2019_06_12_095959) do t.index ["notifiable_type"], name: "index_notifications_on_notifiable_type" t.index ["organization_id", "notifiable_id", "notifiable_type", "action"], name: "index_notifications_on_org_notifiable_and_action_not_null", unique: true, where: "(action IS NOT NULL)" t.index ["organization_id", "notifiable_id", "notifiable_type"], name: "index_notifications_on_org_notifiable_action_is_null", unique: true, where: "(action IS NULL)" + t.index ["organization_id"], name: "index_notifications_on_organization_id" t.index ["user_id", "notifiable_id", "notifiable_type", "action"], name: "index_notifications_on_user_notifiable_and_action_not_null", unique: true, where: "(action IS NOT NULL)" t.index ["user_id", "notifiable_id", "notifiable_type"], name: "index_notifications_on_user_notifiable_action_is_null", unique: true, where: "(action IS NULL)" t.index ["user_id"], name: "index_notifications_on_user_id"