Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
SEQUELIZE: I'm trying to seed data for a wish list table for a website I'm building

So basically using sequelize I created a user model, a product model, and a wishlist model. The wishlist needs to be seeded but I hypothetically want a user to be able to insert more than 1 item into a row. So if I have a column titled product_id I want to be able to put multiple products into that column. Here's the seed file for reference:

const { Wishlist } = require('../models');

const wishlistData = [
  {
    user_id: 1,
    bike_id: 4,
    part_id: 1
  }
];
const seedwishlist = () => Wishlist.bulkCreate(wishlistData);

module.exports = seedwishlist;

I thought that for the part_id column I can maybe have an array-like

part_id: [1,2,3]

But it gives me an error that it truncates and I can't seed the file.

Any suggestions on solving this problem?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!