add currency, outfits

This commit is contained in:
Devin Zuczek
2026-07-14 12:55:03 -04:00
parent 9d0d00992f
commit 505243844c
8 changed files with 455 additions and 30 deletions
+15
View File
@@ -0,0 +1,15 @@
-- Currency balances, owned by the `econ` worker. One row per (account, currency):
-- the amount is a real INTEGER column, not a JSON field, so the spend path can be a
-- single atomic `UPDATE ... WHERE amount >= ?` instead of a racy read-modify-write.
--
-- Only account-scoped currencies live here. RoomCurrency (300) / RoomInventoryItem
-- (301) are scoped to a room and belong to the room-currency endpoints — a row here
-- couldn't say which room it was for. Kept in sync with BALANCE_SCHEMA_DDL in
-- src/balance-db.ts.
CREATE TABLE IF NOT EXISTS balance (
account_id INTEGER NOT NULL,
currency_type INTEGER NOT NULL,
amount INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (account_id, currency_type)
);