Query data from PlanetScale with Prisma – a next-generation ORM for Node.js and TypeScript.
Prisma makes working with data easy! It offers a type-safe Node.js & TypeScript ORM, global database caching, connection pooling, and real-time database events.
// Creating a new recordawait prisma.user.create({ firstName: “Alice”, email: “alice@prisma.io”})
id firstName email 1 Bobby bobby@tables.io2 Nilufar nilu@email.com3 Jürgen jums@dums.edu4 Alice alice@prisma.io
PlanetScale is a MySQL-compatible, serverless database powered by Vitess, which is a database clustering system for horizontal scaling of MySQL. PlanetScale brings many of the benefits of serverless to the database world, with limitless scaling, consumption based pricing, zero-downtime schema migrations, and a generous free tier.
Prisma is an open-source ORM that integrates seamlessly with PlanetScale and supports the full development cycle. Prisma helps you define your database schema declaratively using the Prisma schema fetch data from PlanetScale with full type safety using Prisma Client. Used together, you get all the established benefits of relational databases in addition to a modern developer experience, type safe querying, zero ops, and infinite scale.
The Prisma schema uses Prisma's modeling language to define your database schema. It makes data modeling easy and intuitive, especially when it comes to modeling relations.
The syntax of the Prisma schema is heavily inspired by GraphQL SDL. If you're already familiar with SDL, picking it up to model your database tables will be a breeze.
1// Define the `User` table in the database2model User {3 id String @id @default(cuid())4 email String @unique5 password String 6 name String? 7 posts Post[]8}9
10// Define the `Post` table in the database11model Post {12 id String @id @default(cuid())13 title String14 content String?15 authorId String16 author User @relation(fields: [authorId], references: [id])17}
“PlanetScale & Prisma is an unrivaled combination, bringing a supreme developer experience and proven scalability.”
PlanetScale provide a schema change workflow that allows you to update and evolve your database schema without locking or causing downtime for production databases.
Prisma's modeling language is declarative and lets you intuitively describe your database schema.
Prisma Client ensures fully type-safe database queries with benefits like autocompletion - even in JavaScript.
Avoid the pitfalls of managing servers and deploy your Prisma & PlanetScale project to serverless runtimes for zero ops and limitless scalability.
Map your Prisma schema to the database so you don't need to write SQL to manage your database schema.
Prisma Client reduces boilerplates by providing convenient APIs for common database features.
In this video, Daniel guides through everything you need to know when using Prisma with PlanetScale. Learn more about referential integrity and how to operate without foreign key constraints, migration workflows with Prisma and PlanetScale using the prisma db push
command, and defining indices on relation scalars (the foreign key fields) for optimal performance.
In this talk from Next.js Conf, Taylor Barnett from the PlanetScale team delves into the idea of practicing databases as code, how you can use PlanetScale with Prisma to define your models in a declarative nature and use branching to experiment with your database in an isolated development environment in a serverless stack.
This document discusses the concepts behind using Prisma and PlanetScale, explains the commonalities and differences between PlanetScale and other database providers, and leads you through the process for configuring your application to integrate with PlanetScale.
Today, Vitess is the default database for scale at Slack, Roblox, Square, Etsy, GitHub, and many more. But how did it get here? From its creation at YouTube to the database that powers PlanetScale, a serverless database platform, Taylor and Sugu will dive into Vitess' creation, why MySQL, what makes Vitess so powerful, and the different ways it is a great fit for developers building serverless applications.
We have multiple channels where you can engage with members of our community as well as the Prisma team.