{"id":9,"date":"2023-11-02T16:50:33","date_gmt":"2023-11-02T16:50:33","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/nimanan\/?p=9"},"modified":"2023-11-02T16:50:33","modified_gmt":"2023-11-02T16:50:33","slug":"my-experience-with-sequelize","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/nimanan\/2023\/11\/02\/my-experience-with-sequelize\/","title":{"rendered":"My Experience with Sequelize"},"content":{"rendered":"\n<p>As I reach the midpoint of the term, I&#8217;d like to reflect a bit on one of the new technologies I&#8217;ve learned. Sequelize, an Object-Relational Mapping (ORM) library for Node.js, has stood out to me. In this blog post, I&#8217;ll discuss why Sequelize is a game-changer for project management applications, its practical applications, and how it could be enhanced to further empower developers like me.<\/p>\n\n\n\n<p><strong>What is Sequelize and why use it?<\/strong><\/p>\n\n\n\n<p>Sequelize is an ORM for Node.js that simplifies database management by allowing developers to interact with relational databases using JavaScript objects. There are several reasons why I&#8217;ve grown to love Sequelize throughout my capstone project:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Simplicity<\/strong>: Instead of writing raw SQL queries, I&#8217;m able to define models and relationships in JS, making the codebase cleaner and more readable. This has sped up my teammates&#8217; and my progress.<\/li>\n\n\n\n<li><strong>Database Agnostic<\/strong>: Many different relational databases including MySQL, Postgres, SQLite, MSSQL are supported by Sequelize. In fact, if we wanted to change our database now, it would be as simple as changing a few configuration headers.<\/li>\n\n\n\n<li><strong>Associations<\/strong>: Sequelize has simple built-in methods for defining associations between models such as hasOne(), hasMany(), belongsTo(), and belongsToMany(). This has made defining 1:M relationships such as Users to Tasks a breeze.<\/li>\n<\/ol>\n\n\n\n<p><strong>How could Sequelize be improved?<\/strong><\/p>\n\n\n\n<p>While Sequelize is a powerful ORM with a wide range of useful features, there&#8217;s still room for improvement. Here are a few ways I believe Sequelized could be enhanced:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Improved Documentation<\/strong>: Sequelize does a great job explaining the basics, but it becomes difficult to follow how to set up M:M relationships, and how to perform complex queries on models involved in these relationships. A more readable section on this topic with example code would be helpful.<\/li>\n\n\n\n<li><strong>Errors<\/strong>: When Sequelize throws an error after performing a query, it isn&#8217;t always clear what caused the problem. Better built-in error reporting would be a great addition to speed up development.<\/li>\n<\/ol>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>Sequelize has proven to be an invaluable tool in the development of my team&#8217;s opinionated project management website. Its simplicity, versatility, and ability to streamline database-related tasks have made it my favorite technology from this project. While there is still room for improvement, Sequelize has certainly assisted my team and I in writing API endpoints quickly and effectively.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I reach the midpoint of the term, I&#8217;d like to reflect a bit on one of the new technologies I&#8217;ve learned. Sequelize, an Object-Relational Mapping (ORM) library for Node.js, has stood out to me. In this blog post, I&#8217;ll discuss why Sequelize is a game-changer for project management applications, its practical applications, and how [&hellip;]<\/p>\n","protected":false},"author":13740,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/posts\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/users\/13740"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"predecessor-version":[{"id":10,"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/posts\/9\/revisions\/10"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/nimanan\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}