@factor-wise/prisma-schema 2.0.126 → 2.0.128

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 CHANGED
@@ -61,9 +61,49 @@ npm install
61
61
  npx prisma generate
62
62
 
63
63
 
64
- npx prisma db push
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factor-wise/prisma-schema",
3
- "version": "2.0.126",
3
+ "version": "2.0.128",
4
4
  "description": "Shared Prisma schema and generated client for Factor Wise projects",
5
5
  "main": "generated/client/index.js",
6
6
  "types": "generated/client/index.d.ts",
@@ -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)
@@ -771,7 +785,11 @@ model customer_extended {
771
785
  otpExpiresAt DateTime?
772
786
  selfieAttempts Int? @default(0)
773
787
  kidGenerateAt DateTime? @default(now()) @db.DateTime(0)
774
- customer customer @relation(fields: [customerID], references: [customerID])
788
+ loanRequired Int @default(0)
789
+ loanPurpose String? @db.VarChar(255)
790
+ salaryMode String? @db.VarChar(100)
791
+
792
+ customer customer @relation(fields: [customerID], references: [customerID])
775
793
  }
776
794
 
777
795
  model customer_locations {
@@ -1434,6 +1452,7 @@ model leads {
1434
1452
  face_comparison face_comparison[]
1435
1453
  credforge_bre_log credforge_bre_log[]
1436
1454
  aiCallLogs ai_call_logs[]
1455
+ creditRemarks credit_remarks[]
1437
1456
 
1438
1457
  @@index([customerID], map: "idx_customerID")
1439
1458
  @@index([userID], map: "idx_userID")
@@ -2770,6 +2789,7 @@ model lms_users {
2770
2789
  collectionAssignedLeads leads[] @relation("CollectionAssignedUser")
2771
2790
  paymentDatesCreated payment_block_dates[] @relation("UserCreatedPaymentDates")
2772
2791
  paymentDatesUpdated payment_block_dates[] @relation("UserUpdatedPaymentDates")
2792
+ creditRemarks credit_remarks[]
2773
2793
  }
2774
2794
 
2775
2795
  model lms_users_permissions {