@factor-wise/prisma-schema 2.0.127 → 2.0.129
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/README.md +41 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +24 -7
package/README.md
CHANGED
|
@@ -61,9 +61,49 @@ npm install
|
|
|
61
61
|
npx prisma generate
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
npm run db:plan -- describe_your_change
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
## Production database changes
|
|
68
|
+
|
|
69
|
+
Do not run `prisma db push` against production. This database is large and has
|
|
70
|
+
historical schema drift, so `db push` can unexpectedly alter unrelated tables.
|
|
71
|
+
|
|
72
|
+
Use one focused, reviewed SQL change instead:
|
|
73
|
+
|
|
74
|
+
1. Commit the current schema as the baseline.
|
|
75
|
+
2. Edit `prisma/schema.prisma` with one logical change.
|
|
76
|
+
3. Generate SQL containing only that edit:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run db:plan -- add_customer_key
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
4. Review the generated file in `prisma/changes/`. The command reports common
|
|
83
|
+
operations that scan, lock, or rebuild populated tables.
|
|
84
|
+
5. Test the SQL on a production-sized staging database. For an index or foreign
|
|
85
|
+
key on a large table, use an online schema-change tool and schedule it during
|
|
86
|
+
low traffic; Prisma cannot make the MySQL table operation instant.
|
|
87
|
+
6. Apply the exact reviewed file:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm run db:check -- prisma/changes/<file>.sql
|
|
91
|
+
npm run db:apply -- prisma/changes/<file>.sql
|
|
92
|
+
npm run generate
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The command asks you to type `APPLY` before connecting to the configured
|
|
96
|
+
database. A file containing `DROP TABLE` or `DROP COLUMN` asks for a second
|
|
97
|
+
`DELETE` confirmation. Non-interactive CI can use `--confirm-production`
|
|
98
|
+
and, for destructive changes, `--confirm-data-loss`.
|
|
99
|
+
|
|
100
|
+
7. Commit `schema.prisma` and the SQL change file together.
|
|
101
|
+
|
|
102
|
+
`db:plan` compares the working schema to the committed schema rather than the
|
|
103
|
+
live database. This prevents old, unrelated database drift from being included
|
|
104
|
+
in a new production change. The `db:apply` command uses the database configured
|
|
105
|
+
by `DATABASE_URL`; verify that target before confirming production execution.
|
|
106
|
+
|
|
67
107
|
---
|
|
68
108
|
|
|
69
109
|
_Built and maintained with ❤️ by the **Factorwise Development Team**._
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -423,6 +423,20 @@ model callhistorylogs {
|
|
|
423
423
|
@@index([leadID], map: "callhistorylogs_leadID_fkey")
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
model credit_remarks {
|
|
427
|
+
id Int @id @default(autoincrement())
|
|
428
|
+
leadID Int
|
|
429
|
+
userID Int
|
|
430
|
+
remark String @db.VarChar(1000)
|
|
431
|
+
createdDate DateTime @default(now()) @db.DateTime(0)
|
|
432
|
+
|
|
433
|
+
lead leads @relation(fields: [leadID], references: [leadID])
|
|
434
|
+
user lms_users @relation(fields: [userID], references: [userID])
|
|
435
|
+
|
|
436
|
+
@@index([leadID], map: "credit_remarks_leadID_fkey")
|
|
437
|
+
@@index([userID], map: "credit_remarks_userID_fkey")
|
|
438
|
+
}
|
|
439
|
+
|
|
426
440
|
model cashfree_emcharge {
|
|
427
441
|
id Int @id
|
|
428
442
|
cfmID String @db.VarChar(256)
|
|
@@ -1438,6 +1452,7 @@ model leads {
|
|
|
1438
1452
|
face_comparison face_comparison[]
|
|
1439
1453
|
credforge_bre_log credforge_bre_log[]
|
|
1440
1454
|
aiCallLogs ai_call_logs[]
|
|
1455
|
+
creditRemarks credit_remarks[]
|
|
1441
1456
|
|
|
1442
1457
|
@@index([customerID], map: "idx_customerID")
|
|
1443
1458
|
@@index([userID], map: "idx_userID")
|
|
@@ -2774,6 +2789,7 @@ model lms_users {
|
|
|
2774
2789
|
collectionAssignedLeads leads[] @relation("CollectionAssignedUser")
|
|
2775
2790
|
paymentDatesCreated payment_block_dates[] @relation("UserCreatedPaymentDates")
|
|
2776
2791
|
paymentDatesUpdated payment_block_dates[] @relation("UserUpdatedPaymentDates")
|
|
2792
|
+
creditRemarks credit_remarks[]
|
|
2777
2793
|
}
|
|
2778
2794
|
|
|
2779
2795
|
model lms_users_permissions {
|
|
@@ -3460,13 +3476,14 @@ model fi {
|
|
|
3460
3476
|
}
|
|
3461
3477
|
|
|
3462
3478
|
model vendors {
|
|
3463
|
-
id
|
|
3464
|
-
name
|
|
3465
|
-
clientId
|
|
3466
|
-
secretId
|
|
3467
|
-
email
|
|
3468
|
-
password
|
|
3469
|
-
tag
|
|
3479
|
+
id Int @id @default(autoincrement()) @db.UnsignedInt
|
|
3480
|
+
name String @db.VarChar(255)
|
|
3481
|
+
clientId String @unique @db.VarChar(100)
|
|
3482
|
+
secretId String @db.VarChar(255)
|
|
3483
|
+
email String @unique @db.VarChar(255)
|
|
3484
|
+
password String @db.VarChar(255)
|
|
3485
|
+
tag String? @db.VarChar(100)
|
|
3486
|
+
companyName String? @db.VarChar(100)
|
|
3470
3487
|
|
|
3471
3488
|
commissionType commission_type?
|
|
3472
3489
|
commissionValue Float?
|