Prisma1: Prisma in unable handle enums when no migrations is enabled

Created on 3 Jul 2019  路  4Comments  路  Source: prisma/prisma1

Describe the bug
Prisma is throwing an error when Enum is used with no migrate flag.

To Reproduce
Steps to reproduce the behavior:

  1. Deploy the following datamodel with Prisma deploy
enum test {
  ADMIN
  USER
}

type User {
  id: ID! @id
  name: test!
}
  1. Deploy the same datamodel again with --no-migrate flag
  2. See error

Expected behaviour
Prisma should be able to deploy enum type if underlying type is a string.

Screenshots
image

Versions (please complete the following information):

  • Connector: Postgres
  • Prisma Server: 1.34.0
  • prisma CLI: Prisma CLI version: prisma/1.34.0 (darwin-x64) node-v10.16.0
  • OS: MacOS 10.14.5 Mojave
bu2-confirmed areintrospection areserver kinbug

Most helpful comment

I did a test where I built an enum in an stand alone Prisma container that has full control of the DB and found that instead of creating a MySQL enum(), Prisma just creates a varchar.

My existing DB uses enum()s and that's not going to change, I think that it's better to use the built in MySQL enum() rather than a varchar and then putting the logic in Prisma, if you stop using Prisma and switch to a different service it's better to have the enum stored in the database. Or if you have other services interacting with the same DB, it's important to use the MySQL build in enum(), we have a massive data pipeline and databases are used by a few different services.

All 4 comments

Having the same issue after upgrading to 1.34.0 on MySQL Windows.

Same issue.

Since #4190 was fixed in 1.35 and this issue prevents from upgrading to 1.35 we are stuck...

I'm having the same issue when deploying to an existing schema with 1.34.5, I get the following error message:
java.lang.RuntimeException: Encountered unknown SQL type enum with column content_type.

I did a test where I built an enum in an stand alone Prisma container that has full control of the DB and found that instead of creating a MySQL enum(), Prisma just creates a varchar.

My existing DB uses enum()s and that's not going to change, I think that it's better to use the built in MySQL enum() rather than a varchar and then putting the logic in Prisma, if you stop using Prisma and switch to a different service it's better to have the enum stored in the database. Or if you have other services interacting with the same DB, it's important to use the MySQL build in enum(), we have a massive data pipeline and databases are used by a few different services.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dohomi picture dohomi  路  3Comments

marktani picture marktani  路  3Comments

Fi1osof picture Fi1osof  路  3Comments

hoodsy picture hoodsy  路  3Comments

jannone picture jannone  路  3Comments