Skip to content

MySQL JSON strings #56

@samdaw13

Description

@samdaw13

Hello,

I am running into an issue where MySQL needs to store JSON objects as strings. See https://dev.mysql.com/doc/refman/8.0/en/json.html#:~:text=In%20MySQL%2C%20JSON,following%20examples%20demonstrate for more details.

However the sequelize-typescript-generator is typing the database JSON columns as object, which is throwing typing errors when trying to insert, as the insert must be a string, but TypeScript expects an object.

Our implementation is using a programatic script to generate the types. I can literally fix the issue by changing the build/dialects/DialectMySQL.ts jsDataTypesMap.json to 'string'. But that isn't a valid solution.

Is there a way to change the outputted json type from object to string?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions