Refactor: normalize column naming to camelCase on term-related tables #4
Labels
No labels
feature
multiplayer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: forgejo-lila/lila#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
Our Drizzle schema currently has inconsistent column naming conventions across tables:
user,session,account,verification), and the newerlobbies/lobby_playerstables.terms,term_glosses,translations,decks,deck_terms,topics,term_topics.The industry standard for TS/JS codebases is camelCase in application code, snake_case in SQL, converted at the ORM boundary. The Better Auth and lobby tables already follow this pattern. The term-related tables are the outlier.
Scope
Add explicit column aliases to the following tables so their TS property names are camelCase while the underlying SQL column names stay snake_case:
terms—source_id,created_atterm_glosses—term_id,language_code,created_attranslations—term_id,language_code,cefr_level,created_atdecks—source_language,validated_languages,created_atdeck_terms—deck_id,term_idterm_topics—term_id,topic_idtopics—created_atExample of the change pattern:
Files to update
packages/db/src/db/schema.ts— table definitions, relations, check constraints, unique constraints, indexespackages/db/src/models/termModel.ts— all property references (terms.sourcestays, butterm_glosses.term_id→termGlosses.termId, etc.)packages/db/src/seeding-cefr-levels.ts,seeding-datafiles.ts,generating-deck.ts,checking-cefr-coverage.ts— any property referencesscripts/that import from@lila/db/schemaNon-goals
pnpm --filter db generateto confirm it produces an empty migration.db.execute(sql...)) — those reference actual SQL column names, which are unchanged.Acceptance criteria
pnpm tscpasses across the monorepo.pnpm --filter db generateproduces no new migration.Why not now
This refactor is orthogonal to the current multiplayer slice. Bundling it in would inflate PR scope and obscure behavioral changes behind cosmetic ones. Deferring until the multiplayer work lands keeps the history bisectable.