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

CLI: migrate dev should return a non-successful exit code (1) when there is an error during seeding #14862

Closed
Jolg42 opened this issue Aug 17, 2022 · 1 comment · Fixed by #14951
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: cli topic: exit code topic: prisma dev CLI: prisma dev (removed) topic: seeding
Milestone

Comments

@Jolg42
Copy link
Member

Jolg42 commented Aug 17, 2022

Bug description

From #12349

We have a different behavior for the error exit code between migrate dev and migrate reset if there is an error during seeding: dev will exit 0, while reset 1

How to reproduce

  • add the following to the package.json
  "prisma": {
    "seed": "node ./prisma/seed.js"
  },
  • Create the ./prisma/seed.js file containing:
throw new Error("Error from seeding")
  • create a ./prisma/schema.prisma containing the following
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = "file:dev.db"
}

model Post {
  id        Int      @id @default(autoincrement())
}
  • run npx prisma migrate dev

Expected behavior

npx prisma migrate dev should exit with an exit code = 1.

Prisma Version

4.3.0-dev.27
@Jolg42 Jolg42 added kind/bug A reported bug. bug/2-confirmed Bug has been reproduced and confirmed. topic: cli topic: prisma dev CLI: prisma dev (removed) team/schema Issue for team Schema. topic: seeding topic: exit code labels Aug 17, 2022
@Jolg42 Jolg42 changed the title CLI: migrate dev should return a non-successful exit code (1) when CLI: migrate dev should return a non-successful exit code (1) when there is an error during seeding Aug 18, 2022
@Jolg42 Jolg42 self-assigned this Aug 23, 2022
@Jolg42 Jolg42 added this to the 4.3.0 milestone Aug 23, 2022
Jolg42 added a commit that referenced this issue Aug 23, 2022
@Jolg42
Copy link
Member Author

Jolg42 commented Aug 24, 2022

It now exit(1) if seeding fails, like in migrate reset in our internal dev version 4.3.0-dev.58 or up and will be part of the 4.3.0 release.

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: cli topic: exit code topic: prisma dev CLI: prisma dev (removed) topic: seeding
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant