0

How can I make a relation between two tables, where the first table is called users and the second is called cars?

A user can have from 0 to infinite cars, and a car can only have one user. I need to make this relation passing ids from cars to users.

Using NodeJS TypeORM and MySQL.

1 Answer 1

1

you need to use Many-to-one / one-to-many relations . you can check this example and get some idea. https://typeorm.io/#/many-to-one-one-to-many-relations

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.