From 2956950cd2e0f063d68b87cdf7234da3cfcdde3d Mon Sep 17 00:00:00 2001 From: Mikkel Georgsen Date: Wed, 1 Apr 2026 03:20:48 +0200 Subject: [PATCH] feat(11-01): add five Drizzle table definitions for skill groups - Add primaryKey import from drizzle-orm/sqlite-core - Add skillGroups table with id, name, description, isBuiltin, timestamps - Add skillGroupMembers junction table with composite PK (groupId, skillId) - Add skillGroupInheritance table with composite PK (childGroupId, parentGroupId) - Add agentSkillGroups table with composite PK (agentId, groupId) - Add agentSkills table with composite PK (agentId, skillId) --- server/src/services/skill-registry-schema.ts | 42 +++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/server/src/services/skill-registry-schema.ts b/server/src/services/skill-registry-schema.ts index 98e72e0b..aaa6d27b 100644 --- a/server/src/services/skill-registry-schema.ts +++ b/server/src/services/skill-registry-schema.ts @@ -1,4 +1,4 @@ -import { sqliteTable, text, integer, real } from "drizzle-orm/sqlite-core"; +import { sqliteTable, text, integer, real, primaryKey } from "drizzle-orm/sqlite-core"; export const skills = sqliteTable("skills", { id: text("id").primaryKey(), @@ -36,3 +36,43 @@ export const communityRatings = sqliteTable("community_ratings", { ratingCount: integer("rating_count"), source: text("source"), }); + +export const skillGroups = sqliteTable("skill_groups", { + id: text("id").primaryKey(), + name: text("name").notNull(), + description: text("description"), + isBuiltin: integer("is_builtin").notNull().default(0), + createdAt: integer("created_at").notNull(), + updatedAt: integer("updated_at").notNull(), +}); + +export const skillGroupMembers = sqliteTable("skill_group_members", { + groupId: text("group_id").notNull(), + skillId: text("skill_id").notNull(), + addedAt: integer("added_at").notNull(), +}, (t) => ({ + pk: primaryKey({ columns: [t.groupId, t.skillId] }), +})); + +export const skillGroupInheritance = sqliteTable("skill_group_inheritance", { + childGroupId: text("child_group_id").notNull(), + parentGroupId: text("parent_group_id").notNull(), +}, (t) => ({ + pk: primaryKey({ columns: [t.childGroupId, t.parentGroupId] }), +})); + +export const agentSkillGroups = sqliteTable("agent_skill_groups", { + agentId: text("agent_id").notNull(), + groupId: text("group_id").notNull(), + assignedAt: integer("assigned_at").notNull(), +}, (t) => ({ + pk: primaryKey({ columns: [t.agentId, t.groupId] }), +})); + +export const agentSkills = sqliteTable("agent_skills", { + agentId: text("agent_id").notNull(), + skillId: text("skill_id").notNull(), + installedAt: integer("installed_at").notNull(), +}, (t) => ({ + pk: primaryKey({ columns: [t.agentId, t.skillId] }), +}));