-
Notifications
You must be signed in to change notification settings - Fork 0
Database
SQLite database managed by Prisma. The schema lives in prisma/schema.prisma. All database queries are centralized in src/db.ts — no raw Prisma calls elsewhere in the codebase.
Represents a project (Discord category with shared workspace).
model Project {
categoryId String @id @map("category_id")
guildId String @map("guild_id")
name String
workspaceDir String @map("workspace_dir")
defaultMode String @default("bypassPermissions") @map("default_mode")
createdAt DateTime @default(now()) @map("created_at")
createdBy String @map("created_by")
rooms Room[]
@@map("projects")
}Represents a registered room (Discord channel).
model Room {
channelId String @id @map("channel_id")
guildId String @map("guild_id")
parentId String? @map("parent_id")
name String
workspaceDir String @map("workspace_dir")
tmuxSession String @unique @map("tmux_session")
mode String @default("bypassPermissions")
createdAt DateTime @default(now()) @map("created_at")
createdBy String @map("created_by")
archived Boolean @default(false)
agent String @default("claude")
projectId String? @map("project_id")
project Project? @relation(fields: [projectId], references: [categoryId])
@@map("rooms")
}| Column | Description |
|---|---|
channelId |
Discord channel snowflake (primary key) |
guildId |
Discord guild snowflake |
parentId |
Discord category channel ID (nullable) |
name |
Short name without claude- prefix |
workspaceDir |
Absolute path to workspace directory |
tmuxSession |
Tmux session name (unique) |
mode |
Permission mode: default, plan, acceptEdits, bypassPermissions
|
agent |
Agent name (matches AGENT_* env, default claude) |
projectId |
Optional link to a Project |
createdAt |
Creation timestamp |
createdBy |
Discord user ID of creator (or auto for auto-registered rooms) |
archived |
Soft delete flag |
Access control list entries.
model AclEntry {
id Int @id @default(autoincrement())
type String
value String
addedBy String @map("added_by")
addedAt DateTime @default(now()) @map("added_at")
@@unique([type, value])
@@map("acl_entries")
}Generic key-value store for bot settings.
model Setting {
key String @id
value String
@@map("settings")
}| Migration | Description |
|---|---|
20260510104459_init |
Create rooms table |
20260510110117_add_mode |
Add mode column to rooms |
20260510120403_add_acl |
Create acl_entries and settings tables |
20260510135356_default_mode_bypass |
Change default mode to bypassPermissions
|
20260513074143_add_projects |
Create projects table, add projectId FK to rooms |
20260513080112_add_agent |
Add agent column to rooms |
Migrations auto-apply on startup via prisma migrate deploy (in both pnpm start and Docker entrypoint).
After cloning, generate the Prisma client:
pnpm prisma generateThe generated client outputs to src/generated/prisma/ (gitignored). The build step copies it to dist/generated/.
All database access goes through exported functions in db.ts:
-
getPrisma()— singleton Prisma client instance - Project CRUD:
createProject,findProjectByCategory,listProjects,deleteProject,listRoomsByProject - Room CRUD:
createRoom,findRoomByChannel,listRooms,deleteRoom,renameRoom,setRoomMode,setRoomAgent - ACL entry management
- Settings get/set
claude-tmux-discord — Discord bot for per-channel Claude Code sessions via tmux
Setup
Usage
Technical
Help