GithubHelp home page GithubHelp logo

Comments (13)

Xxxdxs avatar Xxxdxs commented on June 1, 2024 7

我也遇到了 这样直接过了
sudo npx prisma db push

from umi-blog-example.

kdaye avatar kdaye commented on June 1, 2024 2

我是这么过的.仅供参考.
.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.

yuaanlin avatar yuaanlin commented on June 1, 2024 1

@hichho 好像是 PlanetScale 权限设置的问题,不允许在 main 分支(这里指的是「数据库」的分支,PlanetScale 支持数据库维护多个分支)建立新数据库,可以试试在 PlanetScale 建立一个新分支,然后把 Prisma 的连接配置改为这个新分支。

Screen Shot 2022-05-08 at 17 07 49

prisma/prisma#7292

from umi-blog-example.

Akenokoru avatar Akenokoru commented on June 1, 2024 1

遇到

在执行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.

silkwromzf avatar silkwromzf commented on June 1, 2024 1

参考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.

LetHergo avatar LetHergo commented on June 1, 2024 1

npx prisma db push

from umi-blog-example.

yuaanlin avatar yuaanlin commented on June 1, 2024

@mybre 可以参考 教学文档 的方案,在 PlanetScale 平台申请一个免费的 MySQL 数据库 👍

Screen Shot 2022-04-05 at 21 11 30

from umi-blog-example.

hichho avatar hichho commented on June 1, 2024

在执行npx prisma migrate dev --name init,一直提示没有权限创建databases

from umi-blog-example.

yuaanlin avatar yuaanlin commented on June 1, 2024

在执行npx prisma migrate dev --name init,一直提示没有权限创建databases

报错方便贴上来看一下吗

from umi-blog-example.

hichho avatar hichho commented on June 1, 2024

在执行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 avatar hichho commented on June 1, 2024

@hichho 好像是 PlanetScale 权限设置的问题,不允许在 main 分支(这里指的是「数据库」的分支,PlanetScale 支持数据库维护多个分支)建立新数据库,可以试试在 PlanetScale 建立一个新分支,然后把 Prisma 的连接配置改为这个新分支。

Screen Shot 2022-05-08 at 17 07 49

prisma/prisma#7292

issue
尝试过new branch ,deploy了生成password后npx run ... , 仍然有这个问题 ಥ_ಥ

from umi-blog-example.

yuaanlin avatar yuaanlin commented on June 1, 2024

@hichho 好像是 PlanetScale 权限设置的问题,不允许在 main 分支(这里指的是「数据库」的分支,PlanetScale 支持数据库维护多个分支)建立新数据库,可以试试在 PlanetScale 建立一个新分支,然后把 Prisma 的连接配置改为这个新分支。
Screen Shot 2022-05-08 at 17 07 49
prisma/prisma#7292

issue 尝试过new branch ,deploy了生成password后npx run ... , 仍然有这个问题 ಥ_ಥ

Screen Shot 2022-05-08 at 20 01 17

你是不是没有照配置把它放在 shadowDatabaseUrl 里面

from umi-blog-example.

birdmanmandbir avatar birdmanmandbir commented on June 1, 2024

可以改为用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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.