NestJS

API with NestJS #166. Logging with the Drizzle ORM

This entry is part 166 of 166 in the API with NestJS

Debugging is a great way to find issues when running an application locally. Unfortunately, we don’t have this option in a deployed application. Because of that, implementing logging functionality is necessary to track down and investigate any potential problems. In this article, we learn how to use the logger built into NestJS and integrate it […]

NestJS SQL

API with NestJS #163. Full-text search with the Drizzle ORM and PostgreSQL

This entry is part 163 of 166 in the API with NestJS

With PostgreSQL’s full-text search feature, we can quickly find documents that contain a particular word or phrase. It can also sort the results to show the most relevant matches first. In this article, we learn how to implement it with the Drizzle ORM, PostgreSQL, and NestJS. Column types used with the text-search feature To implement […]

NestJS

API with NestJS #162. Identity columns with the Drizzle ORM and PostgreSQL

This entry is part 162 of 166 in the API with NestJS

Most of our SQL tables contain the ID column, which acts as a primary key and uniquely identifies each row. Historically, the most common way of defining them in PostgreSQL was with the serial type. However, nowadays, the official documentation advises against them. In this article, we compare the serial type and its alternative, the […]

JavaScript

API with NestJS #161. Generated columns with the Drizzle ORM and PostgreSQL

This entry is part 161 of 166 in the API with NestJS

In SQL, generated columns automatically calculate their values using data from other fields in the same table. This can help ensure data consistency, improve query performance, and simplify our database design in general. The SQL standard contains two types of generated columns. Virtual generated columns With virtual generated columns, we avoid using additional disk storage. […]

NestJS

API with NestJS #158. Soft deletes with the Drizzle ORM

This entry is part 158 of 166 in the API with NestJS

Deleting entities is a standard feature in most REST APIs. The most straightforward approach is to remove rows from the database permanently. However, we can use soft deletes to keep the deleted entities in our database. In this article, we learn how to do it using the Drizzle ORM and PostgreSQL. Introducing soft deletes To […]

NestJS

API with NestJS #157. Handling JSON data with PostgreSQL and the Drizzle ORM

This entry is part 157 of 166 in the API with NestJS

PostgreSQL is well-suited for handling structured data and keeping everything organized and consistent. On the other hand, MongoDB stores data in flexible JSON-like documents, making it ideal for data with varying attributes and changing requirements. While SQL databases have many advantages, there are times when flexibility is needed. Fortunately, PostgreSQL bridges this gap by allowing […]