connection profiles and ssh key encryption

This commit is contained in:
felixg
2026-03-01 12:04:38 +01:00
parent 7e3a1ceef4
commit 93bf9ab70d
17 changed files with 621 additions and 28 deletions

View File

@@ -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;

View File

@@ -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';

View File

@@ -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")
}