Problem
There is meaningful drift between database/schema.sql, database/migrations/001_llm_dm_pivot.sql, and database/migrations/005_action_status_extension.sql. They disagree on:
- Status enums for
session_player_actions (different allowed values across files)
- Column names — e.g.
action_data vs action_payload
This is the underlying source of several recurring bugs we keep patching one-off (status mismatches, INSERTs targeting the wrong column, etc.). Each fix unblocks the immediate symptom but leaves the foot-gun in place for the next person.
Proposal
Consolidate the schema so that:
schema.sql is regenerated from the live DB (or from the full migration chain) and becomes the single source of truth for new environments.
- Migrations 001 and 005 are reconciled — pick one canonical column name (
action_data vs action_payload) and one canonical status enum, then add a migration that normalises any remaining drift.
- All server code (routes, services, interceptors) is audited to use the canonical names.
Related
Not urgent
Filed as a follow-up — not blocking current session work, but worth doing before the next round of action-pipeline changes so we stop paying the same tax.
Problem
There is meaningful drift between
database/schema.sql,database/migrations/001_llm_dm_pivot.sql, anddatabase/migrations/005_action_status_extension.sql. They disagree on:session_player_actions(different allowed values across files)action_datavsaction_payloadThis is the underlying source of several recurring bugs we keep patching one-off (status mismatches, INSERTs targeting the wrong column, etc.). Each fix unblocks the immediate symptom but leaves the foot-gun in place for the next person.
Proposal
Consolidate the schema so that:
schema.sqlis regenerated from the live DB (or from the full migration chain) and becomes the single source of truth for new environments.action_datavsaction_payload) and one canonical status enum, then add a migration that normalises any remaining drift.Related
Not urgent
Filed as a follow-up — not blocking current session work, but worth doing before the next round of action-pipeline changes so we stop paying the same tax.