---
title: "Discussion on \"Define association in Sequelize - Nest js\" | Hashnode"
description: "Discussion on \"Define association in Sequelize - Nest js\". Say we have two model portfolio and stock. Each item from the portfolio belongs to one stock. We need to define this relationship in sequelize. The general rule is to have a column stockId in the portfolio that will map with the id from stock table. ..."
url: "https://hashnode.com/posts/define-association-in-sequelize-nest-js/64df20ffcaac9dadf50d2a4d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Define association in Sequelize - Nest js](https://sumanad.hashnode.dev/define-association-in-sequelize-nest-js?utm_source=hashnode&utm_medium=feed)

Say we have two model portfolio and stock. Each item from the portfolio belongs to one stock. We need to define this relationship in sequelize. The general rule is to have a column stockId in the portfolio that will map with the id from stock table. ...

Aug 18, 2023 · 2 min read · sumanad.hashnode.dev  
Read the article

-   [#sequelize](https://hashnode.com/tag/sequelize)
-   [#assocation](https://hashnode.com/tag/assocation)
-   [#foreignkey](https://hashnode.com/tag/foreignkey)

## Written by

[Suman Adhikari](https://hashnode.com/@SumanAdhikari)

@SumanAdhikari

  
[View profile](https://hashnode.com/@SumanAdhikari)

...

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
