diff --git a/packages/site/src/lib/supabase/cached-query-data.ts b/packages/site/src/lib/supabase/cached-query-data.ts index c72f664c2..06444d349 100644 --- a/packages/site/src/lib/supabase/cached-query-data.ts +++ b/packages/site/src/lib/supabase/cached-query-data.ts @@ -27,6 +27,8 @@ export function cached_query_data_storeReset cache (after public/private toggle, remove editor) diff --git a/packages/site/src/routes/admin/+layout.ts b/packages/site/src/routes/admin/+layout.ts index e82da76f6..aa03dc673 100644 --- a/packages/site/src/routes/admin/+layout.ts +++ b/packages/site/src/routes/admin/+layout.ts @@ -45,6 +45,7 @@ export const load = (async ({ parent }) => { live_query: supabase.rpc('users_for_admin_table') .select(), key: 'users', + order_field: 'id', }) const dictionary_roles = cached_query_data_store>({ diff --git a/supabase/migrations/20250225151251_able-to-delete-users.sql b/supabase/migrations/20250225151251_able-to-delete-users.sql new file mode 100644 index 000000000..30450aaec --- /dev/null +++ b/supabase/migrations/20250225151251_able-to-delete-users.sql @@ -0,0 +1,8 @@ +ALTER TABLE user_data +DROP CONSTRAINT user_data_id_fkey; + +ALTER TABLE user_data +ADD CONSTRAINT user_data_id_fkey +FOREIGN KEY (id) +REFERENCES auth.users(id) +ON DELETE CASCADE; \ No newline at end of file diff --git a/supabase/summarized-migrations.sql b/supabase/summarized-migrations.sql index b1edca047..ea63f4e4c 100644 --- a/supabase/summarized-migrations.sql +++ b/supabase/summarized-migrations.sql @@ -723,7 +723,7 @@ FROM auth.users; REVOKE ALL ON public.profiles_view FROM anon, authenticated, public; CREATE TABLE user_data ( - id uuid references auth.users not null primary key, + id uuid references auth.users not null primary key ON DELETE CASCADE, updated_at timestamp with time zone DEFAULT now() NOT NULL, welcome_email_sent timestamp with time zone, unsubscribed_from_emails timestamp with time zone,