ubiquitous-invention/plans/Plan-multitenant-cursor-sync/Epic-cursor-sync-layer/Task-mapping-model-and-migration.md

50 lines
1.1 KiB
Markdown
Raw Normal View History

---
kind: task
slug: mapping-model-and-migration
title: Add DB tables for Cursor mapping (tenant-scoped)
plan_slug: multitenant-cursor-sync
epic_slug: cursor-sync-layer
status: ready
priority: P0
tenant_id: global
owner: unassigned
cursor_todo_id: null
updated_at: "2026-04-26"
---
# Task summary
Introduce Drizzle schema + migration for **cursor_sync_mappings** (name indicative) keyed by tenant and internal entity ids.
## Description
Columns (logical): `tenant_id`, `entity_kind` (`plan`|`epic`|`task`), `entity_id`, `cursor_plan_id`, `cursor_item_id`, `repo_path`, `last_pushed_at`, `last_pulled_at`, `content_hash`.
## Subtasks
- [ ] Schema in `packages/database`
- [ ] Migration under `packages/database/migrations`
- [ ] tRPC procedures restricted to workspace/tenant members
## Owner or assignee
Unassigned
## Status
ready
## Estimation
M
## Acceptance criteria
- [ ] Migration applies cleanly on empty DB.
- [ ] No mapping row without `tenant_id`.
## Links to related Epic / Plan
- Epic: `./Epic-cursor-sync-layer.md`
- Plan: `../Plan-multitenant-cursor-sync.md`