diff --git a/sql/14_create_events_table.sql b/sql/14_create_events_table.sql index b88ed67..da42aa8 100644 --- a/sql/14_create_events_table.sql +++ b/sql/14_create_events_table.sql @@ -73,22 +73,7 @@ CREATE POLICY "Users can update their own events in accessible tablos" ON events AND EXISTS ( SELECT 1 FROM user_tablos ut JOIN events ON ut.id = events.tablo_id - WHERE events.deleted_at IS NULL - AND ( - ut.user_id = (SELECT auth.uid()) - ) - ) - ); - --- Policy to allow users to delete their own events in accessible tablos -CREATE POLICY "Users can delete their own events in accessible tablos" ON events - FOR DELETE USING ( - created_by = (SELECT auth.uid()) - AND EXISTS ( - SELECT 1 FROM user_tablos ut - JOIN events ON ut.id = events.tablo_id - WHERE events.deleted_at IS NULL - AND ( + WHERE ( ut.user_id = (SELECT auth.uid()) ) )