Drizzle update enum

Hi everyone I am currently playing with drizzle and enum with postgres. However it doesn't seems to allow update ? For example with this code:
export const updateExerciseTag = (tags: Exercise["tags"]) => {
console.log(tags); // ['chest','legs']
return db.update(exercises).set({ tags });
};
export const updateExerciseTag = (tags: Exercise["tags"]) => {
console.log(tags); // ['chest','legs']
return db.update(exercises).set({ tags });
};
I get the following error (atteched, see image). Here is the schema of the table in question:
export const exercsieTagsEnum = pgEnum("exercise_tag", [
"legs",
"chest",
"biceps",
"triceps",
/*.......*/
]);

export const exercises = pgTable(
"exercise",
{
id: uuid("id").defaultRandom().primaryKey(),
/*.......*/
tags: exercsieTagsEnum("tags").array(),
}
);
export const exercsieTagsEnum = pgEnum("exercise_tag", [
"legs",
"chest",
"biceps",
"triceps",
/*.......*/
]);

export const exercises = pgTable(
"exercise",
{
id: uuid("id").defaultRandom().primaryKey(),
/*.......*/
tags: exercsieTagsEnum("tags").array(),
}
);
Am I allowed to udpate the tags field in the exercise table with for example ['chest'] ? Why am I getting an error when I do so ?
No description
No description
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server