20 lines
326 B
JavaScript
20 lines
326 B
JavaScript
|
module.exports = (sequelize, DataTypes) => {
|
||
|
const Brands = sequelize.define(
|
||
|
"Brands",
|
||
|
{
|
||
|
name: DataTypes.STRING
|
||
|
},
|
||
|
{}
|
||
|
);
|
||
|
|
||
|
Brands.associate = function(models) {
|
||
|
Brands.hasMany(models.Cars, {
|
||
|
as: "Cars",
|
||
|
foreignKey: "brandId",
|
||
|
sourceKey: "id"
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return Brands;
|
||
|
};
|