Adds workspace-scoped provider registry schema, relations, migration 0010, and seedDefaultRoleRoutes() for pipeline defaults when aliases exist. Co-authored-by: Cursor <cursoragent@cursor.com>
1.8 KiB
1.8 KiB
| kind | slug | title | plan_slug | epic_slug | status | priority | tenant_id | owner | cursor_todo_id | updated_at | agent_prompt |
|---|---|---|---|---|---|---|---|---|---|---|---|
| task | db-model-providers-migration | Drizzle schema and migration for model_providers and role_model_routes | automation-foundation | model-provider-registry | done | P1 | global | unassigned | null | 2026-07-03 | Read docs/adr-model-routing.md and packages/shared model-routing types from Task-shared-schemas-resolve-model. packages/database only. Generate migration with pnpm db:generate — do not hand-edit SQL. claim_task before work. |
Task summary
Add model_providers and role_model_routes tables with workspace scoping and indexes per the ADR.
Description
Schema (packages/database/src/schema/)
model_providers.ts— columns from ADR; unique(workspace_id, alias)role_model_routes.ts— FK tomodel_providers; unique(workspace_id, role_id)- Re-export from
schema/index.ts; add relations if needed
Migration
pnpm db:generatefrom repo root after schema edit- Commit generated SQL under
packages/database/migrations/
Optional seed helper
seedDefaultRoleRoutes(workspaceId)in database package or web server — inserts pipeline default role_ids pointing at aliases only if matching aliases exist (no auto-create of providers)
Subtasks
- Define Drizzle tables
- Generate and commit migration
- Verify
workspace_idindex on both tables
Estimation
S
Acceptance criteria
- Migration applies cleanly with
pnpm db:migrate - Every query example in epic doc filters by
workspace_id - Types align with
packages/sharedzod schemas
Links
- Epic:
./Epic-model-provider-registry.md - ADR:
../../../docs/adr-model-routing.md - Depends on:
Task-shared-schemas-resolve-model.md