fix: auto-migrate after DB restore and force re-login
- After importing a backup, run prisma migrate deploy so any schema migrations the backup is missing are applied automatically. This prevents pages from failing due to missing tables/columns when the backup was taken on an older version of the app. - Force logout and redirect to login after a successful restore so the JWT is refreshed against the restored database (prevents userId mismatch causing user-scoped queries to return empty results). - Fix getTotalPatientCount() in /status route to pass userId so it counts only the current user's patients instead of all patients. - Add prisma.$connect() after $disconnect() to ensure a clean reconnect. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -145,7 +145,6 @@ exports.Prisma.PatientScalarFieldEnum = {
|
||||
policyHolder: 'policyHolder',
|
||||
allergies: 'allergies',
|
||||
medicalConditions: 'medicalConditions',
|
||||
preferredLanguage: 'preferredLanguage',
|
||||
status: 'status',
|
||||
userId: 'userId',
|
||||
createdAt: 'createdAt',
|
||||
@@ -165,7 +164,6 @@ exports.Prisma.AppointmentScalarFieldEnum = {
|
||||
notes: 'notes',
|
||||
procedureCodeNotes: 'procedureCodeNotes',
|
||||
status: 'status',
|
||||
movedByAi: 'movedByAi',
|
||||
createdAt: 'createdAt',
|
||||
eligibilityStatus: 'eligibilityStatus'
|
||||
};
|
||||
@@ -231,7 +229,6 @@ exports.Prisma.ClaimScalarFieldEnum = {
|
||||
updatedAt: 'updatedAt',
|
||||
status: 'status',
|
||||
claimNumber: 'claimNumber',
|
||||
preAuthNumber: 'preAuthNumber',
|
||||
npiProviderId: 'npiProviderId'
|
||||
};
|
||||
|
||||
@@ -245,9 +242,6 @@ exports.Prisma.ServiceLineScalarFieldEnum = {
|
||||
arch: 'arch',
|
||||
toothNumber: 'toothNumber',
|
||||
toothSurface: 'toothSurface',
|
||||
icn: 'icn',
|
||||
paidCode: 'paidCode',
|
||||
allowedAmount: 'allowedAmount',
|
||||
totalBilled: 'totalBilled',
|
||||
totalPaid: 'totalPaid',
|
||||
totalAdjusted: 'totalAdjusted',
|
||||
@@ -271,15 +265,6 @@ exports.Prisma.InsuranceCredentialScalarFieldEnum = {
|
||||
password: 'password'
|
||||
};
|
||||
|
||||
exports.Prisma.ShoppingVendorScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
vendorName: 'vendorName',
|
||||
websiteUrl: 'websiteUrl',
|
||||
loginUsername: 'loginUsername',
|
||||
loginPassword: 'loginPassword'
|
||||
};
|
||||
|
||||
exports.Prisma.PdfGroupScalarFieldEnum = {
|
||||
id: 'id',
|
||||
title: 'title',
|
||||
@@ -302,14 +287,10 @@ exports.Prisma.PaymentScalarFieldEnum = {
|
||||
patientId: 'patientId',
|
||||
userId: 'userId',
|
||||
updatedById: 'updatedById',
|
||||
npiProviderId: 'npiProviderId',
|
||||
totalBilled: 'totalBilled',
|
||||
totalPaid: 'totalPaid',
|
||||
totalAdjusted: 'totalAdjusted',
|
||||
totalDue: 'totalDue',
|
||||
mhPaidAmount: 'mhPaidAmount',
|
||||
copayment: 'copayment',
|
||||
adjustment: 'adjustment',
|
||||
status: 'status',
|
||||
notes: 'notes',
|
||||
icn: 'icn',
|
||||
@@ -433,9 +414,7 @@ exports.Prisma.TwilioSettingsScalarFieldEnum = {
|
||||
exports.Prisma.AiSettingsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
apiKey: 'apiKey',
|
||||
afterHoursEnabled: 'afterHoursEnabled',
|
||||
openPhoneReply: 'openPhoneReply'
|
||||
apiKey: 'apiKey'
|
||||
};
|
||||
|
||||
exports.Prisma.OfficeHoursScalarFieldEnum = {
|
||||
@@ -447,24 +426,11 @@ exports.Prisma.OfficeHoursScalarFieldEnum = {
|
||||
exports.Prisma.OfficeContactScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
officeName: 'officeName',
|
||||
receptionistName: 'receptionistName',
|
||||
dentistName: 'dentistName',
|
||||
phoneNumber: 'phoneNumber',
|
||||
email: 'email',
|
||||
fax: 'fax',
|
||||
streetAddress: 'streetAddress',
|
||||
city: 'city',
|
||||
state: 'state',
|
||||
zipCode: 'zipCode'
|
||||
};
|
||||
|
||||
exports.Prisma.InsuranceContactScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
name: 'name',
|
||||
phoneNumber: 'phoneNumber',
|
||||
createdAt: 'createdAt'
|
||||
fax: 'fax'
|
||||
};
|
||||
|
||||
exports.Prisma.ProcedureTimeslotScalarFieldEnum = {
|
||||
@@ -473,31 +439,6 @@ exports.Prisma.ProcedureTimeslotScalarFieldEnum = {
|
||||
data: 'data'
|
||||
};
|
||||
|
||||
exports.Prisma.PatientConversationScalarFieldEnum = {
|
||||
id: 'id',
|
||||
patientId: 'patientId',
|
||||
userId: 'userId',
|
||||
stage: 'stage',
|
||||
aiHandoff: 'aiHandoff',
|
||||
updatedAt: 'updatedAt'
|
||||
};
|
||||
|
||||
exports.Prisma.CommissionBatchScalarFieldEnum = {
|
||||
id: 'id',
|
||||
npiProviderId: 'npiProviderId',
|
||||
totalCollection: 'totalCollection',
|
||||
commissionAmount: 'commissionAmount',
|
||||
notes: 'notes',
|
||||
createdAt: 'createdAt'
|
||||
};
|
||||
|
||||
exports.Prisma.CommissionBatchItemScalarFieldEnum = {
|
||||
id: 'id',
|
||||
commissionBatchId: 'commissionBatchId',
|
||||
paymentId: 'paymentId',
|
||||
collectionAmount: 'collectionAmount'
|
||||
};
|
||||
|
||||
exports.Prisma.SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
@@ -550,8 +491,7 @@ exports.ClaimStatus = exports.$Enums.ClaimStatus = {
|
||||
APPROVED: 'APPROVED',
|
||||
CANCELLED: 'CANCELLED',
|
||||
REVIEW: 'REVIEW',
|
||||
VOID: 'VOID',
|
||||
PREAUTH: 'PREAUTH'
|
||||
VOID: 'VOID'
|
||||
};
|
||||
|
||||
exports.ServiceLineStatus = exports.$Enums.ServiceLineStatus = {
|
||||
@@ -628,7 +568,6 @@ exports.Prisma.ModelName = {
|
||||
ServiceLine: 'ServiceLine',
|
||||
ClaimFile: 'ClaimFile',
|
||||
InsuranceCredential: 'InsuranceCredential',
|
||||
ShoppingVendor: 'ShoppingVendor',
|
||||
PdfGroup: 'PdfGroup',
|
||||
PdfFile: 'PdfFile',
|
||||
Payment: 'Payment',
|
||||
@@ -646,11 +585,7 @@ exports.Prisma.ModelName = {
|
||||
AiSettings: 'AiSettings',
|
||||
OfficeHours: 'OfficeHours',
|
||||
OfficeContact: 'OfficeContact',
|
||||
InsuranceContact: 'InsuranceContact',
|
||||
ProcedureTimeslot: 'ProcedureTimeslot',
|
||||
PatientConversation: 'PatientConversation',
|
||||
CommissionBatch: 'CommissionBatch',
|
||||
CommissionBatchItem: 'CommissionBatchItem'
|
||||
ProcedureTimeslot: 'ProcedureTimeslot'
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user