feat(coord): DB migration — project-scoped missions, multi-tenant RBAC
All checks were successful
ci/woodpecker/push/ci Pipeline was successful

Closes #131

- Add userId, phase, milestones, config columns to missions table
- Add new mission_tasks table for coord-managed task tracking
- Both tables enforce per-user RBAC via userId foreign key
- Generate Drizzle migration (0001_magical_rattler.sql)
- Add userId-scoped query methods to brain missions repo
- Add new mission-tasks repo to brain package
- Extend CoordService with DB-backed mission and task CRUD
- Extend CoordController with DB-backed REST endpoints
- Preserve file-based coord endpoints for backwards compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 14:17:27 -05:00
parent 76abf11eba
commit fc305e8b72
10 changed files with 533 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"id": "a519a9b8-5882-4141-82e4-0b35be280738",
"prevId": "ed7dea23-55fa-4f92-9256-7809a1e637f1",
"id": "d1721c50-8da3-4cc5-9542-34d79f335541",
"prevId": "a519a9b8-5882-4141-82e4-0b35be280738",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -833,6 +833,184 @@
"checkConstraints": {},
"isRLSEnabled": false
},
"public.mission_tasks": {
"name": "mission_tasks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"mission_id": {
"name": "mission_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"task_id": {
"name": "task_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'not-started'"
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"notes": {
"name": "notes",
"type": "text",
"primaryKey": false,
"notNull": false
},
"pr": {
"name": "pr",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"mission_tasks_mission_id_idx": {
"name": "mission_tasks_mission_id_idx",
"columns": [
{
"expression": "mission_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"mission_tasks_task_id_idx": {
"name": "mission_tasks_task_id_idx",
"columns": [
{
"expression": "task_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"mission_tasks_user_id_idx": {
"name": "mission_tasks_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"mission_tasks_status_idx": {
"name": "mission_tasks_status_idx",
"columns": [
{
"expression": "status",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"mission_tasks_mission_id_missions_id_fk": {
"name": "mission_tasks_mission_id_missions_id_fk",
"tableFrom": "mission_tasks",
"tableTo": "missions",
"columnsFrom": [
"mission_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"mission_tasks_task_id_tasks_id_fk": {
"name": "mission_tasks_task_id_tasks_id_fk",
"tableFrom": "mission_tasks",
"tableTo": "tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"mission_tasks_user_id_users_id_fk": {
"name": "mission_tasks_user_id_users_id_fk",
"tableFrom": "mission_tasks",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.missions": {
"name": "missions",
"schema": "",
@@ -869,6 +1047,30 @@
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phase": {
"name": "phase",
"type": "text",
"primaryKey": false,
"notNull": false
},
"milestones": {
"name": "milestones",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"config": {
"name": "config",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"metadata": {
"name": "metadata",
"type": "jsonb",
@@ -905,6 +1107,21 @@
"concurrently": false,
"method": "btree",
"with": {}
},
"missions_user_id_idx": {
"name": "missions_user_id_idx",
"columns": [
{
"expression": "user_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
@@ -920,6 +1137,19 @@
],
"onDelete": "set null",
"onUpdate": "no action"
},
"missions_user_id_users_id_fk": {
"name": "missions_user_id_users_id_fk",
"tableFrom": "missions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -1705,6 +1935,25 @@
"notNull": true,
"default": "'member'"
},
"banned": {
"name": "banned",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": false
},
"ban_reason": {
"name": "ban_reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"ban_expires": {
"name": "ban_expires",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",

View File

@@ -8,6 +8,13 @@
"when": 1773368153122,
"tag": "0000_loud_ezekiel_stane",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1773602195609,
"tag": "0001_magical_rattler",
"breakpoints": true
}
]
}
}