Adding the Edit/creation for agent.

This commit is contained in:
charles-gauthereau
2024-11-11 12:39:59 +01:00
parent 3cf8f3f264
commit f9e00cb2d9
14 changed files with 4711 additions and 8753 deletions
@@ -0,0 +1,12 @@
/*
Warnings:
- A unique constraint covering the columns `[slug]` on the table `Agent` will be added. If there are existing duplicate values, this will fail.
- Added the required column `slug` to the `Agent` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Agent" ADD COLUMN "slug" TEXT NOT NULL;
-- CreateIndex
CREATE UNIQUE INDEX "Agent_slug_key" ON "Agent"("slug");
@@ -0,0 +1,2 @@
-- AddForeignKey
ALTER TABLE "Database" ADD CONSTRAINT "Database_agent_id_fkey" FOREIGN KEY ("agent_id") REFERENCES "Agent"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+9 -5
View File
@@ -72,16 +72,20 @@ model User {
}
model Agent {
id String @id @default(cuid())
id String @id @default(cuid())
slug String @unique
name String
description String?
lastContact DateTime? @map("last_contact")
createdAt DateTime @default(now()) @map("created_at")
lastContact DateTime? @map("last_contact")
createdAt DateTime @default(now()) @map("created_at")
databases Database[]
}
model Database {
id String @id @default(cuid())
agentId String @map("agent_id")
id String @id @default(cuid())
agentId String @map("agent_id")
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
name String
description String?
backupPolicy String? @map("backup_policy")