From de119f59c19db74aab3045edadd98b905e8d0ca6 Mon Sep 17 00:00:00 2001 From: Michael Kohl Date: Sat, 5 Dec 2020 03:31:16 +0700 Subject: [PATCH] Remove unused index_notifications_on_json_data (#11725) Co-authored-by: rhymes --- ...tifications_on_json_data_from_notifications.rb | 15 +++++++++++++++ db/schema.rb | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20201203063435_remove_index_notifications_on_json_data_from_notifications.rb diff --git a/db/migrate/20201203063435_remove_index_notifications_on_json_data_from_notifications.rb b/db/migrate/20201203063435_remove_index_notifications_on_json_data_from_notifications.rb new file mode 100644 index 000000000..72b68427a --- /dev/null +++ b/db/migrate/20201203063435_remove_index_notifications_on_json_data_from_notifications.rb @@ -0,0 +1,15 @@ +class RemoveIndexNotificationsOnJsonDataFromNotifications < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + def up + return unless index_exists?(:notifications, :json_data) + + remove_index :notifications, column: :json_data, algorithm: :concurrently + end + + def down + return if index_exists?(:notifications, :json_data) + + add_index :notifications, :json_data, algorithm: :concurrently, using: :gin + end +end diff --git a/db/schema.rb b/db/schema.rb index 34698e4a2..2aea5b925 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.define(version: 2020_11_19_153512) do +ActiveRecord::Schema.define(version: 2020_12_03_063435) do # These are extensions that must be enabled in order to support this database enable_extension "citext" @@ -715,7 +715,6 @@ ActiveRecord::Schema.define(version: 2020_11_19_153512) do t.datetime "updated_at", null: false t.bigint "user_id" t.index ["created_at"], name: "index_notifications_on_created_at" - t.index ["json_data"], name: "index_notifications_on_json_data", using: :gin t.index ["notifiable_id", "notifiable_type", "action"], name: "index_notifications_on_notifiable_id_notifiable_type_and_action" t.index ["notifiable_type"], name: "index_notifications_on_notifiable_type" t.index ["notified_at"], name: "index_notifications_on_notified_at"