Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda