Skip to content

Schema drift between schema.sql and migrations causing recurring papercuts #26

Description

@barrulus

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:

  1. schema.sql is regenerated from the live DB (or from the full migration chain) and becomes the single source of truth for new environments.
  2. 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.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions