У меня есть 2 таблицы: Users и Profile_Education. Данные пользователей поступают из формы auth0/login, а Profile_Education поступает из API с использованием node.js/express. Я хочу, чтобы Profile_education имел внешний ключ для отслеживания данных и отображения их в профиле на основе пользователя, который входит в систему.
Должен ли я использовать в своем проекте ownTo или hasOne, или я должен использовать оба?






Вы можете использовать оба из них, но используйте их там, где это уместно, в соответствии с ДОКТОР:
When information about association is present in source model we can use belongsTo. In this case Player is suitable for belongsTo because it has teamId column.
Player.belongsTo(Team) // `teamId` will be added on Player / Source modelWhen information about association is present in target model we can use hasOne. In this case Coach is suitable for hasOne because Team model store information about its Coach as coachId field.
Coach.hasOne(Team) // `coachId` will be added on Team / Target model
Я думаю, это рассеет все ваши сомнения,