After this new update I am getting an introspection error schema below "drizzle-kit": "^0.21.1",

Error: There is not enough information to infer relation "public.users.twoFactorConfirmation"

export const usersRelations = relations(users, ({ one }) => ({
  twoFactorConfirmation: one(twoFactorConfirmation),
}))


export const twoFactorConfirmation = createTable('twoFactorConfirmation', {
  id: text('id')
    .primaryKey()
    .$defaultFn(() => randomUUID()),
  userId: text('userId').references(() => users.id, { onDelete: 'cascade' }),
})


export const users = createTable(
  'user',
  {
    id: text('id')
      .primaryKey()
      .$defaultFn(() => randomUUID()),
    image: text('image'),
    name: text('name'),
    email: text('email').notNull().unique(),
    emailVerified: timestamp('emailVerified', { mode: 'date' }),
    password: text('password'),
    role: text('role').notNull().default('USER'),
    phoneNumber: text('phone_number'),
    phoneVerified: timestamp('phone_verified', { mode: 'date' }),
    phoneVerificationCode: text('phone_verification_code'),
    createdAt: timestamp('created_at')
      .default(sql`CURRENT_TIMESTAMP`)
      .notNull(),
    updatedAt: timestamp('updatedAt'),
    isTwoFactorEnabled: boolean('isTwoFactorEnabled').default(false),
    stripeCustomerId: text('stripeCustomerId'),
    paymentStatus: text('paymentStatus', {
      enum: ['paid', 'unpaid', 'no_payment_required'],
    }),
  },
  (example) => ({
    nameIndex: index('name_idx').on(example.name),
  })
)
Was this page helpful?