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:
+2
-8
@@ -6,7 +6,6 @@ import { StaffUncheckedCreateNestedManyWithoutUserInputObjectSchema as StaffUnch
|
||||
import { NpiProviderUncheckedCreateNestedManyWithoutUserInputObjectSchema as NpiProviderUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './NpiProviderUncheckedCreateNestedManyWithoutUserInput.schema';
|
||||
import { ClaimUncheckedCreateNestedManyWithoutUserInputObjectSchema as ClaimUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './ClaimUncheckedCreateNestedManyWithoutUserInput.schema';
|
||||
import { InsuranceCredentialUncheckedCreateNestedManyWithoutUserInputObjectSchema as InsuranceCredentialUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './InsuranceCredentialUncheckedCreateNestedManyWithoutUserInput.schema';
|
||||
import { ShoppingVendorUncheckedCreateNestedManyWithoutUserInputObjectSchema as ShoppingVendorUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './ShoppingVendorUncheckedCreateNestedManyWithoutUserInput.schema';
|
||||
import { PaymentUncheckedCreateNestedManyWithoutUpdatedByInputObjectSchema as PaymentUncheckedCreateNestedManyWithoutUpdatedByInputObjectSchema } from './PaymentUncheckedCreateNestedManyWithoutUpdatedByInput.schema';
|
||||
import { DatabaseBackupUncheckedCreateNestedManyWithoutUserInputObjectSchema as DatabaseBackupUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './DatabaseBackupUncheckedCreateNestedManyWithoutUserInput.schema';
|
||||
import { BackupDestinationUncheckedCreateNestedManyWithoutUserInputObjectSchema as BackupDestinationUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './BackupDestinationUncheckedCreateNestedManyWithoutUserInput.schema';
|
||||
@@ -17,9 +16,7 @@ import { CommunicationUncheckedCreateNestedManyWithoutUserInputObjectSchema as C
|
||||
import { TwilioSettingsUncheckedCreateNestedOneWithoutUserInputObjectSchema as TwilioSettingsUncheckedCreateNestedOneWithoutUserInputObjectSchema } from './TwilioSettingsUncheckedCreateNestedOneWithoutUserInput.schema';
|
||||
import { AiSettingsUncheckedCreateNestedOneWithoutUserInputObjectSchema as AiSettingsUncheckedCreateNestedOneWithoutUserInputObjectSchema } from './AiSettingsUncheckedCreateNestedOneWithoutUserInput.schema';
|
||||
import { OfficeContactUncheckedCreateNestedOneWithoutUserInputObjectSchema as OfficeContactUncheckedCreateNestedOneWithoutUserInputObjectSchema } from './OfficeContactUncheckedCreateNestedOneWithoutUserInput.schema';
|
||||
import { ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInputObjectSchema as ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInputObjectSchema } from './ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInput.schema';
|
||||
import { InsuranceContactUncheckedCreateNestedManyWithoutUserInputObjectSchema as InsuranceContactUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './InsuranceContactUncheckedCreateNestedManyWithoutUserInput.schema';
|
||||
import { PatientConversationUncheckedCreateNestedManyWithoutUserInputObjectSchema as PatientConversationUncheckedCreateNestedManyWithoutUserInputObjectSchema } from './PatientConversationUncheckedCreateNestedManyWithoutUserInput.schema'
|
||||
import { ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInputObjectSchema as ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInputObjectSchema } from './ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInput.schema'
|
||||
|
||||
const makeSchema = () => z.object({
|
||||
id: z.number().int().optional(),
|
||||
@@ -33,7 +30,6 @@ const makeSchema = () => z.object({
|
||||
npiProviders: z.lazy(() => NpiProviderUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional(),
|
||||
claims: z.lazy(() => ClaimUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional(),
|
||||
insuranceCredentials: z.lazy(() => InsuranceCredentialUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional(),
|
||||
shoppingVendors: z.lazy(() => ShoppingVendorUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional(),
|
||||
updatedPayments: z.lazy(() => PaymentUncheckedCreateNestedManyWithoutUpdatedByInputObjectSchema).optional(),
|
||||
backups: z.lazy(() => DatabaseBackupUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional(),
|
||||
backupDestinations: z.lazy(() => BackupDestinationUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional(),
|
||||
@@ -44,9 +40,7 @@ const makeSchema = () => z.object({
|
||||
twilioSettings: z.lazy(() => TwilioSettingsUncheckedCreateNestedOneWithoutUserInputObjectSchema).optional(),
|
||||
aiSettings: z.lazy(() => AiSettingsUncheckedCreateNestedOneWithoutUserInputObjectSchema).optional(),
|
||||
officeContact: z.lazy(() => OfficeContactUncheckedCreateNestedOneWithoutUserInputObjectSchema).optional(),
|
||||
procedureTimeslot: z.lazy(() => ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInputObjectSchema).optional(),
|
||||
insuranceContacts: z.lazy(() => InsuranceContactUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional(),
|
||||
patientConversations: z.lazy(() => PatientConversationUncheckedCreateNestedManyWithoutUserInputObjectSchema).optional()
|
||||
procedureTimeslot: z.lazy(() => ProcedureTimeslotUncheckedCreateNestedOneWithoutUserInputObjectSchema).optional()
|
||||
}).strict();
|
||||
export const UserUncheckedCreateWithoutOfficeHoursInputObjectSchema: z.ZodType<Prisma.UserUncheckedCreateWithoutOfficeHoursInput> = makeSchema() as unknown as z.ZodType<Prisma.UserUncheckedCreateWithoutOfficeHoursInput>;
|
||||
export const UserUncheckedCreateWithoutOfficeHoursInputObjectZodSchema = makeSchema();
|
||||
|
||||
Reference in New Issue
Block a user