connection profiles and ssh key encryption
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "profiles" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"username" TEXT,
|
||||
"encryptedPassword" TEXT,
|
||||
"privateKey" TEXT,
|
||||
"domain" TEXT,
|
||||
"clipboardEnabled" BOOLEAN,
|
||||
"userId" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "profiles_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey (profiles → users)
|
||||
ALTER TABLE "profiles" ADD CONSTRAINT "profiles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AlterTable (connections: add profileId)
|
||||
ALTER TABLE "connections" ADD COLUMN "profileId" TEXT;
|
||||
|
||||
-- AddForeignKey (connections → profiles)
|
||||
ALTER TABLE "connections" ADD CONSTRAINT "connections_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES "profiles"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable: add protocol column (default 'ssh' for any existing rows)
|
||||
ALTER TABLE "profiles" ADD COLUMN "protocol" TEXT NOT NULL DEFAULT 'ssh';
|
||||
@@ -15,6 +15,7 @@ model User {
|
||||
createdAt DateTime @default(now())
|
||||
folders Folder[]
|
||||
connections Connection[]
|
||||
profiles Profile[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -48,9 +49,28 @@ model Connection {
|
||||
clipboardEnabled Boolean @default(true)
|
||||
folderId String?
|
||||
folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull)
|
||||
profileId String?
|
||||
profile Profile? @relation(fields: [profileId], references: [id], onDelete: SetNull)
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@map("connections")
|
||||
}
|
||||
|
||||
model Profile {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
protocol String
|
||||
username String?
|
||||
encryptedPassword String?
|
||||
privateKey String?
|
||||
domain String?
|
||||
clipboardEnabled Boolean?
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
connections Connection[]
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@map("profiles")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user