24 lines
1.1 KiB
SQL
24 lines
1.1 KiB
SQL
-- R-P11a Global Search isolation artifact.
|
|
-- Companion to prisma/rls/tenant-isolation.sql. These tables are tenant-scoped
|
|
-- metadata around Meilisearch documents and recent searches. Enable during the
|
|
-- merge migration once the schema lands.
|
|
--
|
|
-- Verification:
|
|
-- psql "$DIRECT_URL" -f prisma/rls/search-isolation.sql
|
|
|
|
ALTER TABLE "SearchIndexEntry" ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE "SearchIndexEntry" FORCE ROW LEVEL SECURITY;
|
|
|
|
DROP POLICY IF EXISTS "tenant_isolation_search_index_entry" ON "SearchIndexEntry";
|
|
CREATE POLICY "tenant_isolation_search_index_entry" ON "SearchIndexEntry"
|
|
USING ("tenantId" = current_setting('app.current_tenant_id', true))
|
|
WITH CHECK ("tenantId" = current_setting('app.current_tenant_id', true));
|
|
|
|
ALTER TABLE "RecentSearch" ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE "RecentSearch" FORCE ROW LEVEL SECURITY;
|
|
|
|
DROP POLICY IF EXISTS "tenant_isolation_recent_search" ON "RecentSearch";
|
|
CREATE POLICY "tenant_isolation_recent_search" ON "RecentSearch"
|
|
USING ("tenantId" = current_setting('app.current_tenant_id', true))
|
|
WITH CHECK ("tenantId" = current_setting('app.current_tenant_id', true));
|