diff --git a/content/300-guides/050-database/900-turso.mdx b/content/300-guides/050-database/900-turso.mdx index 0262177902..8727885e41 100644 --- a/content/300-guides/050-database/900-turso.mdx +++ b/content/300-guides/050-database/900-turso.mdx @@ -27,7 +27,7 @@ Many aspects of using Prisma with Turso are just like using Prisma with any othe There are a number of differences between Turso and SQLite to consider. You should be aware of the following when deciding to use Turso and Prisma: -- **Remote and embedded SQLite databases**. libSQL uses HTTP to connect to the database and uses a remote file over a local file. libSQL also supports remote database replicas and embedded replicas. Embedded replicas enable you to replicate your primary database inside your application. +- **Remote and embedded SQLite databases**. libSQL uses HTTP to connect to the database and uses a remote database over a local database. libSQL also supports remote database replicas and embedded replicas. Embedded replicas enable you to replicate your primary database inside your application. - **Making schema changes**. Since libSQL uses HTTP to connect to the remote database, this makes it incompatible with Prisma Migrate. However, you can use [`prisma migrate diff`](/reference/api-reference/command-reference#migrate-diff) to create a schema migration and then apply the changes to your database using [Turso's CLI](https://docs.turso.tech/reference/turso-cli). ## Connect and query your primary database @@ -71,7 +71,7 @@ datasource db { npx prisma generate ``` -Install the libSQL database client and Prisma adapter for libSQL: +Install the libSQL database client and Prisma adapter for libSQL packages: ```sh npm install @libsql/client @prisma/adapter-libsql @@ -93,13 +93,13 @@ const adapter = new PrismaLibSQL(libsql) const prisma = new PrismaClient({ adapter }) ``` -You can use Prisma Client as you normally would with full type-safety as you normally would in your project. +You can use Prisma Client as you normally would with full type-safety in your project. ## How to connect and query from an embedded replica -Turso supports [embedded replicas](https://blog.turso.tech/introducing-embedded-replicas-deploy-turso-anywhere-2085aa0dc242). Turso's embedded replicas enable you to have a copy of your primary, remote database _inside_ your application. This is similar to having an embedded or SQLite database. +Turso supports [embedded replicas](https://blog.turso.tech/introducing-embedded-replicas-deploy-turso-anywhere-2085aa0dc242). Turso's embedded replicas enable you to have a copy of your primary, remote database _inside_ your application. This is similar to having a local SQLite database. When your app initially establishes a connection to your database, the primary database will fulfill the query: @@ -113,7 +113,7 @@ The embedded replica will fulfill subsequent read queries. The libSQL client pro ![Embedded Replica: Local DB reads](./images/embedded-replica-read.png) -With embedded replicas, this setup guarantees your app is fast because the data will be readily available locally. +With embedded replicas, this setup guarantees a responsive application, because the data will be readily available locally and faster to access. Like a read replica setup you may be familiar with, write operations are forwarded to the primary remote database and executed before being propagated to all embedded replicas. @@ -141,7 +141,7 @@ const sync = async () => await libsql.sync() const adapter = new PrismaLibSQL(libsql) const prismaClientSingleton = () => { - sync() + await sync() return new PrismaClient({ adapter }) } ```