added server and realm tabs to inventory screen

This commit is contained in:
Evan Carroll 2026-01-16 16:47:30 -06:00
parent ee425e224e
commit acab2f017d
12 changed files with 647 additions and 151 deletions

View file

@ -9,9 +9,9 @@ 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;
DELETE FROM auth.active_avatars WHERE user_id = v_user.id;
DELETE FROM auth.avatars WHERE user_id = v_user.id;
DELETE FROM auth.inventory WHERE user_id = v_user.id;
-- Reinitialize with current server props
PERFORM auth.initialize_new_user(v_user.id);

View file

@ -16,9 +16,9 @@ SELECT id, username FROM auth.users WHERE username = 'TARGET_USERNAME';
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';
DELETE FROM auth.active_avatars WHERE user_id = 'USER_UUID';
DELETE FROM auth.avatars WHERE user_id = 'USER_UUID';
DELETE FROM auth.inventory WHERE user_id = 'USER_UUID';
-- Reinitialize with current server props
SELECT auth.initialize_new_user('USER_UUID');
@ -29,8 +29,8 @@ 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';
SELECT COUNT(*) as inventory_count FROM auth.inventory WHERE user_id = 'USER_UUID';
SELECT id, name, slot_number FROM auth.avatars WHERE user_id = 'USER_UUID';
```
## Example: Reinitialize ranosh
@ -39,9 +39,9 @@ SELECT id, name, slot_number FROM props.avatars WHERE user_id = 'USER_UUID';
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';
DELETE FROM auth.active_avatars WHERE user_id = '57a12201-ea0f-4545-9ccc-c4e67ea7e2c4';
DELETE FROM auth.avatars WHERE user_id = '57a12201-ea0f-4545-9ccc-c4e67ea7e2c4';
DELETE FROM auth.inventory WHERE user_id = '57a12201-ea0f-4545-9ccc-c4e67ea7e2c4';
SELECT auth.initialize_new_user('57a12201-ea0f-4545-9ccc-c4e67ea7e2c4');

View file

@ -278,6 +278,7 @@ CREATE TABLE server.props (
is_transferable BOOLEAN NOT NULL DEFAULT true,
is_portable BOOLEAN NOT NULL DEFAULT true,
is_droppable BOOLEAN NOT NULL DEFAULT true,
is_public BOOLEAN NOT NULL DEFAULT false,
is_active BOOLEAN NOT NULL DEFAULT true,
available_from TIMESTAMPTZ,
@ -306,6 +307,10 @@ COMMENT ON TABLE server.props IS 'Global prop library (64x64 pixels, center-anch
CREATE INDEX idx_server_props_tags ON server.props USING GIN (tags);
CREATE INDEX idx_server_props_active ON server.props (is_active) WHERE is_active = true;
CREATE INDEX idx_server_props_public ON server.props (is_public) WHERE is_public = true;
COMMENT ON COLUMN server.props.is_public IS
'When true, prop appears in the public Server inventory tab. Uses filtered index idx_server_props_public.';
-- =============================================================================
-- Audio Library

View file

@ -216,6 +216,7 @@ CREATE TABLE realm.props (
is_unique BOOLEAN NOT NULL DEFAULT false,
is_transferable BOOLEAN NOT NULL DEFAULT true,
is_droppable BOOLEAN NOT NULL DEFAULT true,
is_public BOOLEAN NOT NULL DEFAULT false,
is_active BOOLEAN NOT NULL DEFAULT true,
available_from TIMESTAMPTZ,
@ -242,6 +243,10 @@ COMMENT ON TABLE realm.props IS 'Realm-specific prop library';
CREATE INDEX idx_realm_props_realm ON realm.props (realm_id);
CREATE INDEX idx_realm_props_tags ON realm.props USING GIN (tags);
CREATE INDEX idx_realm_props_active ON realm.props (realm_id, is_active) WHERE is_active = true;
CREATE INDEX idx_realm_props_public ON realm.props (realm_id, is_public) WHERE is_public = true;
COMMENT ON COLUMN realm.props.is_public IS
'When true, prop appears in the public Realm inventory tab. Uses filtered index idx_realm_props_public.';
-- =============================================================================
-- Add Foreign Keys to auth tables (now that realm.realms and realm.props exist)