#
# Indexes
#
-# index_notes_on_description (to_tsvector('english'::regconfig, description)) USING gin
-# notes_created_at_idx (created_at)
-# notes_tile_status_idx (tile,status)
-# notes_updated_at_idx (updated_at)
+# index_notes_on_description (to_tsvector('english'::regconfig, description)) USING gin
+# index_notes_on_user_id_and_created_at (user_id,created_at) WHERE (user_id IS NOT NULL)
+# notes_created_at_idx (created_at)
+# notes_tile_status_idx (tile,status)
+# notes_updated_at_idx (updated_at)
#
# Foreign Keys
#
--- /dev/null
+class AddNotesUserIdCreatedAtIndex < ActiveRecord::Migration[7.2]
+ disable_ddl_transaction!
+
+ def change
+ add_index :notes, [:user_id, :created_at],
+ :algorithm => :concurrently,
+ :where => "user_id IS NOT NULL"
+ end
+end
SET client_min_messages = warning;
SET row_security = off;
+
--
-- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
--
CREATE INDEX index_notes_on_description ON public.notes USING gin (to_tsvector('english'::regconfig, description));
+--
+-- Name: index_notes_on_user_id_and_created_at; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_notes_on_user_id_and_created_at ON public.notes USING btree (user_id, created_at) WHERE (user_id IS NOT NULL);
+
+
--
-- Name: index_oauth_access_grants_on_application_id; Type: INDEX; Schema: public; Owner: -
--
('23'),
('22'),
('21'),
+('20250304172798'),
('20250304172758'),
('20250212160355'),
('20250206202905'),