#11688·sequelize

Inserting data to multiple columns at once

Author: kjarekcodeteCreated Nov 18, 2019Updated Sep 2, 2026
Labelsdocs

Issue Description

Hello! I'm building CRUD based on express/ typescript / graphql and I have a problem with inserting data to few tables at same time .

I have three tables

Posts m:n -> Songs m:n -> Artists I also have two intermediate tables .

I'm trying to create it like this:

Posts.create({
                    userId: user.id,
                    ...data,
                },{
                  logging: console.log,
                  include: [{
                      model:Songs,
                      include: [{model: Artists , as: 'artists'}]
                  }]
                })

                return null
            } catch (err) {

                throw err;
            }

First include works and songs with posts are created in proper way. Artists is empty and I don't receive anny error

What was unclear/insufficient/not covered in the documentation

How to create elements in few tables with different relations.

If possible: Provide some suggestion on how we can enhance the docs

Write here.

Additional context

Add any other context or screenshots about the issue here.

Issue Template Checklist

Is this issue dialect-specific?

  • I don't know.

Would you be willing to resolve this issue by submitting a Pull Request?

  • No, I don't have the time and I wouldn't even know how to start.