2armedlopin
2armedlopin
Explore posts from servers
DTDrizzle Team
Created by 2armedlopin on 5/13/2024 in #help
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 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 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),
})
)
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),
})
)
3 replies