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:
@@ -7,7 +7,6 @@ import { AppointmentUpdateManyWithoutUserNestedInputObjectSchema as AppointmentU
|
||||
import { StaffUpdateManyWithoutUserNestedInputObjectSchema as StaffUpdateManyWithoutUserNestedInputObjectSchema } from './StaffUpdateManyWithoutUserNestedInput.schema';
|
||||
import { NpiProviderUpdateManyWithoutUserNestedInputObjectSchema as NpiProviderUpdateManyWithoutUserNestedInputObjectSchema } from './NpiProviderUpdateManyWithoutUserNestedInput.schema';
|
||||
import { InsuranceCredentialUpdateManyWithoutUserNestedInputObjectSchema as InsuranceCredentialUpdateManyWithoutUserNestedInputObjectSchema } from './InsuranceCredentialUpdateManyWithoutUserNestedInput.schema';
|
||||
import { ShoppingVendorUpdateManyWithoutUserNestedInputObjectSchema as ShoppingVendorUpdateManyWithoutUserNestedInputObjectSchema } from './ShoppingVendorUpdateManyWithoutUserNestedInput.schema';
|
||||
import { PaymentUpdateManyWithoutUpdatedByNestedInputObjectSchema as PaymentUpdateManyWithoutUpdatedByNestedInputObjectSchema } from './PaymentUpdateManyWithoutUpdatedByNestedInput.schema';
|
||||
import { DatabaseBackupUpdateManyWithoutUserNestedInputObjectSchema as DatabaseBackupUpdateManyWithoutUserNestedInputObjectSchema } from './DatabaseBackupUpdateManyWithoutUserNestedInput.schema';
|
||||
import { BackupDestinationUpdateManyWithoutUserNestedInputObjectSchema as BackupDestinationUpdateManyWithoutUserNestedInputObjectSchema } from './BackupDestinationUpdateManyWithoutUserNestedInput.schema';
|
||||
@@ -19,9 +18,7 @@ import { TwilioSettingsUpdateOneWithoutUserNestedInputObjectSchema as TwilioSett
|
||||
import { AiSettingsUpdateOneWithoutUserNestedInputObjectSchema as AiSettingsUpdateOneWithoutUserNestedInputObjectSchema } from './AiSettingsUpdateOneWithoutUserNestedInput.schema';
|
||||
import { OfficeHoursUpdateOneWithoutUserNestedInputObjectSchema as OfficeHoursUpdateOneWithoutUserNestedInputObjectSchema } from './OfficeHoursUpdateOneWithoutUserNestedInput.schema';
|
||||
import { OfficeContactUpdateOneWithoutUserNestedInputObjectSchema as OfficeContactUpdateOneWithoutUserNestedInputObjectSchema } from './OfficeContactUpdateOneWithoutUserNestedInput.schema';
|
||||
import { ProcedureTimeslotUpdateOneWithoutUserNestedInputObjectSchema as ProcedureTimeslotUpdateOneWithoutUserNestedInputObjectSchema } from './ProcedureTimeslotUpdateOneWithoutUserNestedInput.schema';
|
||||
import { InsuranceContactUpdateManyWithoutUserNestedInputObjectSchema as InsuranceContactUpdateManyWithoutUserNestedInputObjectSchema } from './InsuranceContactUpdateManyWithoutUserNestedInput.schema';
|
||||
import { PatientConversationUpdateManyWithoutUserNestedInputObjectSchema as PatientConversationUpdateManyWithoutUserNestedInputObjectSchema } from './PatientConversationUpdateManyWithoutUserNestedInput.schema'
|
||||
import { ProcedureTimeslotUpdateOneWithoutUserNestedInputObjectSchema as ProcedureTimeslotUpdateOneWithoutUserNestedInputObjectSchema } from './ProcedureTimeslotUpdateOneWithoutUserNestedInput.schema'
|
||||
|
||||
const makeSchema = () => z.object({
|
||||
username: z.union([z.string(), z.lazy(() => StringFieldUpdateOperationsInputObjectSchema)]).optional(),
|
||||
@@ -33,7 +30,6 @@ const makeSchema = () => z.object({
|
||||
staff: z.lazy(() => StaffUpdateManyWithoutUserNestedInputObjectSchema).optional(),
|
||||
npiProviders: z.lazy(() => NpiProviderUpdateManyWithoutUserNestedInputObjectSchema).optional(),
|
||||
insuranceCredentials: z.lazy(() => InsuranceCredentialUpdateManyWithoutUserNestedInputObjectSchema).optional(),
|
||||
shoppingVendors: z.lazy(() => ShoppingVendorUpdateManyWithoutUserNestedInputObjectSchema).optional(),
|
||||
updatedPayments: z.lazy(() => PaymentUpdateManyWithoutUpdatedByNestedInputObjectSchema).optional(),
|
||||
backups: z.lazy(() => DatabaseBackupUpdateManyWithoutUserNestedInputObjectSchema).optional(),
|
||||
backupDestinations: z.lazy(() => BackupDestinationUpdateManyWithoutUserNestedInputObjectSchema).optional(),
|
||||
@@ -45,9 +41,7 @@ const makeSchema = () => z.object({
|
||||
aiSettings: z.lazy(() => AiSettingsUpdateOneWithoutUserNestedInputObjectSchema).optional(),
|
||||
officeHours: z.lazy(() => OfficeHoursUpdateOneWithoutUserNestedInputObjectSchema).optional(),
|
||||
officeContact: z.lazy(() => OfficeContactUpdateOneWithoutUserNestedInputObjectSchema).optional(),
|
||||
procedureTimeslot: z.lazy(() => ProcedureTimeslotUpdateOneWithoutUserNestedInputObjectSchema).optional(),
|
||||
insuranceContacts: z.lazy(() => InsuranceContactUpdateManyWithoutUserNestedInputObjectSchema).optional(),
|
||||
patientConversations: z.lazy(() => PatientConversationUpdateManyWithoutUserNestedInputObjectSchema).optional()
|
||||
procedureTimeslot: z.lazy(() => ProcedureTimeslotUpdateOneWithoutUserNestedInputObjectSchema).optional()
|
||||
}).strict();
|
||||
export const UserUpdateWithoutClaimsInputObjectSchema: z.ZodType<Prisma.UserUpdateWithoutClaimsInput> = makeSchema() as unknown as z.ZodType<Prisma.UserUpdateWithoutClaimsInput>;
|
||||
export const UserUpdateWithoutClaimsInputObjectZodSchema = makeSchema();
|
||||
|
||||
Reference in New Issue
Block a user