@varaos/db 1.1.19 → 1.3.0
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,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- The `status` column on the `Workflow` table would be dropped and recreated. This will lead to data loss if there is data in the column.
|
|
5
|
+
- The `status` column on the `WorkflowRun` table would be dropped and recreated. This will lead to data loss if there is data in the column.
|
|
6
|
+
- The `status` column on the `WorkflowStep` table would be dropped and recreated. This will lead to data loss if there is data in the column.
|
|
7
|
+
- The `status` column on the `WorkflowStepRun` table would be dropped and recreated. This will lead to data loss if there is data in the column.
|
|
8
|
+
- Changed the type of `status` on the `Subscription` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
|
|
9
|
+
|
|
10
|
+
*/
|
|
11
|
+
-- CreateEnum
|
|
12
|
+
CREATE TYPE "public"."SubscriptionStatus" AS ENUM ('active', 'trialing', 'past_due', 'canceled', 'paused');
|
|
13
|
+
|
|
14
|
+
-- CreateEnum
|
|
15
|
+
CREATE TYPE "public"."WorkflowStatus" AS ENUM ('active', 'paused', 'archived');
|
|
16
|
+
|
|
17
|
+
-- CreateEnum
|
|
18
|
+
CREATE TYPE "public"."WorkflowRunStatus" AS ENUM ('running', 'completed', 'failed', 'canceled');
|
|
19
|
+
|
|
20
|
+
-- CreateEnum
|
|
21
|
+
CREATE TYPE "public"."WorkflowStepStatus" AS ENUM ('active', 'paused', 'deprecated');
|
|
22
|
+
|
|
23
|
+
-- CreateEnum
|
|
24
|
+
CREATE TYPE "public"."WorkflowStepRunStatus" AS ENUM ('pending', 'running', 'completed', 'failed', 'skipped');
|
|
25
|
+
|
|
26
|
+
-- DropIndex
|
|
27
|
+
DROP INDEX "public"."UserSession_userId_idx";
|
|
28
|
+
|
|
29
|
+
-- AlterTable
|
|
30
|
+
ALTER TABLE "public"."BillingEvent" ADD COLUMN "error" TEXT,
|
|
31
|
+
ADD COLUMN "processedAt" TIMESTAMP(3);
|
|
32
|
+
|
|
33
|
+
-- AlterTable
|
|
34
|
+
ALTER TABLE "public"."Subscription" ADD COLUMN "currentPeriodEnd" TIMESTAMP(3),
|
|
35
|
+
ADD COLUMN "currentPeriodStart" TIMESTAMP(3),
|
|
36
|
+
DROP COLUMN "status",
|
|
37
|
+
ADD COLUMN "status" "public"."SubscriptionStatus" NOT NULL;
|
|
38
|
+
|
|
39
|
+
-- AlterTable
|
|
40
|
+
ALTER TABLE "public"."User" ADD COLUMN "chatCount" INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
ADD COLUMN "integrationCount" INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
ADD COLUMN "lastActiveAt" TIMESTAMP(3),
|
|
43
|
+
ADD COLUMN "workflowCount" INTEGER NOT NULL DEFAULT 0;
|
|
44
|
+
|
|
45
|
+
-- AlterTable
|
|
46
|
+
ALTER TABLE "public"."Workflow" DROP COLUMN "status",
|
|
47
|
+
ADD COLUMN "status" "public"."WorkflowStatus" NOT NULL DEFAULT 'active';
|
|
48
|
+
|
|
49
|
+
-- AlterTable
|
|
50
|
+
ALTER TABLE "public"."WorkflowRun" DROP COLUMN "status",
|
|
51
|
+
ADD COLUMN "status" "public"."WorkflowRunStatus" NOT NULL DEFAULT 'running';
|
|
52
|
+
|
|
53
|
+
-- AlterTable
|
|
54
|
+
ALTER TABLE "public"."WorkflowStep" DROP COLUMN "status",
|
|
55
|
+
ADD COLUMN "status" "public"."WorkflowStepStatus" NOT NULL DEFAULT 'active';
|
|
56
|
+
|
|
57
|
+
-- AlterTable
|
|
58
|
+
ALTER TABLE "public"."WorkflowStepRun" DROP COLUMN "status",
|
|
59
|
+
ADD COLUMN "status" "public"."WorkflowStepRunStatus" NOT NULL DEFAULT 'pending';
|
|
60
|
+
|
|
61
|
+
-- CreateIndex
|
|
62
|
+
CREATE INDEX "UserSession_userId_revoked_idx" ON "public"."UserSession"("userId", "revoked");
|
package/prisma/schema.prisma
CHANGED
|
@@ -82,6 +82,45 @@ enum TwoFactorMethod {
|
|
|
82
82
|
webauthn
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
enum SubscriptionStatus {
|
|
86
|
+
active
|
|
87
|
+
trialing
|
|
88
|
+
past_due
|
|
89
|
+
canceled
|
|
90
|
+
paused
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
enum WorkflowStatus {
|
|
94
|
+
draft
|
|
95
|
+
active
|
|
96
|
+
paused
|
|
97
|
+
archived
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
enum WorkflowRunStatus {
|
|
101
|
+
running
|
|
102
|
+
completed
|
|
103
|
+
failed
|
|
104
|
+
canceled
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
enum WorkflowStepStatus {
|
|
108
|
+
draft
|
|
109
|
+
active
|
|
110
|
+
paused
|
|
111
|
+
deprecated
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
enum WorkflowStepRunStatus {
|
|
115
|
+
pending
|
|
116
|
+
running
|
|
117
|
+
completed
|
|
118
|
+
failed
|
|
119
|
+
skipped
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
85
124
|
/// ─────────────────────────────────────────────
|
|
86
125
|
/// USERS & AUTH
|
|
87
126
|
/// ─────────────────────────────────────────────
|
|
@@ -108,10 +147,16 @@ model User {
|
|
|
108
147
|
userTwoFactor UserTwoFactor?
|
|
109
148
|
|
|
110
149
|
metadata Json?
|
|
111
|
-
plan Plan @default(free)
|
|
112
|
-
tokenBalance Int @default(0)
|
|
113
|
-
creditsUsed Int @default(0)
|
|
114
150
|
deletedAt DateTime?
|
|
151
|
+
plan Plan @default(free)
|
|
152
|
+
tokenBalance Int @default(0)
|
|
153
|
+
creditsUsed Int @default(0)
|
|
154
|
+
|
|
155
|
+
chatCount Int @default(0)
|
|
156
|
+
workflowCount Int @default(0)
|
|
157
|
+
integrationCount Int @default(0)
|
|
158
|
+
|
|
159
|
+
lastActiveAt DateTime?
|
|
115
160
|
|
|
116
161
|
authType AuthType @default(oauth)
|
|
117
162
|
|
|
@@ -181,7 +226,7 @@ model UserSession {
|
|
|
181
226
|
|
|
182
227
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
183
228
|
|
|
184
|
-
@@index([userId])
|
|
229
|
+
@@index([userId, revoked])
|
|
185
230
|
}
|
|
186
231
|
|
|
187
232
|
model UploadIntent {
|
|
@@ -420,10 +465,10 @@ model TokenTransaction {
|
|
|
420
465
|
}
|
|
421
466
|
|
|
422
467
|
model Workflow {
|
|
423
|
-
id String
|
|
468
|
+
id String @id @default(uuid())
|
|
424
469
|
name String
|
|
425
470
|
description String?
|
|
426
|
-
status
|
|
471
|
+
status WorkflowStatus @default(active)
|
|
427
472
|
userId String
|
|
428
473
|
workspaceId String?
|
|
429
474
|
|
|
@@ -442,7 +487,7 @@ model WorkflowStep {
|
|
|
442
487
|
type String
|
|
443
488
|
config Json
|
|
444
489
|
order Int
|
|
445
|
-
status
|
|
490
|
+
status WorkflowStepStatus @default(active)
|
|
446
491
|
|
|
447
492
|
workflow Workflow @relation(fields: [workflowId], references: [id])
|
|
448
493
|
|
|
@@ -452,9 +497,9 @@ model WorkflowStep {
|
|
|
452
497
|
}
|
|
453
498
|
|
|
454
499
|
model WorkflowRun {
|
|
455
|
-
id String
|
|
500
|
+
id String @id @default(uuid())
|
|
456
501
|
workflowId String
|
|
457
|
-
status
|
|
502
|
+
status WorkflowRunStatus @default(running)
|
|
458
503
|
input Json?
|
|
459
504
|
output Json?
|
|
460
505
|
error String?
|
|
@@ -472,7 +517,7 @@ model WorkflowStepRun {
|
|
|
472
517
|
id String @id @default(uuid())
|
|
473
518
|
workflowRunId String
|
|
474
519
|
workflowStepId String
|
|
475
|
-
status
|
|
520
|
+
status WorkflowStepRunStatus @default(pending)
|
|
476
521
|
input Json?
|
|
477
522
|
output Json?
|
|
478
523
|
error String?
|
|
@@ -682,12 +727,20 @@ model SecurityEvent {
|
|
|
682
727
|
/// ─────────────────────────────────────────────
|
|
683
728
|
|
|
684
729
|
model Subscription {
|
|
685
|
-
id
|
|
686
|
-
userId
|
|
687
|
-
plan
|
|
688
|
-
status
|
|
689
|
-
|
|
690
|
-
|
|
730
|
+
id String @id @default(uuid())
|
|
731
|
+
userId String
|
|
732
|
+
plan Plan
|
|
733
|
+
status SubscriptionStatus // active | trialing | past_due | canceled
|
|
734
|
+
|
|
735
|
+
// ── Lifecycle (rarely changes)
|
|
736
|
+
startedAt DateTime
|
|
737
|
+
endedAt DateTime?
|
|
738
|
+
|
|
739
|
+
// ── Billing cycle (changes every invoice)
|
|
740
|
+
currentPeriodStart DateTime?
|
|
741
|
+
currentPeriodEnd DateTime?
|
|
742
|
+
|
|
743
|
+
// ── Provider scheduling (informational only)
|
|
691
744
|
nextPayment DateTime?
|
|
692
745
|
|
|
693
746
|
razorpayCustomerId String?
|
|
@@ -727,8 +780,11 @@ model BillingEvent {
|
|
|
727
780
|
eventType String
|
|
728
781
|
eventId String @unique // razorpay event ID
|
|
729
782
|
|
|
730
|
-
payload
|
|
731
|
-
processed
|
|
783
|
+
payload Json
|
|
784
|
+
processed Boolean @default(false)
|
|
785
|
+
processedAt DateTime?
|
|
786
|
+
error String?
|
|
787
|
+
|
|
732
788
|
createdAt DateTime @default(now())
|
|
733
789
|
|
|
734
790
|
@@index([provider, eventType])
|