Migrations

This commit is contained in:
2026-03-01 18:51:53 +08:00
parent 2100516238
commit 830c99a3ff
7 changed files with 160 additions and 0 deletions
@@ -0,0 +1,15 @@
-- Recreate a permissive INSERT policy for authenticated users on task_activity_logs
-- Idempotent: drops existing policy and recreates it.
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='task_activity_logs') THEN
-- enable RLS (idempotent)
EXECUTE 'ALTER TABLE IF EXISTS public.task_activity_logs ENABLE ROW LEVEL SECURITY';
-- drop any old policy and recreate permissive insert policy for authenticated role
EXECUTE 'DROP POLICY IF EXISTS allow_authenticated_inserts ON public.task_activity_logs';
EXECUTE 'CREATE POLICY allow_authenticated_inserts ON public.task_activity_logs FOR INSERT TO authenticated USING (true) WITH CHECK (true)';
END IF;
END
$$;