Skip to content
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

What happen with prisma migrate dev #16220

Closed
und3fined opened this issue Nov 10, 2022 · 2 comments
Closed

What happen with prisma migrate dev #16220

und3fined opened this issue Nov 10, 2022 · 2 comments
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: enum "type"/block `enum` topic: migrate topic: postgresql
Milestone

Comments

@und3fined
Copy link

Bug description

Hi team,

I use command prisma migrate dev --skip-generate --schema $npm_package_pschema for update new change in table.
I have a problem with before migrate. Accept your warning first time, and re-try migrate dev it's comback.
After 4 times re-try, i have 4 migrate change with same content.

This here.
Screenshot 2022-11-10 at 17 11 39

No any change but always drop - and create new field. Same type with UserRole. but it's not show in here.

How to reproduce

prisma migrate dev --skip-generate --schema $npm_package_pschema

And always got

Warnings for the current datasource:

  • The `state` column on the `app_versions` table would be dropped and recreated. This will lead to data loss.
  • The `rank` column on the `users` table would be dropped and recreated. This will lead to data loss.

✔ Are you sure you want create and apply this migration? … no

Expected behavior

Don't DROP field

Prisma information

generator client {
    provider = "prisma-client-js"
}

datasource db {
    provider          = "postgresql"
    url               = env("DB_URL")
    shadowDatabaseUrl = env("SD_DB_URL")
}

enum VersionState {
    NEW
    PRE_RELEASE
    READY
}

model AppVersion {
    id String @id @default(cuid()) @db.VarChar(48)

    version      String       @db.VarChar(255)
    state        VersionState @default(NEW)
}

enum UserRole {
    GUEST
    MEMBER
    SILVER
    PLATINUM
    GOLD
    DIAMOND

    DECRYPTOR
    MODERATOR
    ADMIN
}

enum UserRank {
    NEWBIE
    MEMBER
    SILVER
    PLATINUM
    GOLD
    DIAMOND
}

model User {
    id        String @id @default(cuid()) @db.VarChar(48)
    profileId String @unique @map("profile_id") @db.VarChar(48)

    displayName String   @default("Anonymous") @map("display_name") @db.VarChar(255)
    role        UserRole @default(GUEST)
    rank        UserRank @default(NEWBIE)
}
// Add your code using Prisma Client

Environment & setup

  • OS: macOS M1
  • Database: Postgresql 14
  • Node.js version: v16.14.2

Prisma Version

prisma                  : 4.6.0
@prisma/client          : 4.6.0
Current platform        : darwin-arm64
Query Engine (Node-API) : libquery-engine 2e719efb80b56a3f32d18a62489de95bb9c130e3 (at node_modules/.pnpm/@prisma+engines@4.6.0/node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine        : migration-engine-cli 2e719efb80b56a3f32d18a62489de95bb9c130e3 (at node_modules/.pnpm/@prisma+engines@4.6.0/node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine    : introspection-core 2e719efb80b56a3f32d18a62489de95bb9c130e3 (at node_modules/.pnpm/@prisma+engines@4.6.0/node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary           : prisma-fmt 2e719efb80b56a3f32d18a62489de95bb9c130e3 (at node_modules/.pnpm/@prisma+engines@4.6.0/node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Format Wasm             : @prisma/prisma-fmt-wasm 4.6.0-53.2e719efb80b56a3f32d18a62489de95bb9c130e3
Default Engines Hash    : 2e719efb80b56a3f32d18a62489de95bb9c130e3
Studio                  : 0.476.0
@und3fined und3fined added the kind/bug A reported bug. label Nov 10, 2022
@Jolg42 Jolg42 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: migrate team/schema Issue for team Schema. topic: enum "type"/block `enum` topic: postgresql bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Nov 10, 2022
@Jolg42
Copy link
Member

Jolg42 commented Nov 10, 2022

Confirmed as duplicate of #16180.

@und3fined Could you try to update prisma and @prisma/client to the 4.6.1-dev.1 internal patch version that includes the fixes and let us know if that solves your issue?

The official patch version will be published later today.

@Jolg42 Jolg42 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2022
@Jolg42 Jolg42 added this to the 4.7.0 milestone Nov 10, 2022
@und3fined
Copy link
Author

It's fixed in 4.6.1 thanks for quickly reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: enum "type"/block `enum` topic: migrate topic: postgresql
Projects
None yet
Development

No branches or pull requests

2 participants