1 2 3 4 5 6 7 8 9 10 11
// Retrieve all users const allUsers: User[] = await prisma.users() // Retrieve a single user by email const bob: User = await prisma .users({ email: "bob@prisma.io" }) // Retrieve all comments of a post in a single request const commentsOfPost: Comment[] = await prisma .post({ id: "cjl4srkaqqxa30b46pqcyzpyo" }) .comments()
Prisma client simplifies database access. It lets you read and write data to your database using your favorite programming language.
prisma.createUser({
email: "alice@prisma.io",
posts: {
create: {
title: "Join us for Prisma Day 2019"
}
}
})
BEGIN;
INSERT INTO User (id, email)
VALUES (
"cjl4srkaqqxa30b46pqcyzpyo",
"alice@prisma.io"
);
INSERT INTO Post (id, title)
VALUES (
"cjl4srkaqqxa30b46pqcyzpyo",
"Join us for Prisma Day 2019"
);
INSERT INTO PostToUser (userId, postId)
VALUES (
"cjl4srkaqqxa30b46pqcyzpyo",
"cjl4srkaqqxa30b46pqcyzpyo"
)
COMMIT;
Prisma Migrate defines and updates your database schema using the declarative SDL syntax for data modeling and migrations.
Prisma Migrate1 2 3 4 5 6 7 8 9 10 11 12 13 14
type User { id: ID! @id email: String! @unique accessRole: AccessRole! @default(value: USER) posts: [Post!]! } type Post { id: ID! @id createdAt: DateTime! @createdAt title: String! published: Boolean! @default(value: false) author: User! }
Prisma Admin is a beautiful data management tool that lets you view and edit data with the ease of a spreadsheet.
Prisma AdminPrisma makes it easy to implement GraphQL servers. Learn how to use the Prisma client to access your database inside your resolvers.
Get started with a practical example and explore how Prisma is used to build production-ready GraphQL servers.
Focus on creating value instead of managing complex database workflows.
Databases are at the core of every application. Yet, database access, migrations and data management workflows still are huge time sinks for developers. Our mission is to build the right abstractions and tools to save development time that should be spent on building valued-adding features.
The goal of Prisma is to provide a database-agnostic abstraction to be used from any programming language.
The Prisma API will be able to abstract multiple databases at once, enabling cross database operations (e.g. JOINs).
Being the data layer in your app, Prisma will be able to make lots of smart decisions about how data should be accessed.