-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
能否提供数据库呢方便搭建 #1
Comments
在执行npx prisma migrate dev --name init,一直提示没有权限创建databases |
报错方便贴上来看一下吗 |
Error: P3014 Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow Original error: |
@hichho 好像是 PlanetScale 权限设置的问题,不允许在 main 分支(这里指的是「数据库」的分支,PlanetScale 支持数据库维护多个分支)建立新数据库,可以试试在 PlanetScale 建立一个新分支,然后把 Prisma 的连接配置改为这个新分支。 |
|
你是不是没有照配置把它放在 |
我也遇到了 这样直接过了 |
遇到
使用PlanetScale时需要基于main创建出另外一个分支作为shadow database,然后把对应的分支密码配置到相关文件里(schema.prisma, .env)。 |
参考prisma issue#7292 |
我是这么过的.仅供参考.
在
然后
|
npx prisma db push |
可以改为用mongodb atlas, 稍微改下scheme.prisma即可 generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mongodb"
referentialIntegrity = "prisma"
url = env("DATABASE_URL")
}
model Post {
id String @id @default(auto()) @map("_id") @db.ObjectId
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
content String?
author User @relation(fields: [authorId], references: [id])
authorId String @db.ObjectId
imageUrl String?
tags String
@@index(authorId)
}
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
passwordHash String
name String?
posts Post[]
avatarUrl String?
}
|
No description provided.
The text was updated successfully, but these errors were encountered: