molecule-core/workspace-server/migrations
claude-ceo-assistant 120b3a25aa feat(workspaces): update_tier column for canary vs production fan-out
Closes core#115 partial. Schema-only change; the apply-endpoint filter
logic that reads this column lands with core#123 (drift detector +
queue + apply endpoint, the deferred follow-up of core#113).

Default 'production' so existing customers (Reno-Stars + any future
tenant) are default-safe. Synthetic dogfooding workspaces opt INTO
'canary' explicitly.

CHECK constraint pins the closed value set ('canary' | 'production') —
the apply endpoint's filter relies on the database to reject anything
else, so a future operator typo in PATCH /workspaces/:id ({update_tier:
'canery'}) returns a constraint violation, not silent fan-out to
nobody.

Partial index on canary rows since the apply-endpoint query path
('apply this update only to canary tier first') hits canary much more
often than production, and the production set is the much larger
default.

WHAT THIS DOES NOT DO (lands with core#123)
  - PATCH endpoint to flip a workspace to canary
  - The apply endpoint that consults the column
  - Tests that exercise canary-vs-production fan-out

Schema-only foundation; same pattern as core#113 (workspace_plugins).

PHASE 4 SELF-REVIEW
  Correctness: No finding — IF NOT EXISTS guards, DEFAULT clause means
    existing rows get 'production' on migration apply.
  Readability: No finding — comment block documents the tier semantics
    + the deferral to core#123.
  Architecture: No finding — additive ALTER, partial index for the
    expected access pattern.
  Security: No finding — no code path; column constraint reduces blast
    radius of bad PATCH input.
  Performance: No finding — partial index minimizes write amplification
    on the production-default rows.

REFS
  core#115 — this issue
  core#123 — apply endpoint follow-up (will exercise this column)
  core#113 — version subscription DB foundation (sibling pattern)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 08:55:19 -07:00
..
001_workspaces.sql
002_agents.sql
003_events.sql
004_secrets.sql
005_canvas_layouts.sql
006_workspace_config_memory.sql
007_approvals.sql
008_agent_memories.sql
009_activity_logs.sql
010_workspace_awareness.sql
011_workspace_runtime.sql
012_global_secrets.sql
013_workspace_dir.sql
014_indexes.sql
015_workspace_schedules.sql
016_workspace_channels.sql
017_memories_fts_namespace.down.sql
017_memories_fts_namespace.up.sql
018_secrets_encryption_version.down.sql
018_secrets_encryption_version.up.sql
019_workspace_access.down.sql
019_workspace_access.up.sql
020_workspace_auth_tokens.down.sql
020_workspace_auth_tokens.up.sql
021_delegation_idempotency.down.sql
021_delegation_idempotency.up.sql
022_workspace_schedules_source.down.sql
022_workspace_schedules_source.up.sql
023_workspace_memory_version.down.sql
023_workspace_memory_version.up.sql
024_channel_budget.down.sql
024_channel_budget.up.sql
025_workspace_token_usage.down.sql
025_workspace_token_usage.up.sql
026_org_plugin_allowlist.down.sql
026_org_plugin_allowlist.up.sql
027_workspace_budget.down.sql
027_workspace_budget.up.sql
028_workspace_artifacts.down.sql
028_workspace_artifacts.up.sql
029_workspace_hibernation.down.sql
029_workspace_hibernation.up.sql
030_audit_events.down.sql
030_audit_events.up.sql
031_memories_pgvector.down.sql
031_memories_pgvector.up.sql
032_schedule_consecutive_empty.down.sql
032_schedule_consecutive_empty.up.sql
033_strip_crlf_cron_prompts.up.sql
034_workspaces_last_outbound_at.up.sql
035_org_api_tokens.down.sql
035_org_api_tokens.up.sql
036_org_api_tokens_org_id.down.sql
036_org_api_tokens_org_id.up.sql
037_max_concurrent_tasks.down.sql
037_max_concurrent_tasks.up.sql
038_workspace_instance_id.down.sql
038_workspace_instance_id.up.sql
039_activity_tool_trace.down.sql
039_activity_tool_trace.up.sql
040_platform_instructions.down.sql
040_platform_instructions.up.sql
042_a2a_queue.down.sql
042_a2a_queue.up.sql
043_workspace_status_enum.down.sql
043_workspace_status_enum.up.sql
044_platform_inbound_secret.down.sql
044_platform_inbound_secret.up.sql
045_workspaces_delivery_mode.down.sql
045_workspaces_delivery_mode.up.sql
046_workspace_status_awaiting_agent.down.sql fix(workspaces): add missing 'awaiting_agent' + 'hibernating' to workspace_status enum 2026-04-30 08:52:05 -07:00
046_workspace_status_awaiting_agent.up.sql fix(workspaces): add missing 'awaiting_agent' + 'hibernating' to workspace_status enum 2026-04-30 08:52:05 -07:00
047_runtime_image_pins.down.sql feat(provisioner): digest-pin workspace images via runtime_image_pins (#2272 layer 1) 2026-05-03 02:30:00 -07:00
047_runtime_image_pins.up.sql feat(provisioner): digest-pin workspace images via runtime_image_pins (#2272 layer 1) 2026-05-03 02:30:00 -07:00
048_activity_logs_peer_indexes.down.sql feat(db): add per-peer btree indexes on activity_logs for chat_history scale (#2478) 2026-05-03 11:34:35 -07:00
048_activity_logs_peer_indexes.up.sql feat(db): add per-peer btree indexes on activity_logs for chat_history scale (#2478) 2026-05-03 11:34:35 -07:00
049_delegations.down.sql feat(delegations): durable per-task ledger + audit-write helper (RFC #2829 PR-1) 2026-05-04 20:43:06 -07:00
049_delegations.up.sql feat(delegations): durable per-task ledger + audit-write helper (RFC #2829 PR-1) 2026-05-04 20:43:06 -07:00
20260417000000_workflow_checkpoints.down.sql
20260417000000_workflow_checkpoints.up.sql
20260505100000_pending_uploads.down.sql feat(rfc): poll-mode chat upload — phase 1 platform staging layer 2026-05-05 04:22:24 -07:00
20260505100000_pending_uploads.up.sql feat(rfc): poll-mode chat upload — phase 1 platform staging layer 2026-05-05 04:22:24 -07:00
20260505200000_pending_uploads_acked_index.down.sql feat(poll-upload): phase 5a — atomic batch insert + acked-index + mime hardening 2026-05-05 11:10:13 -07:00
20260505200000_pending_uploads_acked_index.up.sql feat(poll-upload): phase 5a — atomic batch insert + acked-index + mime hardening 2026-05-05 11:10:13 -07:00
20260506000000_workspaces_unique_parent_name.down.sql fix(workspace-server): close TOCTOU race on workspaces(parent_id, name) (#2872 Critical 1) 2026-05-05 21:43:49 -07:00
20260506000000_workspaces_unique_parent_name.up.sql fix(workspace-server): close TOCTOU race on workspaces(parent_id, name) (#2872 Critical 1) 2026-05-05 21:43:49 -07:00
20260508160000_workspace_plugins_tracking.down.sql feat(plugins): workspace_plugins tracking table — version-subscription foundation 2026-05-08 08:52:35 -07:00
20260508160000_workspace_plugins_tracking.up.sql feat(plugins): workspace_plugins tracking table — version-subscription foundation 2026-05-08 08:52:35 -07:00
20260508170000_workspaces_update_tier.down.sql feat(workspaces): update_tier column for canary vs production fan-out 2026-05-08 08:55:19 -07:00
20260508170000_workspaces_update_tier.up.sql feat(workspaces): update_tier column for canary vs production fan-out 2026-05-08 08:55:19 -07:00