Add userDismissedAt field to agents schema

This commit is contained in:
Lukas May
2026-02-07 00:33:12 +01:00
parent 111ed0962f
commit 2877484012
224 changed files with 30873 additions and 4672 deletions

View File

@@ -0,0 +1,8 @@
CREATE TABLE `phase_dependencies` (
`id` text PRIMARY KEY NOT NULL,
`phase_id` text NOT NULL,
`depends_on_phase_id` text NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`phase_id`) REFERENCES `phases`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`depends_on_phase_id`) REFERENCES `phases`(`id`) ON UPDATE no action ON DELETE cascade
);

View File

@@ -0,0 +1,12 @@
CREATE TABLE `pages` (
`id` text PRIMARY KEY NOT NULL,
`initiative_id` text NOT NULL,
`parent_page_id` text,
`title` text NOT NULL,
`content` text,
`sort_order` integer DEFAULT 0 NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`initiative_id`) REFERENCES `initiatives`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`parent_page_id`) REFERENCES `pages`(`id`) ON UPDATE no action ON DELETE cascade
);

View File

@@ -0,0 +1,20 @@
CREATE TABLE `projects` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`url` text NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `projects_name_unique` ON `projects` (`name`);--> statement-breakpoint
CREATE UNIQUE INDEX `projects_url_unique` ON `projects` (`url`);--> statement-breakpoint
CREATE TABLE `initiative_projects` (
`id` text PRIMARY KEY NOT NULL,
`initiative_id` text NOT NULL,
`project_id` text NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`initiative_id`) REFERENCES `initiatives`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `initiative_project_unique` ON `initiative_projects` (`initiative_id`,`project_id`);

View File

@@ -0,0 +1,15 @@
CREATE TABLE `accounts` (
`id` text PRIMARY KEY NOT NULL,
`email` text NOT NULL,
`provider` text DEFAULT 'claude' NOT NULL,
`config_dir` text NOT NULL,
`is_exhausted` integer DEFAULT false NOT NULL,
`exhausted_until` integer,
`last_used_at` integer,
`sort_order` integer DEFAULT 0 NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL
);
--> statement-breakpoint
ALTER TABLE `agents` ADD `provider` text DEFAULT 'claude' NOT NULL;--> statement-breakpoint
ALTER TABLE `agents` ADD `account_id` text REFERENCES accounts(id);

View File

@@ -0,0 +1,4 @@
ALTER TABLE `agents` ADD `pid` integer;--> statement-breakpoint
ALTER TABLE `agents` ADD `output_file_path` text;--> statement-breakpoint
ALTER TABLE `agents` ADD `result` text;--> statement-breakpoint
ALTER TABLE `agents` ADD `pending_questions` text;

View File

@@ -0,0 +1 @@
ALTER TABLE `agents` ADD `initiative_id` text REFERENCES initiatives(id);

View File

