Type error when inserting
Aim
insert row to
My attempt
insert row to
contactInformationTablecontactInformationTableMy attempt
// schema.ts
import { blob, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { generateId } from 'lucia';
export const userTable = sqliteTable('user', {
id: text('id')
.notNull()
.primaryKey()
.$default(() => generateId(15)),
hashedPassword: text('hashed_password').notNull(),
});
export const contactInformationTable = sqliteTable('contact_information', {
userId: text('user_id')
.notNull()
.unique()
.references(() => userTable.id),
firstName: text('first_name'),
});// schema.ts
import { blob, integer, sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { generateId } from 'lucia';
export const userTable = sqliteTable('user', {
id: text('id')
.notNull()
.primaryKey()
.$default(() => generateId(15)),
hashedPassword: text('hashed_password').notNull(),
});
export const contactInformationTable = sqliteTable('contact_information', {
userId: text('user_id')
.notNull()
.unique()
.references(() => userTable.id),
firstName: text('first_name'),
});// serverFunction.ts
await db
.insert(contactInformationTable)
.values({
userId: user.id,
firstName,
})// serverFunction.ts
await db
.insert(contactInformationTable)
.values({
userId: user.id,
firstName,
})// package.json
"drizzle-orm": "^0.31.0",
"drizzle-kit": "^0.21.4",// package.json
"drizzle-orm": "^0.31.0",
"drizzle-kit": "^0.21.4",