949 B
949 B
@atomcms/db
Typed data-access layer over the emulator-owned MySQL database.
Hard rule: introspect-only
The database schema is owned and written live by the Habbo game emulator.
Never run drizzle-kit push, generate, or migrate against it. The only
allowed schema command is introspection:
DATABASE_URL=mysql://user:pass@host:3306/db pnpm --filter @atomcms/db db:pull
db:pull reads the live schema and writes a snapshot to ./drizzle. The
hand-authored files in src/schema/ cover only the tables the web tier needs
first (users, users_currency, bans, website_settings); regenerate the full
122-table set from the live DB with db:pull when you need more tables.
Usage
import { createDb, makeUsersRepo } from "@atomcms/db";
const { db, pool } = createDb(process.env.DATABASE_URL!);
const users = makeUsersRepo(db);
const sysacc = await users.findByUsername("Systemaccount");
await pool.end();