chore: rename database table task_item -> plans#617
Merged
Conversation
Matches the Python PlanItem naming introduced in proposal #74, which had kept the DB table at its legacy "task_item" name to avoid a migration. Migration strategy: - New helper ensure_plans_table_name() renames the table (and its two indexes) if and only if legacy 'task_item' exists AND 'plans' does not. Wrapped in a Postgres transaction-level advisory lock so the three services (frontend_multi_user, worker_plan_database, mcp_cloud) cannot race on startup — whichever replica grabs the lock first does the rename; the others no-op. - Runs before db.create_all() so SQLAlchemy does not create a second empty 'plans' table alongside 'task_item'. - PlanItem.__tablename__ flipped from "task_item" to "plans". - All ALTER TABLE / CREATE INDEX / SELECT / UPDATE / VACUUM strings in the three services and admin routes now reference 'plans'. - Indexes renamed idx_task_item_* -> idx_plans_*. - Admin template wording and the _vacuum_task_item() helper renamed to _vacuum_plans(). - Log messages ("invalid UTF-8 in task_item.prompt...") updated. - docs/plan.md: drop the resolved "Rename table name" TODO. No zero-downtime guarantees: during a rolling deploy the still-running old replica will fail queries against the new name until it gets redeployed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Matches the PlanItem class name and the renamed plans table. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the "Rename table name" TODO from `docs/plan.md`. Matches the Python `PlanItem` naming introduced in proposal #74 (which kept the DB table at its legacy `task_item` name to avoid a migration).
Migration strategy
No zero-downtime guarantees: during a rolling deploy, a still-running old replica will fail queries against the new name until it gets redeployed. User confirmed this is fine (no users on Railway).
Test plan
🤖 Generated with Claude Code