Unable to update because it is saying field does not exist in schema
I am trying to update the
keyword
field in stores
however I am getting the following error:
Object literal may only specify known properties, and 'keyword' does not exist in type '{ name?: string | SQL<unknown> | PgColumn<ColumnBaseConfig<ColumnDataType, string>, {}, {}>; }'.ts(2353)
Object literal may only specify known properties, and 'keyword' does not exist in type '{ name?: string | SQL<unknown> | PgColumn<ColumnBaseConfig<ColumnDataType, string>, {}, {}>; }'.ts(2353)
Schema
export const stores = pgTable("stores", {
storeId: uuid("store_id").primaryKey().notNull().defaultRandom(),
name: text("name").notNull(),
facebookPageId: text("facebook_page_id").unique(),
facebookPageAccessToken: text("facebook_page_access_token"),
facebookPageName: text("facebook_page_name"),
facebookPagePictureUrl: text("facebook_page_picture_url"),
keyword: text("keyword"),
...timestamps,
});
Schema
export const stores = pgTable("stores", {
storeId: uuid("store_id").primaryKey().notNull().defaultRandom(),
name: text("name").notNull(),
facebookPageId: text("facebook_page_id").unique(),
facebookPageAccessToken: text("facebook_page_access_token"),
facebookPageName: text("facebook_page_name"),
facebookPagePictureUrl: text("facebook_page_picture_url"),
keyword: text("keyword"),
...timestamps,
});
const updateStoreKeywordInDB = async (storeId: string, keyword: string) => {
const result = await db
.update(stores)
.set({ keyword: keyword })
.where(eq(stores.storeId, storeId))
.returning();
return result[0];
};
const updateStoreKeywordInDB = async (storeId: string, keyword: string) => {
const result = await db
.update(stores)
.set({ keyword: keyword })
.where(eq(stores.storeId, storeId))
.returning();
return result[0];
};

0 Replies