Answers for "sequelize one to many"

0

sequelize one to many

// To create a One-To-Many relationship in Sequelize, 
// the `hasMany` and `belongsTo` associations are used together:

const City    = sequelize.define('city', {...});
const Country = sequelize.define('country', {...});
Country.hasMany(City);
City.belongsTo(Country);

// Read more: https://sequelize.org/v4/manual/tutorial/associations.html#one-to-many-associations-hasmany-
Posted by: Guest on March-03-2022

Code answers related to "sequelize one to many"

Code answers related to "Javascript"

Browse Popular Code Answers by Language