Skip to content

Conversation

@kronosapiens
Copy link
Collaborator

@kronosapiens kronosapiens commented Jan 27, 2026

Summary

  • Change primary keys from UUID to serial integers for simplicity
  • Simplify reactions table column names (message_author_idauthor_id, reactor_role_at_timereactor_role)
  • Remove role_history table and all related code (auditing feature not needed)
  • Rewrite initial migration for a clean slate

Net change: -142 lines

Database Migration Checklist

BREAKING CHANGE: This PR rewrites the initial migration schema.
The new schema is incompatible with the previous version.

Local Development

  • Drop all tables:

    psql daimyo -c "DROP TABLE IF EXISTS pgmigrations, content_drafts, content_pipeline_runs, content_stories, reactions, role_history CASCADE;"
  • Re-run migrations:

    cd backend
    pnpm migrate up

Railway Deployment

  • Drop all tables via Railway CLI:

    # Connect to your Railway PostgreSQL
    railway connect postgres
    
    # Then run:
    DROP TABLE IF EXISTS pgmigrations, content_drafts, content_pipeline_runs, content_stories, reactions, role_history CASCADE;

    Or via psql with DATABASE_URL:

    psql "$DATABASE_URL" -c "DROP TABLE IF EXISTS pgmigrations, content_drafts, content_pipeline_runs, content_stories, reactions, role_history CASCADE;"

    Or via Railway Dashboard:

    1. Go to your Railway project → PostgreSQL service
    2. Click "Data" tab → "Query"
    3. Run the DROP TABLE command
  • Trigger a redeploy (migrations run automatically on startup)

Verify Schema

# Check reactions table structure
psql <connection> -c "\d reactions"
# Should show: id (serial), message_id, author_id, reactor_id, reactor_role, timestamp

# Verify role_history is gone
psql <connection> -c "\dt"
# Should NOT include role_history

Test plan

  • Build passes (pnpm build)
  • All 67 tests pass (pnpm test)

🤖 Generated with Claude Code

- Change primary keys from UUID to serial integers
- Simplify reactions table columns:
  - message_author_id → author_id
  - reactor_role_at_time → reactor_role
- Remove role_history table and all related code (auditing not needed)
- Rewrite initial migration for clean slate

BREAKING CHANGE: Database schema incompatible with previous version.
Requires dropping and recreating tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kronosapiens kronosapiens merged commit e1c97f2 into main Jan 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants