mantenimento-app 2.2.9 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ -- Grant donor/premium entitlement globally (server-side) to selected users.
2
+ -- Usage in Supabase SQL Editor:
3
+ -- 1) Edit the usernames/emails in the WHERE clause.
4
+ -- 2) Run the script.
5
+
6
+ update auth.users
7
+ set raw_user_meta_data =
8
+ coalesce(raw_user_meta_data, '{}'::jsonb)
9
+ || jsonb_build_object(
10
+ 'is_donor', true,
11
+ 'role', 'donor'
12
+ )
13
+ where lower(split_part(email, '@', 1)) in ('favagit', 'fabio.vacchino');
14
+
15
+ -- Verification
16
+ select
17
+ id,
18
+ email,
19
+ raw_user_meta_data->>'is_donor' as is_donor,
20
+ raw_user_meta_data->>'role' as role
21
+ from auth.users
22
+ where lower(split_part(email, '@', 1)) in ('favagit', 'fabio.vacchino');
@@ -0,0 +1,19 @@
1
+ -- Revoke donor/premium entitlement globally (server-side) from selected users.
2
+ -- Usage in Supabase SQL Editor:
3
+ -- 1) Edit the usernames/emails in the WHERE clause.
4
+ -- 2) Run the script.
5
+
6
+ update auth.users
7
+ set raw_user_meta_data =
8
+ (coalesce(raw_user_meta_data, '{}'::jsonb) - 'is_donor' - 'isDonor' - 'premium' - 'role')
9
+ where lower(split_part(email, '@', 1)) in ('favagit', 'fabio.vacchino');
10
+
11
+ -- Verification
12
+ select
13
+ id,
14
+ email,
15
+ raw_user_meta_data->>'is_donor' as is_donor,
16
+ raw_user_meta_data->>'role' as role,
17
+ raw_user_meta_data->>'premium' as premium
18
+ from auth.users
19
+ where lower(split_part(email, '@', 1)) in ('favagit', 'fabio.vacchino');