From 85097a20b3ab1807912f9f1285683b860fd6f4ff Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 19:24:15 +0000 Subject: [PATCH] Fix JSON storage violations --- ...1002192359_2917df33-335f-47a9-a747-59cf6fc20cb8.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 supabase/migrations/20251002192359_2917df33-335f-47a9-a747-59cf6fc20cb8.sql diff --git a/supabase/migrations/20251002192359_2917df33-335f-47a9-a747-59cf6fc20cb8.sql b/supabase/migrations/20251002192359_2917df33-335f-47a9-a747-59cf6fc20cb8.sql new file mode 100644 index 00000000..95631a6f --- /dev/null +++ b/supabase/migrations/20251002192359_2917df33-335f-47a9-a747-59cf6fc20cb8.sql @@ -0,0 +1,10 @@ +-- Add size constraint to prevent JSON blob storage in content_submissions +-- This enforces the architectural rule: "NEVER STORE JSON IN SQL COLUMNS" +-- Content should only contain: action + max 2 reference IDs (< 500 bytes) + +ALTER TABLE public.content_submissions +ADD CONSTRAINT content_size_check +CHECK (pg_column_size(content) < 500); + +COMMENT ON CONSTRAINT content_size_check ON public.content_submissions +IS 'Prevents large JSON blobs in content column. Content should only contain action and reference IDs. All actual data goes in submission_items.item_data or specialized relational tables.'; \ No newline at end of file