@@ -0,0 +1,27 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_tasks` (
`id` text PRIMARY KEY NOT NULL,
`plan_id` text,
`phase_id` text,
`initiative_id` text,
`name` text NOT NULL,
`description` text,
`type` text DEFAULT 'auto' NOT NULL,
`category` text DEFAULT 'execute' NOT NULL,
`priority` text DEFAULT 'medium' NOT NULL,
`status` text DEFAULT 'pending' NOT NULL,
`requires_approval` integer,
`order` integer DEFAULT 0 NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`plan_id`) REFERENCES `plans`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`phase_id`) REFERENCES `phases`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`initiative_id`) REFERENCES `initiatives`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
INSERT INTO `__new_tasks`("id", "plan_id", "phase_id", "initiative_id", "name", "description", "type", "category", "priority", "status", "requires_approval", "order", "created_at", "updated_at") SELECT "id", "plan_id", NULL, NULL, "name", "description", "type", 'execute', "priority", "status", NULL, "order", "created_at", "updated_at" FROM `tasks`;--> statement-breakpoint
DROP TABLE `tasks`;--> statement-breakpoint
ALTER TABLE `__new_tasks` RENAME TO `tasks`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
ALTER TABLE `initiatives` ADD `merge_requires_approval` integer DEFAULT true NOT NULL;--> statement-breakpoint
ALTER TABLE `initiatives` ADD `merge_target` text;

View File

@@ -0,0 +1,61 @@
-- Migration: Eliminate plans table
-- Plans are now decompose tasks with parentTaskId for child relationships
PRAGMA foreign_keys=OFF;--> statement-breakpoint
-- Step 1: Create new tasks table with parent_task_id instead of plan_id
CREATE TABLE `__new_tasks` (
`id` text PRIMARY KEY NOT NULL,
`phase_id` text,
`initiative_id` text,
`parent_task_id` text,
`name` text NOT NULL,
`description` text,
`type` text DEFAULT 'auto' NOT NULL,
`category` text DEFAULT 'execute' NOT NULL,
`priority` text DEFAULT 'medium' NOT NULL,
`status` text DEFAULT 'pending' NOT NULL,
`requires_approval` integer,
`order` integer DEFAULT 0 NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`phase_id`) REFERENCES `phases`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`initiative_id`) REFERENCES `initiatives`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`parent_task_id`) REFERENCES `__new_tasks`(`id`) ON UPDATE no action ON DELETE cascade
);--> statement-breakpoint
-- Step 2: Insert plans as decompose tasks FIRST (so plan IDs exist as task IDs for foreign key)
INSERT INTO `__new_tasks`("id", "phase_id", "initiative_id", "parent_task_id", "name", "description", "type", "category", "priority", "status", "requires_approval", "order", "created_at", "updated_at")
SELECT
"id",
"phase_id",
NULL,
NULL,
"name",
"description",
'auto',
'decompose',
'medium',
CASE
WHEN "status" = 'completed' THEN 'completed'
WHEN "status" = 'in_progress' THEN 'in_progress'
ELSE 'pending'
END,
NULL,
"number",
"created_at",
"updated_at"
FROM `plans`;--> statement-breakpoint
-- Step 3: Copy existing tasks, converting plan_id to parent_task_id
INSERT INTO `__new_tasks`("id", "phase_id", "initiative_id", "parent_task_id", "name", "description", "type", "category", "priority", "status", "requires_approval", "order", "created_at", "updated_at")
SELECT "id", "phase_id", "initiative_id", "plan_id", "name", "description", "type", "category", "priority", "status", "requires_approval", "order", "created_at", "updated_at" FROM `tasks`;--> statement-breakpoint
-- Step 4: Drop old tasks table and rename new one
DROP TABLE `tasks`;--> statement-breakpoint
ALTER TABLE `__new_tasks` RENAME TO `tasks`;--> statement-breakpoint
-- Step 5: Drop plans table
DROP TABLE `plans`;--> statement-breakpoint
PRAGMA foreign_keys=ON;

View File

@@ -0,0 +1,4 @@
-- Migration: Remove config_dir column from accounts table
-- Path is now convention-based: <workspaceRoot>/.cw/accounts/<accountId>/
ALTER TABLE `accounts` DROP COLUMN `config_dir`;

View File

@@ -0,0 +1,5 @@
-- Migration: Add config_json and credentials columns to accounts table
-- Credentials are now stored in DB and written to disk before spawning agents.
ALTER TABLE `accounts` ADD COLUMN `config_json` text;--> statement-breakpoint
ALTER TABLE `accounts` ADD COLUMN `credentials` text;

View File

@@ -0,0 +1,4 @@
-- Migration: Remove unused description column from initiatives table
-- Content is stored in pages (markdown via Tiptap editor), not in the initiative itself.
ALTER TABLE `initiatives` DROP COLUMN `description`;

View File

@@ -0,0 +1 @@
ALTER TABLE `agents` ADD `user_dismissed_at` integer;

View File

@@ -0,0 +1,695 @@
{
"version": "6",
"dialect": "sqlite",
"id": "43bf93b7-da71-4b69-b289-2991b6e54a69",
"prevId": "d2fc5ac9-8232-401a-a55f-a97a4d9b6f21",
"tables": {
"agents": {
"name": "agents",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"task_id": {
"name": "task_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"session_id": {
"name": "session_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"worktree_id": {
"name": "worktree_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'idle'"
},
"mode": {
"name": "mode",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'execute'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"agents_name_unique": {
"name": "agents_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {
"agents_task_id_tasks_id_fk": {
"name": "agents_task_id_tasks_id_fk",
"tableFrom": "agents",
"tableTo": "tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"initiatives": {
"name": "initiatives",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"messages": {
"name": "messages",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"sender_type": {
"name": "sender_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"sender_id": {
"name": "sender_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"recipient_type": {
"name": "recipient_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"recipient_id": {
"name": "recipient_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'info'"
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"requires_response": {
"name": "requires_response",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"parent_message_id": {
"name": "parent_message_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"messages_sender_id_agents_id_fk": {
"name": "messages_sender_id_agents_id_fk",
"tableFrom": "messages",
"tableTo": "agents",
"columnsFrom": [
"sender_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"messages_recipient_id_agents_id_fk": {
"name": "messages_recipient_id_agents_id_fk",
"tableFrom": "messages",
"tableTo": "agents",
"columnsFrom": [
"recipient_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"messages_parent_message_id_messages_id_fk": {
"name": "messages_parent_message_id_messages_id_fk",
"tableFrom": "messages",
"tableTo": "messages",
"columnsFrom": [
"parent_message_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"phase_dependencies": {
"name": "phase_dependencies",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"phase_id": {
"name": "phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"depends_on_phase_id": {
"name": "depends_on_phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"phase_dependencies_phase_id_phases_id_fk": {
"name": "phase_dependencies_phase_id_phases_id_fk",
"tableFrom": "phase_dependencies",
"tableTo": "phases",
"columnsFrom": [
"phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"phase_dependencies_depends_on_phase_id_phases_id_fk": {
"name": "phase_dependencies_depends_on_phase_id_phases_id_fk",
"tableFrom": "phase_dependencies",
"tableTo": "phases",
"columnsFrom": [
"depends_on_phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"phases": {
"name": "phases",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"initiative_id": {
"name": "initiative_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"number": {
"name": "number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"phases_initiative_id_initiatives_id_fk": {
"name": "phases_initiative_id_initiatives_id_fk",
"tableFrom": "phases",
"tableTo": "initiatives",
"columnsFrom": [
"initiative_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"plans": {
"name": "plans",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"phase_id": {
"name": "phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"number": {
"name": "number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"plans_phase_id_phases_id_fk": {
"name": "plans_phase_id_phases_id_fk",
"tableFrom": "plans",
"tableTo": "phases",
"columnsFrom": [
"phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"task_dependencies": {
"name": "task_dependencies",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"task_id": {
"name": "task_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"depends_on_task_id": {
"name": "depends_on_task_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"task_dependencies_task_id_tasks_id_fk": {
"name": "task_dependencies_task_id_tasks_id_fk",
"tableFrom": "task_dependencies",
"tableTo": "tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"task_dependencies_depends_on_task_id_tasks_id_fk": {
"name": "task_dependencies_depends_on_task_id_tasks_id_fk",
"tableFrom": "task_dependencies",
"tableTo": "tasks",
"columnsFrom": [
"depends_on_task_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"tasks": {
"name": "tasks",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"plan_id": {
"name": "plan_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'auto'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'medium'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"order": {
"name": "order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"tasks_plan_id_plans_id_fk": {
"name": "tasks_plan_id_plans_id_fk",
"tableFrom": "tasks",
"tableTo": "plans",
"columnsFrom": [
"plan_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View File

@@ -0,0 +1,789 @@
{
"version": "6",
"dialect": "sqlite",
"id": "cd4eb2e6-af83-473e-a189-8480d217b3c8",
"prevId": "43bf93b7-da71-4b69-b289-2991b6e54a69",
"tables": {
"agents": {
"name": "agents",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"task_id": {
"name": "task_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"session_id": {
"name": "session_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"worktree_id": {
"name": "worktree_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'idle'"
},
"mode": {
"name": "mode",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'execute'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"agents_name_unique": {
"name": "agents_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {
"agents_task_id_tasks_id_fk": {
"name": "agents_task_id_tasks_id_fk",
"tableFrom": "agents",
"tableTo": "tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"initiatives": {
"name": "initiatives",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"messages": {
"name": "messages",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"sender_type": {
"name": "sender_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"sender_id": {
"name": "sender_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"recipient_type": {
"name": "recipient_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"recipient_id": {
"name": "recipient_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'info'"
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"requires_response": {
"name": "requires_response",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"parent_message_id": {
"name": "parent_message_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"messages_sender_id_agents_id_fk": {
"name": "messages_sender_id_agents_id_fk",
"tableFrom": "messages",
"tableTo": "agents",
"columnsFrom": [
"sender_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"messages_recipient_id_agents_id_fk": {
"name": "messages_recipient_id_agents_id_fk",
"tableFrom": "messages",
"tableTo": "agents",
"columnsFrom": [
"recipient_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"messages_parent_message_id_messages_id_fk": {
"name": "messages_parent_message_id_messages_id_fk",
"tableFrom": "messages",
"tableTo": "messages",
"columnsFrom": [
"parent_message_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"pages": {
"name": "pages",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"initiative_id": {
"name": "initiative_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"parent_page_id": {
"name": "parent_page_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"pages_initiative_id_initiatives_id_fk": {
"name": "pages_initiative_id_initiatives_id_fk",
"tableFrom": "pages",
"tableTo": "initiatives",
"columnsFrom": [
"initiative_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pages_parent_page_id_pages_id_fk": {
"name": "pages_parent_page_id_pages_id_fk",
"tableFrom": "pages",
"tableTo": "pages",
"columnsFrom": [
"parent_page_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"phase_dependencies": {
"name": "phase_dependencies",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"phase_id": {
"name": "phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"depends_on_phase_id": {
"name": "depends_on_phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"phase_dependencies_phase_id_phases_id_fk": {
"name": "phase_dependencies_phase_id_phases_id_fk",
"tableFrom": "phase_dependencies",
"tableTo": "phases",
"columnsFrom": [
"phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"phase_dependencies_depends_on_phase_id_phases_id_fk": {
"name": "phase_dependencies_depends_on_phase_id_phases_id_fk",
"tableFrom": "phase_dependencies",
"tableTo": "phases",
"columnsFrom": [
"depends_on_phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"phases": {
"name": "phases",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"initiative_id": {
"name": "initiative_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"number": {
"name": "number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"phases_initiative_id_initiatives_id_fk": {
"name": "phases_initiative_id_initiatives_id_fk",
"tableFrom": "phases",
"tableTo": "initiatives",
"columnsFrom": [
"initiative_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"plans": {
"name": "plans",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"phase_id": {
"name": "phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"number": {
"name": "number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"plans_phase_id_phases_id_fk": {
"name": "plans_phase_id_phases_id_fk",
"tableFrom": "plans",
"tableTo": "phases",
"columnsFrom": [
"phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"task_dependencies": {
"name": "task_dependencies",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"task_id": {
"name": "task_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"depends_on_task_id": {
"name": "depends_on_task_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"task_dependencies_task_id_tasks_id_fk": {
"name": "task_dependencies_task_id_tasks_id_fk",
"tableFrom": "task_dependencies",
"tableTo": "tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"task_dependencies_depends_on_task_id_tasks_id_fk": {
"name": "task_dependencies_depends_on_task_id_tasks_id_fk",
"tableFrom": "task_dependencies",
"tableTo": "tasks",
"columnsFrom": [
"depends_on_task_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"tasks": {
"name": "tasks",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"plan_id": {
"name": "plan_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'auto'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'medium'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"order": {
"name": "order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"tasks_plan_id_plans_id_fk": {
"name": "tasks_plan_id_plans_id_fk",
"tableFrom": "tasks",
"tableTo": "plans",
"columnsFrom": [
"plan_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View File

@@ -0,0 +1,923 @@
{
"version": "6",
"dialect": "sqlite",
"id": "0750ece4-b483-4fb3-8c64-3fbbc13b041d",
"prevId": "cd4eb2e6-af83-473e-a189-8480d217b3c8",
"tables": {
"agents": {
"name": "agents",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"task_id": {
"name": "task_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"session_id": {
"name": "session_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"worktree_id": {
"name": "worktree_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'idle'"
},
"mode": {
"name": "mode",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'execute'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"agents_name_unique": {
"name": "agents_name_unique",
"columns": [
"name"
],
"isUnique": true
}
},
"foreignKeys": {
"agents_task_id_tasks_id_fk": {
"name": "agents_task_id_tasks_id_fk",
"tableFrom": "agents",
"tableTo": "tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"initiative_projects": {
"name": "initiative_projects",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"initiative_id": {
"name": "initiative_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"project_id": {
"name": "project_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"initiative_project_unique": {
"name": "initiative_project_unique",
"columns": [
"initiative_id",
"project_id"
],
"isUnique": true
}
},
"foreignKeys": {
"initiative_projects_initiative_id_initiatives_id_fk": {
"name": "initiative_projects_initiative_id_initiatives_id_fk",
"tableFrom": "initiative_projects",
"tableTo": "initiatives",
"columnsFrom": [
"initiative_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"initiative_projects_project_id_projects_id_fk": {
"name": "initiative_projects_project_id_projects_id_fk",
"tableFrom": "initiative_projects",
"tableTo": "projects",
"columnsFrom": [
"project_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"initiatives": {
"name": "initiatives",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'active'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"messages": {
"name": "messages",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"sender_type": {
"name": "sender_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"sender_id": {
"name": "sender_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"recipient_type": {
"name": "recipient_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"recipient_id": {
"name": "recipient_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'info'"
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"requires_response": {
"name": "requires_response",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"parent_message_id": {
"name": "parent_message_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"messages_sender_id_agents_id_fk": {
"name": "messages_sender_id_agents_id_fk",
"tableFrom": "messages",
"tableTo": "agents",
"columnsFrom": [
"sender_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"messages_recipient_id_agents_id_fk": {
"name": "messages_recipient_id_agents_id_fk",
"tableFrom": "messages",
"tableTo": "agents",
"columnsFrom": [
"recipient_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"messages_parent_message_id_messages_id_fk": {
"name": "messages_parent_message_id_messages_id_fk",
"tableFrom": "messages",
"tableTo": "messages",
"columnsFrom": [
"parent_message_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"pages": {
"name": "pages",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"initiative_id": {
"name": "initiative_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"parent_page_id": {
"name": "parent_page_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"sort_order": {
"name": "sort_order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"pages_initiative_id_initiatives_id_fk": {
"name": "pages_initiative_id_initiatives_id_fk",
"tableFrom": "pages",
"tableTo": "initiatives",
"columnsFrom": [
"initiative_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"pages_parent_page_id_pages_id_fk": {
"name": "pages_parent_page_id_pages_id_fk",
"tableFrom": "pages",
"tableTo": "pages",
"columnsFrom": [
"parent_page_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"phase_dependencies": {
"name": "phase_dependencies",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"phase_id": {
"name": "phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"depends_on_phase_id": {
"name": "depends_on_phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"phase_dependencies_phase_id_phases_id_fk": {
"name": "phase_dependencies_phase_id_phases_id_fk",
"tableFrom": "phase_dependencies",
"tableTo": "phases",
"columnsFrom": [
"phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"phase_dependencies_depends_on_phase_id_phases_id_fk": {
"name": "phase_dependencies_depends_on_phase_id_phases_id_fk",
"tableFrom": "phase_dependencies",
"tableTo": "phases",
"columnsFrom": [
"depends_on_phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"phases": {
"name": "phases",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"initiative_id": {
"name": "initiative_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"number": {
"name": "number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"phases_initiative_id_initiatives_id_fk": {
"name": "phases_initiative_id_initiatives_id_fk",
"tableFrom": "phases",
"tableTo": "initiatives",
"columnsFrom": [
"initiative_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"plans": {
"name": "plans",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"phase_id": {
"name": "phase_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"number": {
"name": "number",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"plans_phase_id_phases_id_fk": {
"name": "plans_phase_id_phases_id_fk",
"tableFrom": "plans",
"tableTo": "phases",
"columnsFrom": [
"phase_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"projects": {
"name": "projects",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"projects_name_unique": {
"name": "projects_name_unique",
"columns": [
"name"
],
"isUnique": true
},
"projects_url_unique": {
"name": "projects_url_unique",
"columns": [
"url"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"task_dependencies": {
"name": "task_dependencies",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"task_id": {
"name": "task_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"depends_on_task_id": {
"name": "depends_on_task_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"task_dependencies_task_id_tasks_id_fk": {
"name": "task_dependencies_task_id_tasks_id_fk",
"tableFrom": "task_dependencies",
"tableTo": "tasks",
"columnsFrom": [
"task_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"task_dependencies_depends_on_task_id_tasks_id_fk": {
"name": "task_dependencies_depends_on_task_id_tasks_id_fk",
"tableFrom": "task_dependencies",
"tableTo": "tasks",
"columnsFrom": [
"depends_on_task_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"tasks": {
"name": "tasks",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"plan_id": {
"name": "plan_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"type": {
"name": "type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'auto'"
},
"priority": {
"name": "priority",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'medium'"
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'pending'"
},
"order": {
"name": "order",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"tasks_plan_id_plans_id_fk": {
"name": "tasks_plan_id_plans_id_fk",
"tableFrom": "tasks",
"tableTo": "plans",
"columnsFrom": [
"plan_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,90 @@
"when": 1769882826521,
"tag": "0000_bizarre_naoko",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
"when": 1770236400939,
"tag": "0001_overrated_gladiator",
"breakpoints": true
},
{
"idx": 2,
"version": "6",
"when": 1770283755529,
"tag": "0002_bumpy_killraven",
"breakpoints": true
},
{
"idx": 3,
"version": "6",
"when": 1770310029604,
"tag": "0003_curly_ser_duncan",
"breakpoints": true
},
{
"idx": 4,
"version": "6",
"when": 1770311913089,
"tag": "0004_white_captain_britain",
"breakpoints": true
},
{
"idx": 5,
"version": "6",
"when": 1770314201607,
"tag": "0005_blushing_wendell_vaughn",
"breakpoints": true
},
{
"idx": 6,
"version": "6",
"when": 1770317104950,
"tag": "0006_curvy_sandman",
"breakpoints": true
},
{
"idx": 7,
"version": "6",
"when": 1770373854589,
"tag": "0007_robust_the_watchers",
"breakpoints": true
},
{
"idx": 8,
"version": "6",
"when": 1770460800000,
"tag": "0008_eliminate_plans_table",
"breakpoints": true
},
{
"idx": 9,
"version": "6",
"when": 1770508800000,
"tag": "0009_drop_account_config_dir",
"breakpoints": true
},
{
"idx": 10,
"version": "6",
"when": 1770512400000,
"tag": "0010_add_account_credentials",
"breakpoints": true
},
{
"idx": 11,
"version": "6",
"when": 1770595200000,
"tag": "0011_drop_initiative_description",
"breakpoints": true
},
{
"idx": 12,
"version": "6",
"when": 1770420629437,
"tag": "0012_add_agent_user_dismissed_at",
"breakpoints": true
}
]
}

102
drizzle/relations.ts Normal file
View File

@@ -0,0 +1,102 @@
import { relations } from "drizzle-orm/relations";
import { tasks, agents, messages, initiatives, phases, plans, taskDependencies, phaseDependencies } from "./schema";
export const agentsRelations = relations(agents, ({one, many}) => ({
task: one(tasks, {
fields: [agents.taskId],
references: [tasks.id]
}),
messages_recipientId: many(messages, {
relationName: "messages_recipientId_agents_id"
}),
messages_senderId: many(messages, {
relationName: "messages_senderId_agents_id"
}),
}));
export const tasksRelations = relations(tasks, ({one, many}) => ({
agents: many(agents),
taskDependencies_dependsOnTaskId: many(taskDependencies, {
relationName: "taskDependencies_dependsOnTaskId_tasks_id"
}),
taskDependencies_taskId: many(taskDependencies, {
relationName: "taskDependencies_taskId_tasks_id"
}),
plan: one(plans, {
fields: [tasks.planId],
references: [plans.id]
}),
}));
export const messagesRelations = relations(messages, ({one, many}) => ({
message: one(messages, {
fields: [messages.parentMessageId],
references: [messages.id],
relationName: "messages_parentMessageId_messages_id"
}),
messages: many(messages, {
relationName: "messages_parentMessageId_messages_id"
}),
agent_recipientId: one(agents, {
fields: [messages.recipientId],
references: [agents.id],
relationName: "messages_recipientId_agents_id"
}),
agent_senderId: one(agents, {
fields: [messages.senderId],
references: [agents.id],
relationName: "messages_senderId_agents_id"
}),
}));
export const phasesRelations = relations(phases, ({one, many}) => ({
initiative: one(initiatives, {
fields: [phases.initiativeId],
references: [initiatives.id]
}),
plans: many(plans),
phaseDependencies_dependsOnPhaseId: many(phaseDependencies, {
relationName: "phaseDependencies_dependsOnPhaseId_phases_id"
}),
phaseDependencies_phaseId: many(phaseDependencies, {
relationName: "phaseDependencies_phaseId_phases_id"
}),
}));
export const initiativesRelations = relations(initiatives, ({many}) => ({
phases: many(phases),
}));
export const plansRelations = relations(plans, ({one, many}) => ({
phase: one(phases, {
fields: [plans.phaseId],
references: [phases.id]
}),
tasks: many(tasks),
}));
export const taskDependenciesRelations = relations(taskDependencies, ({one}) => ({
task_dependsOnTaskId: one(tasks, {
fields: [taskDependencies.dependsOnTaskId],
references: [tasks.id],
relationName: "taskDependencies_dependsOnTaskId_tasks_id"
}),
task_taskId: one(tasks, {
fields: [taskDependencies.taskId],
references: [tasks.id],
relationName: "taskDependencies_taskId_tasks_id"
}),
}));
export const phaseDependenciesRelations = relations(phaseDependencies, ({one}) => ({
phase_dependsOnPhaseId: one(phases, {
fields: [phaseDependencies.dependsOnPhaseId],
references: [phases.id],
relationName: "phaseDependencies_dependsOnPhaseId_phases_id"
}),
phase_phaseId: one(phases, {
fields: [phaseDependencies.phaseId],
references: [phases.id],
relationName: "phaseDependencies_phaseId_phases_id"
}),
}));

98
drizzle/schema.ts Normal file
View File

@@ -0,0 +1,98 @@
import { sqliteTable, AnySQLiteColumn, uniqueIndex, foreignKey, text, integer } from "drizzle-orm/sqlite-core"
import { sql } from "drizzle-orm"
export const agents = sqliteTable("agents", {
id: text().primaryKey().notNull(),
name: text().notNull(),
taskId: text("task_id").references(() => tasks.id, { onDelete: "set null" } ),
sessionId: text("session_id"),
worktreeId: text("worktree_id").notNull(),
status: text().default("idle").notNull(),
mode: text().default("execute").notNull(),
createdAt: integer("created_at").notNull(),
updatedAt: integer("updated_at").notNull(),
},
(table) => [
uniqueIndex("agents_name_unique").on(table.name),
]);
export const initiatives = sqliteTable("initiatives", {
id: text().primaryKey().notNull(),
name: text().notNull(),
description: text(),
status: text().default("active").notNull(),
createdAt: integer("created_at").notNull(),
updatedAt: integer("updated_at").notNull(),
});
export const messages = sqliteTable("messages", {
id: text().primaryKey().notNull(),
senderType: text("sender_type").notNull(),
senderId: text("sender_id").references(() => agents.id, { onDelete: "set null" } ),
recipientType: text("recipient_type").notNull(),
recipientId: text("recipient_id").references(() => agents.id, { onDelete: "set null" } ),
type: text().default("info").notNull(),
content: text().notNull(),
requiresResponse: integer("requires_response").default(false).notNull(),
status: text().default("pending").notNull(),
parentMessageId: text("parent_message_id"),
createdAt: integer("created_at").notNull(),
updatedAt: integer("updated_at").notNull(),
},
(table) => [
foreignKey(() => ({
columns: [table.parentMessageId],
foreignColumns: [table.id],
name: "messages_parent_message_id_messages_id_fk"
})).onDelete("set null"),
]);
export const phases = sqliteTable("phases", {
id: text().primaryKey().notNull(),
initiativeId: text("initiative_id").notNull().references(() => initiatives.id, { onDelete: "cascade" } ),
number: integer().notNull(),
name: text().notNull(),
description: text(),
status: text().default("pending").notNull(),
createdAt: integer("created_at").notNull(),
updatedAt: integer("updated_at").notNull(),
});
export const plans = sqliteTable("plans", {
id: text().primaryKey().notNull(),
phaseId: text("phase_id").notNull().references(() => phases.id, { onDelete: "cascade" } ),
number: integer().notNull(),
name: text().notNull(),
description: text(),
status: text().default("pending").notNull(),
createdAt: integer("created_at").notNull(),
updatedAt: integer("updated_at").notNull(),
});
export const taskDependencies = sqliteTable("task_dependencies", {
id: text().primaryKey().notNull(),
taskId: text("task_id").notNull().references(() => tasks.id, { onDelete: "cascade" } ),
dependsOnTaskId: text("depends_on_task_id").notNull().references(() => tasks.id, { onDelete: "cascade" } ),
createdAt: integer("created_at").notNull(),
});
export const tasks = sqliteTable("tasks", {
id: text().primaryKey().notNull(),
planId: text("plan_id").notNull().references(() => plans.id, { onDelete: "cascade" } ),
name: text().notNull(),
description: text(),
type: text().default("auto").notNull(),
priority: text().default("medium").notNull(),
status: text().default("pending").notNull(),
order: integer().default(0).notNull(),
createdAt: integer("created_at").notNull(),
updatedAt: integer("updated_at").notNull(),
});
export const phaseDependencies = sqliteTable("phase_dependencies", {
id: text().primaryKey().notNull(),
phaseId: text("phase_id").notNull().references(() => phases.id, { onDelete: "cascade" } ),
dependsOnPhaseId: text("depends_on_phase_id").notNull().references(() => phases.id, { onDelete: "cascade" } ),
createdAt: integer("created_at").notNull(),
});