Database Schema Convention
Schema Source of Truth
Each module manages its own database schema under:
{module}/db/schema/{NN-category}/Current Module Schema Directories
| Module | Path | Description |
|---|---|---|
| slaunchx-app-prometheus | slaunchx-app-prometheus/db/schema/ | Main application (13 categories, 47 tables) |
| slaunchx-support-solana-wallet | slaunchx-support-solana-wallet/db/schema/ | Solana wallet tables |
| slaunchx-support-tron-wallet | slaunchx-support-tron-wallet/db/schema/ | Tron wallet tables |
Category Numbering (slaunchx-app-prometheus)
| Number | Category | Tables |
|---|---|---|
| 01 | api-auth | API authentication |
| 03 | integrations-slash | Slash connection + webhook |
| 04 | sandbox | Sandbox data |
| 05 | notifications | Notification channels |
| 06 | transfers | Transfer orders + tariffs |
| 07 | institutions | Institution management |
| 08 | user-accounts | User accounts + OTP |
| 09 | user-sessions | Session management |
| 10 | user-permissions | Permission + roles |
| 11 | workspaces | Workspace + invitations |
| 12 | wallets | Wallet accounts + ledger |
| 13 | billing | Recharge/withdrawal/exchange/settlement |
| 14 | file-storage | File record management |
Schema File Format
Each .sql file:
- One CREATE TABLE per file
- Use CREATE TABLE IF NOT EXISTS for idempotent manual initialization
- Include all indexes and constraints inline
- File named after the table:
recharge_channel.sql
Build Pipeline
- Python script generates jOOQ persistence code from all schema files:
db/scripts/generate-jooq.py - Output: generated persistence classes under
src/main/java/com/slaunchx/core/persistence/generated/ - Schema changes require regeneration and atomic commit
Rules for Agents
- New table: create .sql in the appropriate numbered category directory
- New category: create new numbered directory (next available number)
- Schema changes: modify the source .sql file and add a matching changelog entry for ops
- Never edit: generated persistence code under
persistence/generated/(auto-generated) - Test DB: uses schema source files, no separate test schema needed
- Cross-module: each module is independent, no cross-module schema references