Comments (13)
我也遇到了 这样直接过了
sudo npx prisma db push
from umi-blog-example.
我是这么过的.仅供参考.
在.env
里
DATABASE_URL='new branch link'
SHADOW_URL='main link'
在prisma/scheme.prisma
里
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
datasource db {
provider = "mysql"
referentialIntegrity = "prisma"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_URL")
}
然后npx prisma migrate dev --name init
$ npx prisma migrate dev --name init
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": MySQL database "blog" at "xxxx:3306"
Applying migration `20220808030235_init`
The following migration(s) have been created and applied from new schema changes:
migrations/
└─ 20220808030235_init/
└─ migration.sql
Your database is now in sync with your schema.
✔ Generated Prisma Client (4.1.1 | library) to .\node_modules\@prisma\client in 52ms
from umi-blog-example.
@hichho 好像是 PlanetScale 权限设置的问题,不允许在 main 分支(这里指的是「数据库」的分支,PlanetScale 支持数据库维护多个分支)建立新数据库,可以试试在 PlanetScale 建立一个新分支,然后把 Prisma 的连接配置改为这个新分支。
from umi-blog-example.
遇到
在执行npx prisma migrate dev --name init,一直提示没有权限创建databases
使用PlanetScale时需要基于main创建出另外一个分支作为shadow database,然后把对应的分支密码配置到相关文件里(schema.prisma, .env)。
后续如果还遇到P3022报错的话,是因为PlanetScale 不允许在数据库 ( ERROR HY000 (1105): direct DDL is disabled) 的生产分支上更改架构,只能在非生产分支上执行 Prisma Migrate,然后使用 PlanetScale“部署请求”将架构更改合并到main分支上
from umi-blog-example.
参考prisma issue#7292
设置了SHADOW_DATABASE_URL指向了测试分支,运行npx prisma migrate dev --name init
还是谁出现 ( ERROR HY000 (1105): direct DDL is disabled)
如何在在非生产分支上执行 Prisma Migrate?
from umi-blog-example.
npx prisma db push
from umi-blog-example.
@mybre 可以参考 教学文档 的方案,在 PlanetScale 平台申请一个免费的 MySQL 数据库 👍
from umi-blog-example.
在执行npx prisma migrate dev --name init,一直提示没有权限创建databases
from umi-blog-example.
在执行npx prisma migrate dev --name init,一直提示没有权限创建databases
报错方便贴上来看一下吗
from umi-blog-example.
在执行npx prisma migrate dev --name init,一直提示没有权限创建databases
报错方便贴上来看一下吗
"Datasource "db": MySQL database "blog" at "g5z8l8lhcs3q.ap-southeast-2.psdb.cloud:3306"
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:
create database is not supported
0: migration_core::state::DevDiagnostic
at migration-engine\core\src\state.rs:250
"
from umi-blog-example.
@hichho 好像是 PlanetScale 权限设置的问题,不允许在 main 分支(这里指的是「数据库」的分支,PlanetScale 支持数据库维护多个分支)建立新数据库,可以试试在 PlanetScale 建立一个新分支,然后把 Prisma 的连接配置改为这个新分支。
尝试过new branch ,deploy了生成password后npx run ... , 仍然有这个问题 ಥ_ಥ
from umi-blog-example.
@hichho 好像是 PlanetScale 权限设置的问题,不允许在 main 分支(这里指的是「数据库」的分支,PlanetScale 支持数据库维护多个分支)建立新数据库,可以试试在 PlanetScale 建立一个新分支,然后把 Prisma 的连接配置改为这个新分支。
prisma/prisma#7292
你是不是没有照配置把它放在 shadowDatabaseUrl
里面
from umi-blog-example.
可以改为用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?
}
from umi-blog-example.
Related Issues (14)
- 执行 npx prisma migrate dev --name init 报错 HOT 3
- Serverless Functions不成功 HOT 2
- [Question] 目前就一个 Blog 的教程,能否提供更详细的文档呢? HOT 1
- Serverless Function 如何部署到其他服务器上呢
- 怎么改请求里的response headers里的contentType为application/json
- 示例博客首页无法加载? HOT 9
- @/utils/jwt 包未找到 HOT 2
- 新版本加入了REDIS,如何在这项目设置,还有JWT_SECRET HOT 3
- api请求报错了,日志从哪看? HOT 2
- Error: Unable to find environment variable: `UPSTASH_REDIS_REST_URL` HOT 1
- ReferenceError: fetch is not defined HOT 6
- Vercel部署完不能访问
- 建议教程在“用户注册”前,添加对“@”的配置这一步 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from umi-blog-example.