@varaos/db 1.1.15 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "public"."UserFile" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"userId" TEXT NOT NULL,
|
|
5
|
+
"path" TEXT NOT NULL,
|
|
6
|
+
"size" BIGINT NOT NULL,
|
|
7
|
+
"mimeType" TEXT NOT NULL,
|
|
8
|
+
"category" TEXT NOT NULL,
|
|
9
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
+
|
|
11
|
+
CONSTRAINT "UserFile_pkey" PRIMARY KEY ("id")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
-- CreateIndex
|
|
15
|
+
CREATE INDEX "UserFile_userId_idx" ON "public"."UserFile"("userId");
|
|
16
|
+
|
|
17
|
+
-- CreateIndex
|
|
18
|
+
CREATE INDEX "UserFile_category_idx" ON "public"."UserFile"("category");
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE "public"."UserFile" ADD CONSTRAINT "UserFile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
package/prisma/schema.prisma
CHANGED
|
@@ -101,6 +101,9 @@ model User {
|
|
|
101
101
|
|
|
102
102
|
passwordStrength String? // weak | medium | strong
|
|
103
103
|
|
|
104
|
+
storageUsed BigInt @default(0) // bytes
|
|
105
|
+
storageLimit BigInt @default(524288000) // 500 MB (beta)
|
|
106
|
+
|
|
104
107
|
accounts Account[]
|
|
105
108
|
integrations Integration[]
|
|
106
109
|
tokenTransactions TokenTransaction[]
|
|
@@ -121,10 +124,28 @@ model User {
|
|
|
121
124
|
paymentMethods PaymentMethod[]
|
|
122
125
|
userEmails UserEmail[]
|
|
123
126
|
invoices Invoice[]
|
|
127
|
+
userFiles UserFile[]
|
|
124
128
|
|
|
125
129
|
@@index([status])
|
|
126
130
|
}
|
|
127
131
|
|
|
132
|
+
model UserFile {
|
|
133
|
+
id String @id @default(uuid())
|
|
134
|
+
userId String
|
|
135
|
+
|
|
136
|
+
path String // local path or CDN URL
|
|
137
|
+
size BigInt // bytes
|
|
138
|
+
mimeType String
|
|
139
|
+
category String // avatar | memory | export | attachment
|
|
140
|
+
|
|
141
|
+
createdAt DateTime @default(now())
|
|
142
|
+
|
|
143
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
144
|
+
|
|
145
|
+
@@index([userId])
|
|
146
|
+
@@index([category])
|
|
147
|
+
}
|
|
148
|
+
|
|
128
149
|
model UserSession {
|
|
129
150
|
id String @id @default(uuid())
|
|
130
151
|
userId String
|
|
@@ -132,7 +153,7 @@ model UserSession {
|
|
|
132
153
|
userAgent String?
|
|
133
154
|
lastUsed DateTime
|
|
134
155
|
|
|
135
|
-
revoked Boolean
|
|
156
|
+
revoked Boolean @default(false)
|
|
136
157
|
revokedAt DateTime?
|
|
137
158
|
|
|
138
159
|
expiresAt DateTime
|
|
@@ -645,11 +666,11 @@ model Invoice {
|
|
|
645
666
|
}
|
|
646
667
|
|
|
647
668
|
model BillingEvent {
|
|
648
|
-
id
|
|
649
|
-
provider
|
|
669
|
+
id String @id @default(uuid())
|
|
670
|
+
provider String // razorpay
|
|
650
671
|
|
|
651
672
|
eventType String
|
|
652
|
-
eventId String
|
|
673
|
+
eventId String @unique // razorpay event ID
|
|
653
674
|
|
|
654
675
|
payload Json
|
|
655
676
|
processed Boolean @default(false)
|
|
@@ -661,7 +682,7 @@ model BillingEvent {
|
|
|
661
682
|
model PaymentMethod {
|
|
662
683
|
id String @id @default(uuid())
|
|
663
684
|
userId String
|
|
664
|
-
provider
|
|
685
|
+
provider String // razorpay | stripe | paypal
|
|
665
686
|
type String // card
|
|
666
687
|
brand String?
|
|
667
688
|
last4 String?
|