Unable to specify length of TinyInt in MySQL engine
See original GitHub issueHi,
We are attempting to port over our code from Sequelize to Prisma. However we have an issue where some of our database fields are TinyInt(1), but also actually represent Integers.
Introspect defaults to mapping them to boolean, which is understandable. We can correct the mapping to Integer @db.TinyInt
, however this wants to map to TinyInt(3), altering the database schema and attempting to wipe the dev database.
According to https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#mysql-1 it is possible to specify @db.TinyInt(1)
as a type, however in practice prisma complains that TinyInt doesn’t take any arguments.
I found this Issue - https://github.com/prisma/prisma-engines/issues/1182 which appears to implement this, however the associated PR was closed without ever being merged.
Can I ask why this support was abandoned, if it is still being considered, and if there is any way around it for our problem?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Hey @janpio it is documented that way, but in practice it’s an invalid schema, as TinyInt doesnt have arguments… Prisma will complain that you have provided an argument to TinyInt when it takes 0. It appears that the PR to add support for this https://github.com/prisma/prisma-engines/pull/1191 was never merged.
Note that there is a closed PR that could be part of changing this: https://github.com/prisma/prisma-engines/pull/1191