Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamβ€’3y agoβ€’
15 replies
πŸ‡¨πŸ‡­ Marko Bolliger <cannap>

update multiple fields

Hi is there a other way to update multiple fields

currently i do it like this
    const updatePollOption = (option: PollOptionsSchema) => {
      const { isNew, id, ...options } = option;
      return db
        .update(tables.pollOptions)
        .set({ ...options, pollId: pollId })
        .where(eq(tables.pollOptions.id, option.id));
    };

    const result = await Promise.all(
      pollOptions.map((option) => updatePollOption(option))
    );
    const updatePollOption = (option: PollOptionsSchema) => {
      const { isNew, id, ...options } = option;
      return db
        .update(tables.pollOptions)
        .set({ ...options, pollId: pollId })
        .where(eq(tables.pollOptions.id, option.id));
    };

    const result = await Promise.all(
      pollOptions.map((option) => updatePollOption(option))
    );
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Auto update timestamp fields
Drizzle TeamDTDrizzle Team / help
3y ago
update multiple rows
Drizzle TeamDTDrizzle Team / help
3y ago
Common Fields Logic For Multiple Tables
Drizzle TeamDTDrizzle Team / help
5mo ago
Unique constraint on multiple fields/columns
Drizzle TeamDTDrizzle Team / help
3y ago