From db874a03ea27e0cc5fd90b503c3e354fb1bfac21 Mon Sep 17 00:00:00 2001 From: Nurul Sundarani Date: Thu, 12 Dec 2024 14:37:49 +0530 Subject: [PATCH 1/3] Update 375-supported-databases.mdx (#6519) Added Postgres 17 to Supported database --- content/200-orm/500-reference/375-supported-databases.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/content/200-orm/500-reference/375-supported-databases.mdx b/content/200-orm/500-reference/375-supported-databases.mdx index f455ef0773..1de78c1a10 100644 --- a/content/200-orm/500-reference/375-supported-databases.mdx +++ b/content/200-orm/500-reference/375-supported-databases.mdx @@ -32,6 +32,7 @@ An asterisk (\*) indicates that the version number is not relevant; either all v | PostgreSQL | 14 | | PostgreSQL | 15 | | PostgreSQL | 16 | +| PostgreSQL | 17 | | SQLite | \* | Note that a fixed version of SQLite is shipped with every Prisma ORM release. From 5032bd3e66c5c6f6d8e949ba8608d67baa957eda Mon Sep 17 00:00:00 2001 From: Nurul Sundarani Date: Thu, 12 Dec 2024 15:10:01 +0530 Subject: [PATCH 2/3] Update 380-connection-urls.mdx (#6520) Updates reference to use free Postgres database from Prisma Postgres instead of Supabase --- content/200-orm/500-reference/380-connection-urls.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/200-orm/500-reference/380-connection-urls.mdx b/content/200-orm/500-reference/380-connection-urls.mdx index 5ec75e13a1..6251fd0ee4 100644 --- a/content/200-orm/500-reference/380-connection-urls.mdx +++ b/content/200-orm/500-reference/380-connection-urls.mdx @@ -17,7 +17,7 @@ The connection URL is provided via the `url` field of a `datasource` block in yo - **Port**: The port on which your database server is running - **Database name**: The name of the database you want to use -Make sure you have this information at hand when getting started with Prisma ORM. If you don't have a database server running yet, you can either use a local SQLite database file (see the [Quickstart](/getting-started/quickstart-sqlite)) or [setup a free PostgreSQL database on Supabase](https://dev.to/prisma/set-up-a-free-postgresql-database-on-supabase-to-use-with-prisma-3pk6). +Make sure you have this information at hand when getting started with Prisma ORM. If you don't have a database server running yet, you can either use a local SQLite database file (see the [Quickstart](/getting-started/quickstart-sqlite)) or [setup a free PostgreSQL database with Prisma Postgres](/orm/overview/databases/prisma-postgres). From 8439c2b8afee7827c7be83fb133b6d404a193eb1 Mon Sep 17 00:00:00 2001 From: Ankur Datta <64993082+ankur-arch@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:55:38 +0600 Subject: [PATCH 3/3] feat: optimize recommendation for db.money (#6517) --- content/700-optimize/300-recordings.mdx | 1 + .../600-avoid-db-money.mdx | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 content/700-optimize/400-recommendations/600-avoid-db-money.mdx diff --git a/content/700-optimize/300-recordings.mdx b/content/700-optimize/300-recordings.mdx index 24f0307747..e9a9204f34 100644 --- a/content/700-optimize/300-recordings.mdx +++ b/content/700-optimize/300-recordings.mdx @@ -41,6 +41,7 @@ When a recording session ends, Optimize generates recommendations such as: - [Queries on unindexed columns](/optimize/recommendations/queries-on-unindexed-columns) - [Repeated query](/optimize/recommendations/repeated-query) - [Overfetching](/optimize/recommendations/select-returning) +- [Using `@db.Money`](/optimize/recommendations/avoid-db-money) :::info Use [Prisma AI](/optimize/prisma-ai) to ask follow-up questions about a recommendation. diff --git a/content/700-optimize/400-recommendations/600-avoid-db-money.mdx b/content/700-optimize/400-recommendations/600-avoid-db-money.mdx new file mode 100644 index 0000000000..d824c9fa82 --- /dev/null +++ b/content/700-optimize/400-recommendations/600-avoid-db-money.mdx @@ -0,0 +1,28 @@ +--- +title: 'Using @db.Money' +metaTitle: 'Optimize Recommendations: Avoid usage of `@db.Money`' +metaDescription: "Learn about the recommendation provided by Optimize for using `@db.Money` native type." +tocDepth: 3 +toc: true +--- + +Optimize provides recommendations to help you identify and resolve performance issues caused by the use of `@db.Money` type. + +The following model uses the `@db.Money` native type: + +```prisma +model Item { + // ... + price Decimal @db.Money + // ... +} +``` + +## What is the problem? + +The `@db.Money` data type in PostgreSQL is not ideal for storing monetary values. Internally, `@db.Money` is implemented as an integer, which offers speed but lacks flexibility. It handles fractional values and rounding in unexpected ways, which can lead to inaccuracies. + +Additionally, the `@db.Money` type does not store any information about the associated currency. Instead, it relies on the global `lc_monetary` locale setting, which may not be suitable for all use cases. + +For more information, refer to the [PostgreSQL documentation](https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_money). +