]> git.openstreetmap.org Git - rails.git/commitdiff
Add (creator_id, id) index to blocks table
authorAnton Khorev <tony29@yandex.ru>
Fri, 5 Apr 2024 09:21:08 +0000 (12:21 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 5 Apr 2024 09:21:08 +0000 (12:21 +0300)
app/models/user_block.rb
db/migrate/20240405083825_add_creator_index_to_user_blocks.rb [new file with mode: 0644]
db/structure.sql

index 7af1f9bdc2d009a562bb910a6d560c6e7ae1846a..4fe50d921219320f04426eb82394d6e2a7d0cffc 100644 (file)
@@ -15,7 +15,8 @@
 #
 # Indexes
 #
-#  index_user_blocks_on_user_id  (user_id)
+#  index_user_blocks_on_creator_id_and_id  (creator_id,id)
+#  index_user_blocks_on_user_id            (user_id)
 #
 # Foreign Keys
 #
diff --git a/db/migrate/20240405083825_add_creator_index_to_user_blocks.rb b/db/migrate/20240405083825_add_creator_index_to_user_blocks.rb
new file mode 100644 (file)
index 0000000..542a102
--- /dev/null
@@ -0,0 +1,7 @@
+class AddCreatorIndexToUserBlocks < ActiveRecord::Migration[7.1]
+  disable_ddl_transaction!
+
+  def change
+    add_index :user_blocks, [:creator_id, :id], :algorithm => :concurrently
+  end
+end
index 294fda4c8f503e9472bbf1db16f2d3b1c462c8e0..829595e7c7431afc17946a7a57e8d14fb93bc71e 100644 (file)
@@ -2728,6 +2728,13 @@ CREATE INDEX index_reports_on_issue_id ON public.reports USING btree (issue_id);
 CREATE INDEX index_reports_on_user_id ON public.reports USING btree (user_id);
 
 
+--
+-- Name: index_user_blocks_on_creator_id_and_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_user_blocks_on_creator_id_and_id ON public.user_blocks USING btree (creator_id, id);
+
+
 --
 -- Name: index_user_blocks_on_user_id; Type: INDEX; Schema: public; Owner: -
 --
@@ -3512,6 +3519,7 @@ INSERT INTO "schema_migrations" (version) VALUES
 ('23'),
 ('22'),
 ('21'),
+('20240405083825'),
 ('20240307181018'),
 ('20240307180830'),
 ('20240228205723'),