How to replicate the schema prism model in the database #2306
-
Hello, I learned prism 1 and now I'm trying to learn prism 2. In prism 1, after the schema was generated I could simply run the prisma deploy command and the schema was replicated in the database. Isn't there something similar in prisma 2? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @felinto-dev 👋 Prisma2 is different in a way from Prisma1 that it doesn't require any additional server to deploy to, You can get started with the examples here and also learn more about getting started with Prisma 2 here You can use For e.g.
model Post {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
title String
content String?
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId Int
}
model User {
id Int @default(autoincrement()) @id
email String @unique
name String?
posts Post[]
}
Lastly, Let me know if this works for you :) |
Beta Was this translation helpful? Give feedback.
Hi @felinto-dev 👋
Prisma2 is different in a way from Prisma1 that it doesn't require any additional server to deploy to,
It is just a DB access layer that helps you query your database.
You can get started with the examples here and also learn more about getting started with Prisma 2 here
You can use
prisma migrate
. It is similar toprisma deploy
in the sense that it creates all migrations against your database.For e.g.
schema.prisma