Category: SQL

NestJS SQL

API with NestJS #183. Distance and radius in PostgreSQL with Drizzle ORM

This entry is part 183 of 184 in the API with NestJS

PostgreSQL provides many options for working with geographical data, especially with the PostGIS extension. In this article, we’ll explore how to calculate the distance between two coordinates and how to identify locations within a specific radius. If you want to check out the basics of storing coordinates in PostgreSQL with the Drizzle ORM, check out […]

NestJS SQL

API with NestJS #182. Storing coordinates in PostgreSQL with Drizzle ORM

This entry is part 182 of 184 in the API with NestJS

Many applications rely on geographical data to calculate distances and track locations. PostgreSQL offers several ways to store geospatial data, each designed with different goals. In this article, we learn how to store coordinates when working with PostgreSQL and the Drizzle ORM. Latitude and longitude A coordinate consists of two numbers that pinpoint a location […]

NestJS SQL

API with NestJS #181. Prepared statements in PostgreSQL with Drizzle ORM

This entry is part 181 of 184 in the API with NestJS

When we execute an SQL query, PostgreSQL follows a process that consists of multiple steps. First, it parses the SQL statement, checking for syntax errors. Next, it analyzes whether the tables and columns used in the query exist. Then, it plans the instructions necessary to achieve the desired result. Finally, it executes the instructions based on […]

NestJS SQL

API with NestJS #176. Database migrations with the Drizzle ORM

This entry is part 176 of 184 in the API with NestJS

Relational databases are known for their strict data structures. Every table requires a defined schema, including columns, indexes, and relationships. Despite careful planning during database design, application requirements often evolve. As a result, the database must adapt to keep up with these new needs. However, it’s crucial to ensure that no existing data is lost […]

NestJS SQL

API with NestJS #174. Multiple PostgreSQL schemas with Drizzle ORM

This entry is part 174 of 184 in the API with NestJS

PostgreSQL uses schemas as namespaces within the database to hold tables and other structures, such as indexes. In this article, we explain how to use them with the Drizzle ORM and how they can be beneficial. The public schema Out of the box, PostgreSQL creates a schema called for each new database. database-schema.ts

[…]

NestJS SQL

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

This entry is part 163 of 184 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 […]