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

MySQL: TinyInt must be compatible with Int and Boolean scalar types #1257

Closed
2 of 3 tasks
mavilein opened this issue Oct 20, 2020 · 5 comments
Closed
2 of 3 tasks

MySQL: TinyInt must be compatible with Int and Boolean scalar types #1257

mavilein opened this issue Oct 20, 2020 · 5 comments
Assignees
Labels
domain/schema tech/engines/datamodel Issue about parsing/validation/rendering of the Prisma schema tech/engines/introspection engine Issue in the Introspection Engine tech/engines/migration engine Issue in the Migration Engine tech/engines Issue for tech Engines. topic: native types

Comments

@mavilein
Copy link
Member

mavilein commented Oct 20, 2020

Currently we allow TinyInt only to be used on fields of type Boolean. This is problematic for introspection CI and hence we want to lift that restriction and also allow it for Int.

Goal:
The following schema should be valid.

model Blog {
  id    Int     @id
  anInt Int     @db.TinyInt
  aBool Boolean @db.TinyInt
}

SQL Mapping Rules:

  • Int @db.TinyInt is mapped to tinyint in the database without display width.
  • Boolean @db.TinyInt is mapped to tinyint(1) in the database.

Steps:

  • allow this schema in the parser
  • adapt introspection engine to adhere to SQL mapping rules
  • adapt migration engine to adhere to SQL mapping rules
@mavilein mavilein added tech/engines Issue for tech Engines. tech/engines/datamodel Issue about parsing/validation/rendering of the Prisma schema tech/engines/introspection engine Issue in the Introspection Engine tech/engines/migration engine Issue in the Migration Engine labels Oct 20, 2020
@mavilein mavilein added this to the Backlog 2.10.0 milestone Oct 20, 2020
@do4gr
Copy link
Member

do4gr commented Oct 20, 2020

The introspection engine will also take the default value into consideration. So column tinyint(1) Default 5 will still be an Int.

@mavilein
Copy link
Member Author

mavilein commented Nov 2, 2020

The only outstanding part is the work in the ME.

@mavilein mavilein removed this from the Backlog 2.11.0 milestone Nov 2, 2020
@FredericEspiau
Copy link

This is no longer part of 2.11.0 ?

@mavilein
Copy link
Member Author

mavilein commented Nov 4, 2020

The work is done in prisma introspect, the schema parser and the Prisma Client. Only work left is prisma migrate where we will tackle this at a later point.

@tomhoule
Copy link
Contributor

This has been fixed by the native types work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain/schema tech/engines/datamodel Issue about parsing/validation/rendering of the Prisma schema tech/engines/introspection engine Issue in the Introspection Engine tech/engines/migration engine Issue in the Migration Engine tech/engines Issue for tech Engines. topic: native types
Projects
None yet
Development

No branches or pull requests

6 participants