As the work of the Association in sequelizeJs?

Hello, there are 2 tables, users and ads. I want to make a connection to when you receive all declarations and to data and who made the announcement.

This is when you create a second ad climbs error:
SequelizeForeignKeyConstraintError: insert or update on table "ads" violates foreign key constraint "ads_id_fkey"

const users_panel = sequelize.define('users_panel', {
 email: { 
 type: Sequelize.STRING, 
 allowNull: false,
 unique: true

const ads = sequelize.define('ads', {
 user_panel_id: { 
 type: Sequelize.INTEGER,
 allowNull: false
 name: { 
 type: Sequelize.STRING,
 allowNull: false

usersPanel.hasMany(ads, {foreignKey: 'user_panel_id', as: 'ads'});
ads.'s belongsto(usersPanel, {foreignKey: 'id', as: 'user'});

sequelize.sync({force: false})
.then(data => console.log('ok'))
.catch(error => console.error(error))

But both create and receive ads:

 where: search,
 limit: 100,
 offset: 0,
 include: [{
 as: 'user',
 model: usersPanel

Please tell me, maybe there's a good article which describes how to create links, for 2 (one and two) question I created about the relations table, and the responses could not get.
June 3rd 19 at 19:40
0 answer

Find more questions by tags Node.js