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
59
db/reinitialize_user.md
Normal file
59
db/reinitialize_user.md
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# Reinitialize User with Default Props
|
||||
|
||||
When stock props or avatars are updated in the database, existing users may need to be reinitialized to receive the new defaults.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Find the user's ID:
|
||||
|
||||
```sql
|
||||
SELECT id, username FROM auth.users WHERE username = 'TARGET_USERNAME';
|
||||
```
|
||||
|
||||
2. Clear existing data and reinitialize:
|
||||
|
||||
```sql
|
||||
BEGIN;
|
||||
|
||||
-- Clear existing props and avatars for the user
|
||||
DELETE FROM props.active_avatars WHERE user_id = 'USER_UUID';
|
||||
DELETE FROM props.avatars WHERE user_id = 'USER_UUID';
|
||||
DELETE FROM props.inventory WHERE user_id = 'USER_UUID';
|
||||
|
||||
-- Reinitialize with current server props
|
||||
SELECT auth.initialize_new_user('USER_UUID');
|
||||
|
||||
COMMIT;
|
||||
```
|
||||
|
||||
3. Verify the results:
|
||||
|
||||
```sql
|
||||
SELECT COUNT(*) as inventory_count FROM props.inventory WHERE user_id = 'USER_UUID';
|
||||
SELECT id, name, slot_number FROM props.avatars WHERE user_id = 'USER_UUID';
|
||||
```
|
||||
|
||||
## Example: Reinitialize ranosh
|
||||
|
||||
```bash
|
||||
psql -d chattyness <<'EOF'
|
||||
BEGIN;
|
||||
|
||||
DELETE FROM props.active_avatars WHERE user_id = '57a12201-ea0f-4545-9ccc-c4e67ea7e2c4';
|
||||
DELETE FROM props.avatars WHERE user_id = '57a12201-ea0f-4545-9ccc-c4e67ea7e2c4';
|
||||
DELETE FROM props.inventory WHERE user_id = '57a12201-ea0f-4545-9ccc-c4e67ea7e2c4';
|
||||
|
||||
SELECT auth.initialize_new_user('57a12201-ea0f-4545-9ccc-c4e67ea7e2c4');
|
||||
|
||||
COMMIT;
|
||||
EOF
|
||||
```
|
||||
|
||||
## What `initialize_new_user` Does
|
||||
|
||||
The `auth.initialize_new_user()` function:
|
||||
|
||||
1. Inserts all face-tagged server props into the user's inventory
|
||||
2. Creates a default avatar (slot 0) with:
|
||||
- Face prop in the skin layer (position 4, center)
|
||||
- All emotion props mapped to their respective emotion slots
|
||||
Loading…
Add table
Add a link
Reference in a new issue