Code Snippets Prisma

Short texts Prisma 🧑‍💻 Code snippets Prisma ✍️ Reading lists Prisma 👀

shema.prisma example

datasource db { provider = “postgresql” url = env(“DATABASE_URL”) shadowDatabaseUrl = env(“SHADOW_DATABASE_URL”) } generator client { provider = “prisma-client-js” } model User { id Int @id @default(autoincrement()) name String email String @unique password String middleName String? surName String? addresses String[] phone String @unique gender Gender? date_birth DateTime? token Token[] favorites_products Favorites_products[] cart_products Cart_products[] }

Um exemplo de relacionamento entre tabelas postgres no Prisma

// Schema for a fictional music streaming service // This service contains songs, albums, artists & playlists, and tracks user interactions with each of them generator client { provider = “prisma-client-js” } datasource db { provider = “postgresql” url = env(“DATABASE_URL”) } model User { id String @id @default(uuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt […]

schema.prisma

// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema datasource db { provider = “postgres” url = env(“DATABASE_URL”) } generator client { provider = “prisma-client-js” } // ————————————– model User { id Int @id @default(autoincrement()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt name String? email String @unique hashedPassword String? […]

house prisma

// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema datasource db { provider = “postgresql” url = env(“PG_CONNECTIONSTRING”) } generator client { provider = “prisma-client-js” } model House { id String @id @default(cuid()) images String latitude Float longitude Float address String bedrooms Int createdAt DateTime @default(now()) updatedAt DateTime […]