Skip to content

MySQL Boolean native type is inexpressible: @db.TinyInt not allowed on Boolean fields #2758

Description

@ymc9

Problem

On the MySQL connector, Prisma's canonical native type for Boolean fields is @db.TinyInt(1) — and Prisma rejects @db.Boolean on MySQL (P1012: Native type Boolean is not supported for mysql connector, verified with Prisma 6.19).

ZModel has the restriction inverted: the stdlib declares @db.TinyInt with @@@targetField([IntField]), so it cannot be applied to Boolean fields, while @db.Boolean is accepted.

model M {
    id Int     @id
    b  Boolean @db.TinyInt(1) // ZModel error: attribute "@db.TinyInt" cannot be used on this type of field
    b2 Boolean @db.Boolean    // ZModel accepts — but Prisma rejects this on MySQL
}

As a result the MySQL Boolean native type is not expressible in the ZModel/Prisma common subset, which breaks porting Prisma schemas that use Boolean @db.TinyInt(1) (a common shape, since it's what prisma db pull emits).

Expected

@db.TinyInt should also target BooleanField (stdlib: add BooleanField to its @@@targetField list), matching Prisma's MySQL connector.

Context

Found while building the Prisma physical-schema parity test suite for the native migration engine — the exhaustive MySQL native-type case documents this gap in a comment. The default Booleantinyint(1) mapping (no native type attribute) is unaffected and already matches Prisma.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions