mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 11:24:43 +00:00
feat(agent): add teamId foreign key to agent table and refactor service queries
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `team_id` to the `agents` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "agents" ADD COLUMN "team_id" TEXT NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "agents" ADD CONSTRAINT "agents_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -220,6 +220,7 @@ model Team {
|
||||
providers Provider[] @relation("TeamToProvider")
|
||||
skills Skill[] @relation("TeamToSkill")
|
||||
sandbox Sandbox? @relation("TeamToSandbox")
|
||||
agents Agent[] @relation("TeamToAgent")
|
||||
|
||||
@@map("teams")
|
||||
}
|
||||
@@ -619,6 +620,10 @@ model Agent {
|
||||
provider Provider? @relation("ProviderToAgent", fields: [providerId], references: [id], onDelete: SetNull)
|
||||
modelId String? @map("model_id")
|
||||
modelRef Model? @relation("ModelToAgent", fields: [modelId], references: [id], onDelete: SetNull)
|
||||
|
||||
teamId String @map("team_id")
|
||||
team Team @relation("TeamToAgent", fields: [teamId], references: [id], onDelete: Cascade)
|
||||
|
||||
/// [AgentConfig]
|
||||
config Json
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
Reference in New Issue
Block a user