Groups
Groups
Sign in
Groups
Groups
Sequelize
Conversations
About
Send feedback
Help
create and update data
12 views
Skip to first unread message
Tomás
unread,
Jan 3, 2020, 11:22:15 AM
1/3/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Sequelize
Hello,
I have some problems with these models to create or update records.
I don't know How to create a record, on center table and associate with a record on table bussine if on table Bussines exist this record.
I'm very new on sequelize
Kinds REgards
//
BussinesModel
module
.
exports
=
(
config
)
=>
{
const
sequelize
=
setupDatabase
(
config
)
return
sequelize
.
define
(
'empresa'
, {
name :
{
type:
Sequelize
.
STRING
},
active:
{
type:
Sequelize
.
BOOLEAN
,
allowNull:
false
,
defaultValue:
true
}
})
}
//
CenterModel
module
.
exports
= (
config
)
=>
{
const
sequelize
=
setupDatabase
(
config
)
return
sequelize
.
define
(
'centro'
, {
name :
{
type:
Sequelize
.
STRING
},
active:
{
type:
Sequelize
.
BOOLEAN
,
allowNull:
false
,
defaultValue:
true
}
})
}
EmpresaModel
.
hasMany
(
CentroModel
)
CentroModel
.
belongsTo
(
EmpresaModel
)
Reply all
Reply to author
Forward
0 new messages