Category: SQL

NestJS SQL

API with NestJS #154. Many-to-many relationships with Drizzle ORM and PostgreSQL

This entry is part 154 of 156 in the API with NestJS

Creating relationships across tables is a crucial aspect of working with SQL databases. Previously, this series focused on using the Drizzle ORM to create simple relationships, such as one-to-one and many-to-one relationships. In this article, we learn about many-to-many relationships, which are slightly more complex. Introducing many-to-many relationships A many-to-many relationship is necessary when multiple […]

NestJS SQL

API with NestJS #153. SQL transactions with the Drizzle ORM

This entry is part 153 of 156 in the API with NestJS

Ensuring the integrity of the data is a fundamental responsibility of each developer. Fortunately, SQL databases give us the tools to ensure our database stays consistent and accurate. A crucial scenario to consider is when two SQL queries depend on each other. A typical example is transferring money between two bank accounts. Suppose we have […]

NestJS SQL

API with NestJS #152. SQL constraints with the Drizzle ORM

This entry is part 152 of 156 in the API with NestJS

When working with SQL databases, we can configure constraints to ensure our data does not get corrupted. In this article, we explore and implement different SQL constraints using PostgreSQL, NestJS, and the Drizzle ORM. Not-null constraint By default, SQL columns can hold nulls, representing an absence of value. We need the not-null constraint using the […]

NestJS SQL

API with NestJS #151. Implementing many-to-one relationships with Drizzle ORM

This entry is part 151 of 156 in the API with NestJS

Managing relationships between tables is a significant part of dealing with SQL databases. In this article, we continue learning to use Drizzle ORM with NestJS and implement many-to-one relationships. Check out this repository if you want to see the full code from this article. The many-to-one relationship With many-to-one relationships, a row from the first […]

NestJS SQL

API with NestJS #150. One-to-one relationships with the Drizzle ORM

This entry is part 150 of 156 in the API with NestJS

When building a database, the tables we set up often connect to each other. Managing these relationships is one of the crucial parts of working with databases. In the previous article, we learned how to use NestJS with Drizzle to set up a simple project with PostgreSQL. This time, we go further and write more […]