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
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@ as $$
limit match_count;
$$;

-- The live/preview database may carry a match_document_chunks_text OUT signature
-- that differs from this batching rewrite (see 20260702170000 no-op note).
-- PostgreSQL rejects CREATE OR REPLACE when OUT columns change.
drop function if exists public.match_document_chunks_text(text, integer, uuid[], uuid);

create or replace function public.match_document_chunks_text(
query_text text,
match_count integer default 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ from promoted_public_documents pd
where dmc.document_id = pd.id;

update public.document_table_facts dtf
set owner_id = null, updated_at = now()
set owner_id = null
from promoted_public_documents pd
where dtf.document_id = pd.id;

update public.document_embedding_fields def
set owner_id = null, updated_at = now()
set owner_id = null
from promoted_public_documents pd
where def.document_id = pd.id;

Expand Down
2 changes: 2 additions & 0 deletions supabase/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2663,6 +2663,8 @@ as $$
limit match_count;
$$;

drop function if exists public.match_document_chunks_text(text, integer, uuid[], uuid);

create or replace function public.match_document_chunks_text(
query_text text,
match_count integer default 12,
Expand Down
10 changes: 10 additions & 0 deletions tests/supabase-schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const phase7RetrievalPerformanceMigration = readFileSync(
new URL("../supabase/migrations/20260626020000_phase7_retrieval_rpc_performance.sql", import.meta.url),
"utf8",
).replace(/\s+/g, " ");
const retrievalOwnerFilterSentinelMigration = readFileSync(
new URL("../supabase/migrations/20260705210000_retrieval_owner_filter_sentinel.sql", import.meta.url),
"utf8",
).replace(/\s+/g, " ");
const atomicReindexMigration = readFileSync(
new URL("../supabase/migrations/20260628000000_atomic_reindex_generation_commit.sql", import.meta.url),
"utf8",
Expand Down Expand Up @@ -797,6 +801,12 @@ describe("Supabase Preview replay guards", () => {
);
});

it("drops match_document_chunks_text before retrieval owner sentinel rewrites it", () => {
expect(retrievalOwnerFilterSentinelMigration).toContain(
"drop function if exists public.match_document_chunks_text(text, integer, uuid[], uuid)",
);
});

it("guards pg_cron retention schedules for preview branches without cron.job", () => {
for (const sql of [ragQueriesRetentionMigration, ragRetrievalLogsRetentionMigration]) {
expect(sql).toContain("to_regnamespace('cron')");
Expand Down
Loading