16 lines
716 B
SQL
16 lines
716 B
SQL
-- 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
|
|
$$;
|