database schema adjustments to server/realm/scene
This commit is contained in:
parent
a102c96bb4
commit
09590edd95
79 changed files with 7100 additions and 100 deletions
25
db/reinitialize_all_users.sql
Normal file
25
db/reinitialize_all_users.sql
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
-- Reinitialize all users with current server props
|
||||
-- Use: psql -d chattyness -f reinitialize_all_users.sql
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
v_user RECORD;
|
||||
v_count INT := 0;
|
||||
BEGIN
|
||||
FOR v_user IN SELECT id, username FROM auth.users
|
||||
LOOP
|
||||
-- Clear existing data
|
||||
DELETE FROM props.active_avatars WHERE user_id = v_user.id;
|
||||
DELETE FROM props.avatars WHERE user_id = v_user.id;
|
||||
DELETE FROM props.inventory WHERE user_id = v_user.id;
|
||||
|
||||
-- Reinitialize with current server props
|
||||
PERFORM auth.initialize_new_user(v_user.id);
|
||||
|
||||
v_count := v_count + 1;
|
||||
RAISE NOTICE 'Reinitialized user: % (%)', v_user.username, v_user.id;
|
||||
END LOOP;
|
||||
|
||||
RAISE NOTICE 'Total users reinitialized: %', v_count;
|
||||
END;
|
||||
$$;
|
||||
Loading…
Add table
Add a link
Reference in a new issue