Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions supabase/drift-manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"generated_at": "2026-07-09T10:38:15.859Z",
"generated_at": "2026-07-11T02:45:10.714Z",
"generator": "scripts/generate-drift-manifest.ts",
"postgres_image": "supabase/postgres:17.6.1.127",
"schema_sha256": "3a60bf1561142aed58e45a1cf8a9605ccc715dd7358e154c4ad9879b82be4cd5",
"replay_seconds": 20,
"schema_sha256": "aa8a419ab55b4637b858df628aa250b714ab1acd715d4f7786bcf6ec71f5e218",
"replay_seconds": 22,
"snapshot": {
"views": [
{
Expand Down Expand Up @@ -4263,12 +4263,6 @@
"table": "clinical_registry_record_sources",
"def_hash": "aff03b1509bdec54ffc6611caf47b647"
},
{
"def": "CREATE INDEX clinical_registry_record_sources_record_idx ON public.clinical_registry_record_sources USING btree (record_id)",
"name": "clinical_registry_record_sources_record_idx",
"table": "clinical_registry_record_sources",
"def_hash": "ef53891aac4bf949c894e35187d71517"
},
{
"def": "CREATE UNIQUE INDEX clinical_registry_records_owner_id_kind_slug_key ON public.clinical_registry_records USING btree (owner_id, kind, slug)",
"name": "clinical_registry_records_owner_id_kind_slug_key",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Drop redundant index (supabase-postgres-best-practices review, 2026-07-11).
--
-- clinical_registry_record_sources_record_idx (record_id) is a strict prefix of
-- the index backing the UNIQUE (record_id, document_id) constraint on
-- clinical_registry_record_sources. PostgreSQL can use the unique index's
-- leading column for every equality lookup on record_id, so the standalone
-- index adds write overhead with no read benefit. Same rationale as
-- 20260702110000_drop_redundant_indexes.sql.
--
-- clinical_registry_record_sources_document_idx stays: document_id is not a
-- leading column of any other index and backs the documents ON DELETE CASCADE.
--
-- NOTE: DROP INDEX CONCURRENTLY cannot run inside a transaction block, and
-- Supabase migrations run in one. The table is small (curated registry links),
-- so a plain DROP INDEX is fine. For zero-impact removal run manually outside
-- a transaction:
-- DROP INDEX CONCURRENTLY IF EXISTS public.clinical_registry_record_sources_record_idx;

drop index if exists public.clinical_registry_record_sources_record_idx;
5 changes: 3 additions & 2 deletions supabase/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4945,8 +4945,9 @@ create table if not exists public.clinical_registry_record_sources (

create index if not exists clinical_registry_records_owner_kind_idx
on public.clinical_registry_records(owner_id, kind, title);
create index if not exists clinical_registry_record_sources_record_idx
on public.clinical_registry_record_sources(record_id);
-- No standalone record_id index: the unique (record_id, document_id) index's
-- leading column serves record_id lookups (20260711000000 dropped the redundant
-- clinical_registry_record_sources_record_idx).
create index if not exists clinical_registry_record_sources_document_idx
on public.clinical_registry_record_sources(document_id);

Expand Down