Skip to content

Commit eb5cfff

Browse files
committed
fix: schema
1 parent 401596c commit eb5cfff

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

apps/server/prisma/migrations/20250212211833_add_inboxes/migration.sql renamed to apps/server/prisma/migrations/20250219233352_add_inboxes/migration.sql

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ CREATE TABLE "SpaceInbox" (
1212
CONSTRAINT "SpaceInbox_spaceEventId_fkey" FOREIGN KEY ("spaceEventId") REFERENCES "SpaceEvent" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
1313
);
1414

15+
-- CreateTable
16+
CREATE TABLE "SpaceInboxMessage" (
17+
"id" TEXT NOT NULL PRIMARY KEY,
18+
"spaceInboxId" TEXT NOT NULL,
19+
"ciphertext" TEXT NOT NULL,
20+
"nonce" TEXT NOT NULL,
21+
"ephemeralPublicKey" TEXT NOT NULL,
22+
"authorPublicKey" TEXT NOT NULL,
23+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
24+
CONSTRAINT "SpaceInboxMessage_spaceInboxId_fkey" FOREIGN KEY ("spaceInboxId") REFERENCES "SpaceInbox" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
25+
);
26+
1527
-- CreateTable
1628
CREATE TABLE "AccountInbox" (
1729
"id" TEXT NOT NULL PRIMARY KEY,
@@ -24,3 +36,15 @@ CREATE TABLE "AccountInbox" (
2436
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
2537
CONSTRAINT "AccountInbox_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
2638
);
39+
40+
-- CreateTable
41+
CREATE TABLE "AccountInboxMessage" (
42+
"id" TEXT NOT NULL PRIMARY KEY,
43+
"accountInboxId" TEXT NOT NULL,
44+
"ciphertext" TEXT NOT NULL,
45+
"nonce" TEXT NOT NULL,
46+
"ephemeralPublicKey" TEXT NOT NULL,
47+
"authorPublicKey" TEXT NOT NULL,
48+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
49+
CONSTRAINT "AccountInboxMessage_accountInboxId_fkey" FOREIGN KEY ("accountInboxId") REFERENCES "AccountInbox" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
50+
);

apps/server/prisma/schema.prisma

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ model SpaceInbox {
6565
encryptedSecretKey String
6666
spaceEvent SpaceEvent @relation(fields: [spaceEventId], references: [id])
6767
spaceEventId String
68+
messages SpaceInboxMessage[]
6869
createdAt DateTime @default(now())
6970
}
7071

@@ -103,9 +104,21 @@ model AccountInbox {
103104
encryptionPublicKey String
104105
signatureHex String
105106
signatureRecovery Int
107+
messages AccountInboxMessage[]
106108
createdAt DateTime @default(now())
107109
}
108110

111+
model AccountInboxMessage {
112+
id String @id
113+
accountInbox AccountInbox @relation(fields: [accountInboxId], references: [id])
114+
accountInboxId String
115+
ciphertext String
116+
nonce String
117+
ephemeralPublicKey String
118+
authorPublicKey String
119+
createdAt DateTime @default(now())
120+
}
121+
109122
model Invitation {
110123
id String @id
111124
space Space @relation(fields: [spaceId], references: [id])

0 commit comments

Comments
 (0)