![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@prisma/adapter-libsql
Advanced tools
Prisma driver adapter for Turso and libSQL.
See https://prisma.io/turso for details.
The following usage tutorial is valid for Prisma 5.4.2 and later versions.
After getting started with Turso, you can use the Turso serverless driver to connect to your database. You will need to install the @prisma/adapter-libsql
driver adapter and the @libsql/client
serverless driver.
npm install @prisma/adapter-libsql
npm install @libsql/client
Make sure your Turso database connection string and authentication token is copied over to your .env
file. The connection string will start with libsql://
.
# .env
TURSO_AUTH_TOKEN="eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9..."
TURSO_DATABASE_URL="libsql://turso-prisma-random-user.turso.io"
You can now reference this environment variable in your schema.prisma
datasource. Make sure you also include the driverAdapters
Preview feature.
// schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["driverAdapters"]
}
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
Now run npx prisma generate
to re-generate Prisma Client.
As Turso needs to sync between a local sqlite database and another one hosted on Turso Cloud, an additional migration setup is needed. In particular, anytime you modify models and relations in your schema.prisma
file, you should:
npx prisma migrate diff --from-empty \
--to-schema-datamodel prisma/schema.prisma \
--script > baseline.sql
turso db shell turso-prisma < baseline.sql
In TypeScript, you will need to:
// Import needed packages
import { PrismaClient } from '@prisma/client'
import { PrismaLibSQL } from '@prisma/adapter-libsql'
import { createClient } from '@libsql/client'
// Setup
const connectionString = `${process.env.TURSO_DATABASE_URL}`
const authToken = `${process.env.TURSO_AUTH_TOKEN}`
// Init prisma client
const libsql = createClient({
url: connectionString,
authToken,
})
const adapter = new PrismaLibSQL(libsql)
const prisma = new PrismaClient({ adapter })
// Use Prisma Client as normal
Your Prisma Client instance now uses a single remote Turso database. You can take it a step further by setting up database replicas. Turso automatically picks the closest replica to your app for read queries when you create replicas. No additional logic is required to define how the routing of the read queries should be handled. Write queries will be forwarded to the primary database. We encourage you to create an issue if you find something missing or run into a bug.
If you have any feedback about our libSQL Serverless Driver support, please leave a comment on our dedicated GitHub issue and we'll use it as we continue development.
FAQs
Prisma's driver adapter for libSQL and Turso
The npm package @prisma/adapter-libsql receives a total of 939 weekly downloads. As such, @prisma/adapter-libsql popularity was classified as not popular.
We found that @prisma/adapter-libsql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.