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 { StaffOrderByRelationAggregateInputObjectSchema as StaffOrderByRelationA
|
||||
import { NpiProviderOrderByRelationAggregateInputObjectSchema as NpiProviderOrderByRelationAggregateInputObjectSchema } from './NpiProviderOrderByRelationAggregateInput.schema';
|
||||
import { ClaimOrderByRelationAggregateInputObjectSchema as ClaimOrderByRelationAggregateInputObjectSchema } from './ClaimOrderByRelationAggregateInput.schema';
|
||||
import { InsuranceCredentialOrderByRelationAggregateInputObjectSchema as InsuranceCredentialOrderByRelationAggregateInputObjectSchema } from './InsuranceCredentialOrderByRelationAggregateInput.schema';
|
||||
import { ShoppingVendorOrderByRelationAggregateInputObjectSchema as ShoppingVendorOrderByRelationAggregateInputObjectSchema } from './ShoppingVendorOrderByRelationAggregateInput.schema';
|
||||
import { PaymentOrderByRelationAggregateInputObjectSchema as PaymentOrderByRelationAggregateInputObjectSchema } from './PaymentOrderByRelationAggregateInput.schema';
|
||||
import { DatabaseBackupOrderByRelationAggregateInputObjectSchema as DatabaseBackupOrderByRelationAggregateInputObjectSchema } from './DatabaseBackupOrderByRelationAggregateInput.schema';
|
||||
import { BackupDestinationOrderByRelationAggregateInputObjectSchema as BackupDestinationOrderByRelationAggregateInputObjectSchema } from './BackupDestinationOrderByRelationAggregateInput.schema';
|
||||
@@ -19,9 +18,7 @@ import { TwilioSettingsOrderByWithRelationInputObjectSchema as TwilioSettingsOrd
|
||||
import { AiSettingsOrderByWithRelationInputObjectSchema as AiSettingsOrderByWithRelationInputObjectSchema } from './AiSettingsOrderByWithRelationInput.schema';
|
||||
import { OfficeHoursOrderByWithRelationInputObjectSchema as OfficeHoursOrderByWithRelationInputObjectSchema } from './OfficeHoursOrderByWithRelationInput.schema';
|
||||
import { OfficeContactOrderByWithRelationInputObjectSchema as OfficeContactOrderByWithRelationInputObjectSchema } from './OfficeContactOrderByWithRelationInput.schema';
|
||||
import { ProcedureTimeslotOrderByWithRelationInputObjectSchema as ProcedureTimeslotOrderByWithRelationInputObjectSchema } from './ProcedureTimeslotOrderByWithRelationInput.schema';
|
||||
import { InsuranceContactOrderByRelationAggregateInputObjectSchema as InsuranceContactOrderByRelationAggregateInputObjectSchema } from './InsuranceContactOrderByRelationAggregateInput.schema';
|
||||
import { PatientConversationOrderByRelationAggregateInputObjectSchema as PatientConversationOrderByRelationAggregateInputObjectSchema } from './PatientConversationOrderByRelationAggregateInput.schema'
|
||||
import { ProcedureTimeslotOrderByWithRelationInputObjectSchema as ProcedureTimeslotOrderByWithRelationInputObjectSchema } from './ProcedureTimeslotOrderByWithRelationInput.schema'
|
||||
|
||||
const makeSchema = () => z.object({
|
||||
id: SortOrderSchema.optional(),
|
||||
@@ -35,7 +32,6 @@ const makeSchema = () => z.object({
|
||||
npiProviders: z.lazy(() => NpiProviderOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
claims: z.lazy(() => ClaimOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
insuranceCredentials: z.lazy(() => InsuranceCredentialOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
shoppingVendors: z.lazy(() => ShoppingVendorOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
updatedPayments: z.lazy(() => PaymentOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
backups: z.lazy(() => DatabaseBackupOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
backupDestinations: z.lazy(() => BackupDestinationOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
@@ -47,9 +43,7 @@ const makeSchema = () => z.object({
|
||||
aiSettings: z.lazy(() => AiSettingsOrderByWithRelationInputObjectSchema).optional(),
|
||||
officeHours: z.lazy(() => OfficeHoursOrderByWithRelationInputObjectSchema).optional(),
|
||||
officeContact: z.lazy(() => OfficeContactOrderByWithRelationInputObjectSchema).optional(),
|
||||
procedureTimeslot: z.lazy(() => ProcedureTimeslotOrderByWithRelationInputObjectSchema).optional(),
|
||||
insuranceContacts: z.lazy(() => InsuranceContactOrderByRelationAggregateInputObjectSchema).optional(),
|
||||
patientConversations: z.lazy(() => PatientConversationOrderByRelationAggregateInputObjectSchema).optional()
|
||||
procedureTimeslot: z.lazy(() => ProcedureTimeslotOrderByWithRelationInputObjectSchema).optional()
|
||||
}).strict();
|
||||
export const UserOrderByWithRelationInputObjectSchema: z.ZodType<Prisma.UserOrderByWithRelationInput> = makeSchema() as unknown as z.ZodType<Prisma.UserOrderByWithRelationInput>;
|
||||
export const UserOrderByWithRelationInputObjectZodSchema = makeSchema();
|
||||
|
||||
Reference in New Issue
Block a user