--- title: Graphql with Prisma schema tags: Graphql --- # Graphql with Prisma schema ## [Prisma](https://www.prisma.io/) With Prisma, you can build GraphQL servers that connect to a database. - https://www.prisma.io/docs/concepts/overview/prisma-in-your-stack/graphql ### schema - Document: https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference #### Generate specified user id (customly) - https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#default ##### @default - Defines a default value for a field . - Remarks Corresponding database type: DEFAULT - Default values can be a static value (4, "hello") or one of the following functions: - autoincrement() - dbgenerated() - cuid() - uuid() - now() ex: > schema.prisma model User { id Int @id @default(autoincrement()) email String @unique password String name String? posts Post[] profile Profile? } --- model User { id Int @id @default(dbgenerated("gen_random_uuid()")) }