From c4f05fbd9e253f4507fb9d3c2275db9a4ac455ca Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Fri, 16 Aug 2024 15:20:56 +0300 Subject: [PATCH] remove unique index --- ...20240816121641_remove_active_storage_uniq_index.rb | 11 +++++++++++ db/schema.rb | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20240816121641_remove_active_storage_uniq_index.rb diff --git a/db/migrate/20240816121641_remove_active_storage_uniq_index.rb b/db/migrate/20240816121641_remove_active_storage_uniq_index.rb new file mode 100644 index 00000000..ecbe660c --- /dev/null +++ b/db/migrate/20240816121641_remove_active_storage_uniq_index.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveActiveStorageUniqIndex < ActiveRecord::Migration[7.1] + def change + remove_index :active_storage_attachments, %i[record_type record_id name blob_id], + unique: true, + name: 'index_active_storage_attachments_uniqueness' + + add_index :active_storage_attachments, %i[record_type record_id name blob_id] + end +end diff --git a/db/schema.rb b/db/schema.rb index 61891a35..de8df185 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_08_16_075917) do +ActiveRecord::Schema[7.1].define(version: 2024_08_16_121641) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -64,7 +64,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_08_16_075917) do t.bigint "blob_id", null: false t.datetime "created_at", null: false t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" - t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + t.index ["record_type", "record_id", "name", "blob_id"], name: "idx_on_record_type_record_id_name_blob_id_0be5805727" t.index ["uuid"], name: "index_active_storage_attachments_on_uuid" end