~cytrogen/vbhelper

ref: e9d2cce8024f3fd3bacb258c183c31f59d3f4b40 vbhelper/.claude/rules/database.md -rw-r--r-- 990 bytes
e9d2cce8 — Cytrogen Add UnifiedPush notification system with Ktor server a month ago

#Database Conventions

#Room

  • DAO interfaces go in database/daos/ package
  • New DAOs must be registered as abstract functions in AppDatabase
  • All DAO query functions must be suspend or return Flow
  • Entity classes go in database/ with @Entity annotation

#Repository Layer

  • Every DAO is wrapped by a Repository in source/ package
  • Repositories are the only way screens/controllers access the database
  • New repositories must be registered in AppContainer interface and DefaultAppContainer

#DataStore (Secrets)

  • Cryptographic secrets (AES keys, HMAC keys, device ciphers) use DataStore + Protobuf, not Room
  • Proto definitions are in app/src/main/proto/ — do not modify without understanding migration implications
  • User preferences (currency, settings) use DataStore Preferences

#Migrations

  • Room version bumps require a Migration object registered in the database builder
  • The items.db asset database must stay in sync with the Room schema