Тёмный

Postgres & Sequelize - Associations 

Web Dev Journey
Подписаться 10 тыс.
Просмотров 44 тыс.
50% 1

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 56   
@pedrohw14
@pedrohw14 3 года назад
A big thank you, bro. I was getting crazy (believe you or not) for already more than 6 months trying to understand how this works and how to apply it. Finally I could create this association.
@WebDevJourney
@WebDevJourney 3 года назад
awesome to hear that, good to know my videos are helping others!
@hashirmughal5625
@hashirmughal5625 Год назад
@@WebDevJourney love from pakistan
@albertohuerta
@albertohuerta 2 года назад
Hi, simply wanted to thank you for your videos.. watched the entire playlist. You have a great teaching style!
@nafihpp
@nafihpp Год назад
It took me 2 months to find a video like this 💯 Great Tutorial
@WebDevJourney
@WebDevJourney 3 года назад
Okay I know this is a loooong video. But hopefully you learned something because if not, well you need to watch the video again.
@SinisterSpatula
@SinisterSpatula 2 года назад
Very nice explanation, I was struggling to understand how many-to-many worked, and now I get it :D
@juanpalacios593
@juanpalacios593 3 года назад
Excelent explanation!! very clear and easy to follow through!
@derppey
@derppey 3 года назад
Excelent comment!! very clear and easy to follow through!
@pawanpatel4338
@pawanpatel4338 11 месяцев назад
thank you so much bro, you made it to easy to understand!❤
@kavinbarath970
@kavinbarath970 8 месяцев назад
You did great man, I understood well about the relations and special magic methods.
@curiousprogrammer90
@curiousprogrammer90 3 года назад
Keep up the good work! Would be nice to see some database designs on real world problems. Thanks for your videos!
@Ruhgtfo
@Ruhgtfo Год назад
Awesome explanations thanks dude
@j8ahmed
@j8ahmed 3 года назад
"Dude I hate when my printer just starts to update on it's own. It gives me the jumps." LOL that was so random but funny.
@jetmartin9501
@jetmartin9501 3 года назад
Well done! It's a bit complicated...especially the Many-to-Many relationships but I think you did a good job. Thanks for taking the time to make this video. Cheers.
@nouralsatari6424
@nouralsatari6424 2 года назад
Thank you for existing
@snyredbaron21
@snyredbaron21 3 года назад
Wow! Best explanation ever! You really do a great job! Btw, I love the part 39:01 "I don't have friends" XD I hope you were joking!
@xtgamezg
@xtgamezg 3 года назад
Nice video. I was wondering what extension you are using to draw on your screen?
@WebDevJourney
@WebDevJourney 3 года назад
its not an extension it's a software called epic pen and the best part is its free epic-pen.com/
@xtgamezg
@xtgamezg 3 года назад
@@WebDevJourney thank you so much
@asogbaibrahim9618
@asogbaibrahim9618 2 года назад
You save a life bro!!! Thank you.
@shashankkr1008
@shashankkr1008 11 месяцев назад
Thank you so much sir!
@sandiprumbalama7086
@sandiprumbalama7086 Год назад
its really a great video...thanks alot
@Onoffrei
@Onoffrei 3 года назад
very well explained, thank you
@LePhenixGD
@LePhenixGD 2 года назад
Very useful mate! Thank you for this tutorial
@germantellez2710
@germantellez2710 2 года назад
Hey great tutorial! How could we do that but having the models in separated files? Sequelize throws an error
@turingcs2001
@turingcs2001 3 года назад
What is the VSC extension you use to draw on screen? That's super cool!
@WebDevJourney
@WebDevJourney 3 года назад
its not an extension it's a software called epic pen and the best part is its free epic-pen.com/
@tanmaypaul4579
@tanmaypaul4579 2 года назад
i faced this issue : "createdUser.addRole is not a function", if i remove as: from the Role association option, then it works fine. what to do???
@adrianrobertoaguilarsandic6999
@adrianrobertoaguilarsandic6999 2 года назад
Excelent tutorial, thanks man!
@mdivs
@mdivs 3 года назад
A big thank you, bro.
@emmanueltoluwanimi8784
@emmanueltoluwanimi8784 2 года назад
Very resourceful
@louisv3800
@louisv3800 3 года назад
thank you sir, it helps me
@krithikashivaram1143
@krithikashivaram1143 3 года назад
Very well explained!
@EmmanuelOlabisi-d4o
@EmmanuelOlabisi-d4o Год назад
pls i have an issue, how do i do the relatioship if all my models are in different files
@WebDevJourney
@WebDevJourney Год назад
You would need to export then import where needed then do the link.
@MegaGian2009
@MegaGian2009 3 года назад
Hey men, im struggling a lot with a big API project that im developing. In this video, you use asociations between tables that are created by a const. Usign sequelize-CLI, every time that you create a new model, a new file is created and the asociations are declared in a static associate(models) {}. Its too dificult to explain doing associations by that method? Or maybe make a video about it?
@WebDevJourney
@WebDevJourney 3 года назад
trying to understand your question. You want to know how to create associations using the Sequelize-CLI?
@MegaGian2009
@MegaGian2009 3 года назад
@@WebDevJourney Yes, im sorry, my english isn't so good lol. I think you create the sequelize/models manually. When using Sequelize-CLI to create models, the associatios have a little different sintax. In my project, I have created the migrations files with the foreings keys associated columns and tables, but, when I wrote the associations in models file, things are quite different and having some errors of type "ForeignKeyConstraintError"
@WebDevJourney
@WebDevJourney 3 года назад
@@MegaGian2009 I found this levelup.gitconnected.com/creating-sequelize-associations-with-the-sequelize-cli-tool-d83caa902233 Let me know if it helps if not ill try to make a video around this
@MegaGian2009
@MegaGian2009 3 года назад
@@WebDevJourney i think i already read that post, it was posted before sequelize v6 launch. So, the models creations are different. Using the same logic structure of a one-to-Many associations don't work using sequelize v6.
@WebDevJourney
@WebDevJourney 3 года назад
@@MegaGian2009 then I will try to do a video on that when I have the time, Sorry that I can not do it faster
@rufaidajumaa2566
@rufaidajumaa2566 3 года назад
Thank you
@bunnydance10
@bunnydance10 9 месяцев назад
Any link for the project code?
@blunderfoxbeta
@blunderfoxbeta 2 года назад
Anyone facing issue with hasMany association as its returning only return one record😕😕😕😕
@8koi245
@8koi245 Год назад
I did an easier version of the code, kind of makes aa dirty model loading but in the end it's cleaner... Anyway TYSM I got so lost in the explanation I was given :c
@faridzo1017
@faridzo1017 3 года назад
Thank you for this video :), how to do with 3 tables, users, posts, comments ? 1 user has multiple posts, 1 post has only one user, 1 post has multiple comments, 1 user has multiple comments, 1 comment has only one user
@faridzo1017
@faridzo1017 3 года назад
I found how to do it, in file user i add : User.belongsToMany(models.Post, { through: "Comments" }); and in file post i add : Post.belongsToMany(models.User, { through: "Comments" }) in folder migrations in file comment : i add that : userId: { type: Sequelize.INTEGER, references: { model:{ tableName: "Users" }, key: "id" }, allowNull: false }, postId: { type: Sequelize.INTEGER, references: { model:{ tableName: "Posts" }, key: "id" }, allowNull: false
@jahnathanexantus6098
@jahnathanexantus6098 2 года назад
Hey, is there a source code that i can possibly look at?
@WebDevJourney
@WebDevJourney 2 года назад
here you go github.com/webdevjourneyWDJ/postgres_sequelize
@abdelilahbouhou5297
@abdelilahbouhou5297 3 года назад
thank you broo
@standforlife1
@standforlife1 2 года назад
4:10 one to one
@m.iqbalmaulana7328
@m.iqbalmaulana7328 2 года назад
hmm I still dont get it in many-to-many relationship, why when user "wdj" followed "tom" the code say wdj.addUser(tom), isn't that should be wdj.addFollow(tom) ? assuming const wdj = user.findOne({where: {name: "wdj"}}) and const tom = user.findOne({where:{name: "tom"}})
Далее
Postgres & Sequelize - Loading Data
19:09
Просмотров 3,9 тыс.
How many can you smash?🍫 IB : Florin
00:19
Просмотров 2,9 млн
GENIUS FOOD HACKS 🍰 #shorts
00:36
Просмотров 17 млн
Sequelize ORM Tutorial (all in one video)
49:59
Просмотров 163 тыс.
I tried 8 different Postgres ORMs
9:46
Просмотров 418 тыс.
Become a bash scripting pro - full course
36:00
Просмотров 60 тыс.
How to connect a Nodejs app to Postgres using Docker
21:45
Postgres & Sequelize - Models
21:27
Просмотров 11 тыс.