Sequelize Tutorial: Episode 11 - Associations (hasOne, belongsTo, hasMany, belongsToMany)

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024

ความคิดเห็น • 97

  • @jameshalstead6742
    @jameshalstead6742 2 ปีที่แล้ว +14

    I've searched for days, maybe weeks. Found a few very beginner videos, even my favorite Udemy courses don't cover sequelize to the extent you did in this series. You have an easy voice to listen to, you don't move too fast, you do an amazing job explaining literally everything, I feel excited to finally be able to work on the sequelize part of my project that I have been putting off. I hope you continue this series but I would highly encourage you to think about selling a course like this on Udemy, I would seriously pay $10 for it maybe even $20 (I only pay for Udemy if it's on sale lol) if it had even further advanced concepts. Either way, if your goal is to find more followers, I say don't give up, you will get there. Your content so far in this series is A+. Thank you for your time

    • @_Greenflag_
      @_Greenflag_ 5 หลายเดือนก่อน

      Beginners need tutorial, professionnals consult the official documentation.

  • @alovesxo9581
    @alovesxo9581 3 ปีที่แล้ว +20

    Wittcode you are amazing! I’ve been struggling with associations forever!!! 💓

    • @WittCode
      @WittCode  3 ปีที่แล้ว +1

      Thanks so much for your continued support! 😄

    • @testuser2427
      @testuser2427 ปีที่แล้ว

      Amazing you are an amazing source for a startup project

  • @mustafa-ahmed-dev
    @mustafa-ahmed-dev 2 ปีที่แล้ว +5

    I was stuck at this subject for probably 2 weeks, and you saved me.
    Waiting for the part 2 :) 01:01:03

  • @SivaKumar-gn1bp
    @SivaKumar-gn1bp 11 หลายเดือนก่อน +1

    Thank you so much ❤. This tutorial is very clear and easily understandable.

  • @AbubakerMahmoudshangab
    @AbubakerMahmoudshangab 11 หลายเดือนก่อน

    WittCode in one word only you are : #awesome. In more than one word: You are very good #speaker, #explainer and #facilitator. Thank you very veru very much. You have amazing future, be prepared.

  • @arun-ph9cn
    @arun-ph9cn ปีที่แล้ว

    I was struggling in understanding the relational tables in sequelize SQL. This 1 hour video has been a life saver for me. Thank you very much for uploading

  • @pedrobonorino9063
    @pedrobonorino9063 2 ปีที่แล้ว +1

    I've been trying to create and use associations correctly for 2 weeks, finally a video that TRULY helped me. Thanks man, take my sub and heart

  • @asamitam1605
    @asamitam1605 2 ปีที่แล้ว

    Just finished watching the entire series. Thank you so much for your time and great teaching. ❤❤

  • @tamuahmed5303
    @tamuahmed5303 3 ปีที่แล้ว +2

    Waiting for the next video. Thanks for this series.

    • @WittCode
      @WittCode  3 ปีที่แล้ว +1

      Good to hear from you again Tamu! I am currently working on the rest of this series and a few other videos as well so it'll be up soon! 😃

  • @theryanmark
    @theryanmark 2 ปีที่แล้ว

    Thank you so much! I've been searching for clarity on this topic for days. Your saving my life! 🤣

  • @nubiemir7234
    @nubiemir7234 2 ปีที่แล้ว

    love each and every part of this series.... thanxs Wittcode,

  • @SanMati14
    @SanMati14 ปีที่แล้ว

    Amazing video, so clear to teach everything. Thank you!

  • @cesarmuzio1154
    @cesarmuzio1154 2 ปีที่แล้ว

    Thank you so much for this ! I have to deliver a test, and I had no clue about sequelize..this series helped me a lot !

  • @akr_ijk
    @akr_ijk 2 ปีที่แล้ว

    just finished ...I cleared many things about sequeliz.Thank you very much......

  • @TVfunhouseGAMES
    @TVfunhouseGAMES 2 ปีที่แล้ว

    This was fantastic. Very detailed and thorough, clear audio/speech, and great content. This helped me out a lot!

  • @ham97oda
    @ham97oda ปีที่แล้ว

    A tons of thanks, you made it really easy to understand💐

  • @dhairyachauhan6622
    @dhairyachauhan6622 7 หลายเดือนก่อน

    Hello sir loved your course on sequlize, just wanted to add please cover more methods such as how to update values in the through column and many more if you get time,
    once again loved your content.

  • @nickwoodward819
    @nickwoodward819 2 ปีที่แล้ว

    This is a great video, you deserve more subs. Looking forward to looking at the rest of the series!

  • @iamlookto
    @iamlookto 2 ปีที่แล้ว

    This helped me so much learning sequelize. Thank you so much!

  • @Sergio-ef5pz
    @Sergio-ef5pz ปีที่แล้ว

    This looks terrific! Was interested on the topic of this video, but I'll checkout the entire playlist, thanks!!

  • @olaleyeolabanjo
    @olaleyeolabanjo ปีที่แล้ว

    Thank you so much. I have watched all the videos.
    Next videos please🙏🙏🙏

  • @ztamnaja
    @ztamnaja 2 ปีที่แล้ว

    Thank you a lot wittcode! i'm waiting for next series.😁

  • @fabiandiaz1102
    @fabiandiaz1102 ปีที่แล้ว

    Excellent playlist!!! you are a great teacher. I'm really interested in the second part of associations, to unleash the full potential of RDBM with sequelize. Thanks again

  • @bojjabheemaraju387
    @bojjabheemaraju387 2 ปีที่แล้ว

    Thanks a lot! This tutorial is great. I learned more from this tutorial.

  • @Hawtep
    @Hawtep 2 ปีที่แล้ว +1

    I was having a bad time with associations in Sequelize and this helped me a lot, thank you

  • @ninigogatishvili650
    @ninigogatishvili650 ปีที่แล้ว

    I have just finished the series and this was very amazing

  • @mimiocean8
    @mimiocean8 2 ปีที่แล้ว

    you made it all so simple thank you so much 😭😭

  • @peytoncastillo4508
    @peytoncastillo4508 ปีที่แล้ว

    Great video!

  • @millen_basquiat
    @millen_basquiat ปีที่แล้ว

    Amazing video! Thank you so much for this, it's exactly what i was looking for.

  • @MorSag
    @MorSag ปีที่แล้ว

    Great tutorial (the whole 11-chapters series!). Thank you!
    Here's a request for you: please prepare a tutorial that shows how to prepare and maintain a real life dev-test-prod sequelize env. From installing the sequelize-cli, initializing the project, applying DDL along the life of the project, pushing from dev to test to prod, and other considerations such as: shall we maintain a separate project for the DB, or should it be part of the application (e.g. an Angular app using the DB)?

  • @codeblood87
    @codeblood87 2 ปีที่แล้ว

    Thank you so much for your hard works.

  • @davinder95
    @davinder95 ปีที่แล้ว

    thankyou for this wonderful course

  • @NikhilPatil647
    @NikhilPatil647 10 หลายเดือนก่อน

    great video, keep the good bro :D

  • @princekumarrana4248
    @princekumarrana4248 7 หลายเดือนก่อน

    Nicely explained. Thankyou

  • @nathanteissier1191
    @nathanteissier1191 ปีที่แล้ว

    incredible serie of video ! keep going !!

  • @elotfreelancing1791
    @elotfreelancing1791 ปีที่แล้ว

    brother your vids are nice.

  • @蹦太君-o4d
    @蹦太君-o4d 2 ปีที่แล้ว

    oh yeah~! I'm almost done!!

  • @yasserhy
    @yasserhy ปีที่แล้ว

    I LOVE your videos. It really helped my understand how to use Sequelize. But where is the advanced video about associations you mentioned? There are really important options we are missing. Specially when the junction table has other columns that we want to retrieve and show to the user

  • @AbdulGafoor-yf4zx
    @AbdulGafoor-yf4zx 2 ปีที่แล้ว

    very good tutorial i had seen ever on sequelize. please make more videos and courses.

    • @WittCode
      @WittCode  2 ปีที่แล้ว

      Thanks so much Abdul! I will certainly be making more sequelize videos! 😀

  • @AmirhosseinMehrvarz
    @AmirhosseinMehrvarz ปีที่แล้ว

    It was very useful

  • @mugiwaranoshanks2241
    @mugiwaranoshanks2241 3 ปีที่แล้ว

    This is AMAZING !!! Thanks Wittcode!

    • @WittCode
      @WittCode  3 ปีที่แล้ว +1

      Good to hear from you again! Thanks again haha😁

  • @mohamedyoussef8835
    @mohamedyoussef8835 ปีที่แล้ว

    Awesome video ++++++++ thank you 🙂

  • @estudiar173
    @estudiar173 ปีที่แล้ว

    good video my dude

  • @orencohen4502
    @orencohen4502 2 ปีที่แล้ว +1

    Hi withcode, thanks for the tutorial, however I don't understand why you don't explain how to update many to many relationships at the end.
    Can you tell me how it works? the destroy works very well in cascade but the update does not work.
    You can help me please ?

  • @hudyusufatsigah7626
    @hudyusufatsigah7626 2 ปีที่แล้ว

    great content thank's

  • @AlucardVaz
    @AlucardVaz ปีที่แล้ว

    Justin (strangers things) are you ?
    xD
    Thx for the info bro, very useful

  • @adarshaniket505
    @adarshaniket505 ปีที่แล้ว

    Great work bro❤

  • @muhammadyeasin722
    @muhammadyeasin722 ปีที่แล้ว

    Amazing series. Thank you very much.
    I want to know. When you publish second part of your video?
    Though you publish this video 1 year ago.

  • @user-cr8ln4rm4u
    @user-cr8ln4rm4u 2 ปีที่แล้ว

    Thank you very much!

  • @hl2054
    @hl2054 ปีที่แล้ว

    thank you

  • @MS-gi3hc
    @MS-gi3hc 6 หลายเดือนก่อน

    Great tutorial!

    • @WittCode
      @WittCode  หลายเดือนก่อน

      😀

  • @brandyn6124
    @brandyn6124 2 หลายเดือนก่อน

    For anybody following along, if you have been separating your Models in separate files, you will need to create a new file (which I named associations.js in my models folder), and defined the associations in that file. Afterwards, export those models in that file. Then in index.js, or wherever you run the file, you will import those Models from the association file.

    • @johanaguirreapaza5458
      @johanaguirreapaza5458 หลายเดือนก่อน +1

      I had to do the same to define the relations, but I still got a problem when working with many-to-many relations. For some reason, that I do not understand, the method .addX() does not appear to me and so I cannot add new data to my intermediate table. I tried to look for a solution on different pages but I could not find a solution.

  • @laveeshsharma4517
    @laveeshsharma4517 6 หลายเดือนก่อน

    Really helped me a lot.Thanks

    • @WittCode
      @WittCode  หลายเดือนก่อน

      😀

  • @tayyabferozi
    @tayyabferozi 3 ปีที่แล้ว

    I am waiting for the next series you were talking about

    • @WittCode
      @WittCode  3 ปีที่แล้ว +2

      Hey Tayyab thanks for watching! I am currently working on the rest of the series and a few other videos! So it'll be up soon! 😁

  • @saminserge2674
    @saminserge2674 4 หลายเดือนก่อน

    Many thanks Dear for your amazing videos

    • @WittCode
      @WittCode  หลายเดือนก่อน

      😀

  • @jerrycelozzi
    @jerrycelozzi 2 ปีที่แล้ว

    first of all THANK YOU...
    I have seen that when you create associations on tables that have the paranod option set to true there is a need to use hooks for the create delete and update methods to work correctly ....
    I succeeded .... but since I'm sure you are better than me ... could you make video tutorials where you explain this context?
    ....thank you!

  • @InspectorDubb
    @InspectorDubb 5 หลายเดือนก่อน

    @wittcode Is there any news on the next videos for aliasing etc? would really enjoy the last pieces of this! The series has been absolutely amazing

    • @WittCode
      @WittCode  หลายเดือนก่อน

      I'll never say never!

  • @tonymanuel9831
    @tonymanuel9831 ปีที่แล้ว

    When a new column is added, it always takes the last position in the table. How to insert it into a specific position

  • @kumar_sanjeevdutta1069
    @kumar_sanjeevdutta1069 8 หลายเดือนก่อน

    Great

  • @itzDoraemon
    @itzDoraemon 2 ปีที่แล้ว

    please use "dark theme" with future tutorials 🙏

  • @ilyesteffaha572
    @ilyesteffaha572 2 ปีที่แล้ว

    i want to add a post that has multiple tags i made a model for each and did the associations between them the middle table was created now how can i add them simultanesly when i try to add a post i don't want to assign them tags after the post is created like the one you did i'm stuck i hope you can read my message

  • @HaHA-tn3bf
    @HaHA-tn3bf หลายเดือนก่อน

    Wonderful videos

    • @WittCode
      @WittCode  หลายเดือนก่อน

      Glad you like them!

  • @nickwoodward819
    @nickwoodward819 2 ปีที่แล้ว

    Episode 12 am cry.
    Any chance of looking at includes? Have recently come across a problem with using findAndCountAll with a many to many relationship in the include option. Have been told it's not possible and that I need to create the association manually using a one to many relationship on the join table

  • @nickwoodward819
    @nickwoodward819 2 ปีที่แล้ว

    @23:16 - allowNull: false doesn't seem to have any effect for me here

  • @bhojakrahul5880
    @bhojakrahul5880 2 ปีที่แล้ว

    @WittCodE I have one issue if i have
    1) item tables (field): - id,itemName,price
    2) userTabel (fiels) ;- id, userName,itemId
    example for item table : 1 abc 100
    2 xyz 300
    3 ead 300
    example for user table :- 1 raa "1,2,3"(1,2,3 are ids of item table)
    is that pososible to do assocation and get the data?

  • @dok3820
    @dok3820 ปีที่แล้ว +1

    Still desperately waiting for part 2.....

  • @arsamhashempour8156
    @arsamhashempour8156 2 หลายเดือนก่อน

    THAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANK YOU A LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT

    • @WittCode
      @WittCode  หลายเดือนก่อน

      YYYYOOOOUUURREEEE WEEEEELLLCCCOOMME 😀

  • @sssp1517
    @sssp1517 4 หลายเดือนก่อน

    Excelent series!! I have a question if you got the time. What if one customers wants to buy the same laptop on two different occasions? I have been playing with sequelize, and while this is a common use case, i am getting an error saying theres a unique constraint on the fks (meaning there can be no duplicates of fk combinations). I triend different solutions i found online but nothing seems to work. Do you know how to work around this? Thank you ❤

    • @WittCode
      @WittCode  หลายเดือนก่อน

      Thanks! Sounds like that's a many to many relation. So I would create that link table where the primary key is the primary keys for customer and laptop. If you want multiple entires you could remove the unique constraint on solely the customer id and laptop id.

  • @angelleal3005
    @angelleal3005 2 ปีที่แล้ว

    Has it ever happened to anyone that sequelize changes the name of the query params to Capital letters ? In my app I trying to implement a simple login but when I query the db to match the info already stored with what's been given by the said query the process fails because a certain column doesn't exist due to the fact that sequelize change the column name to capital in the executed query. If anyone knows or has any clue on how to fix this I would very much appreciate it.

  • @codemind1822
    @codemind1822 ปีที่แล้ว

    Man thank you but I am still confused about the 30:41 case. Why can we have one to many relationship for Country.hasOne(Capital);
    Capital.belongsTo(Country);
    clearly states country has one capital. then both london and paris becomes the capital of France. Does not make sense. I think the explanation is rather vague there. Then you start explaining one to many relationships. That does not really clear up the problem here. because there, you clearly state hasOne not hasMany.

  • @ActionReaction..
    @ActionReaction.. 2 ปีที่แล้ว

    Every tutorial puts all the models into one file when showing manytomany relations. this doesn't make any sense because the same code wont work when you have multiple modelfiles like usermodel.js and productmodel.js and you wan't to create a table out of that. it will give an error saying '.belongsToMany called with something that's not a subclass of Sequelize.Model'

  • @gurureddy1861
    @gurureddy1861 2 ปีที่แล้ว +1

    OnDelete is not working if i explicitly give the foreign key value like
    A.hasOne(B, { foreignkey: name , OnDelete:'CASCADE' })
    if anyone knows the solution pls give reply

    • @ztamnaja
      @ztamnaja 2 ปีที่แล้ว

      me too, how you fix it???

  • @gurureddy1861
    @gurureddy1861 2 ปีที่แล้ว

    I have given extra property (id) to the junction table and given default value as UUID4, while adding entries id is set to null and throwing null constrainst error, if anyone knows the solution pls ping me

  • @avinashparakhiya
    @avinashparakhiya 2 ปีที่แล้ว

    super content but where is source code

  • @tinyreborn2954
    @tinyreborn2954 18 วันที่ผ่านมา

    Bruh... where is the part 2 :(

  • @ummanmemmedov
    @ummanmemmedov 4 หลายเดือนก่อน

    Why there is not any new video?

    • @WittCode
      @WittCode  หลายเดือนก่อน

      I personally don't use ORMs very much anymore! Got a little burnt out from Sequelize too

  • @JIlu46
    @JIlu46 3 หลายเดือนก่อน

    amazing video but using a white bg on your editor is evil lol

    • @WittCode
      @WittCode  หลายเดือนก่อน +1

      haha yeah this when was I was relatively new to development. I always preferred light mode things back then! Definitely not anymore! 😀

  • @Osuran_Bogaa
    @Osuran_Bogaa ปีที่แล้ว

    please do not use white mode on videos

  • @mehmetbakii
    @mehmetbakii 8 หลายเดือนก่อน

    I got error when I do many to many via junction table;
    Order many to many Product jsution table OrderProduct
    await currentOrder.addOrderProducts(foundProduct)
    TypeError: currentOrder.addOrderProducts is not a function