Skip to content

sql-ts 2.2.0 converts "tinyint(1)" to type "any" #154

@renne

Description

@renne

Hello,

after replacing

{
  "client": "mysql",
  "connection": {
    "host": "127.0.0.1",
    "port": "3306",
    "database": "backend",
    "user": "backend",
    "password": "backend"
  },
  "excludedTables": [
    "backend.products_old"
  ],
  "filename": "Database.d",
  "interfaceNameFormat": "${table}Serialized",
  "singularTableNames": true,
  "tableNameCasing": "pascal",
  "typeOverrides": {
    "backend.products.additionalPublishers": "boolean",
    "backend.products.download": "boolean",
    "backend.products.fundus": "boolean",
    "backend.products.hasPubDate": "boolean",
    "backend.products.isSinglePublisher": "boolean",
    "backend.products.metadataAuthorsLocked": "boolean",
    "backend.products.metadataChecked": "boolean",
    "backend.products.metadataValid": "boolean",
    "backend.products.mundo": "boolean",
    "backend.products.publishOnLernenDigital": "boolean",
    "backend.products.urlReadOnly": "boolean",
    "backend.users.isEditor": "boolean",
    "backend.viewProducts.additionalPublishers": "boolean",
    "backend.viewProducts.download": "boolean",
    "backend.viewProducts.fundus": "boolean",
    "backend.viewProducts.hasPubDate": "boolean",
    "backend.viewProducts.isSinglePublisher": "boolean",
    "backend.viewProducts.metadataAuthorsLocked": "boolean",
    "backend.viewProducts.metadataChecked": "boolean",
    "backend.viewProducts.metadataValid": "boolean",
    "backend.viewProducts.mundo": "boolean",
    "backend.viewProducts.publishOnLernenDigital": "boolean",
    "backend.viewProducts.urlReadOnly": "boolean"
  }
}

with

{
  "client": "mysql",
  "connection": {
    "host": "127.0.0.1",
    "port": "3306",
    "database": "backend",
    "user": "backend",
    "password": "backend"
  },
  "excludedTables": [
    "backend.products_old"
  ],
  "filename": "Database.d",
  "interfaceNameFormat": "${table}Serialized",
  "singularTableNames": true,
  "tableNameCasing": "pascal"
}

the data-type "tinyint(1)" in the MariaDB tables is converted to the Typescript data-type "any".

{
  "client": "mysql",
  "connection": {
    "host": "127.0.0.1",
    "port": "3306",
    "database": "backend",
    "user": "backend",
    "password": "backend"
  },
  "excludedTables": [
    "backend.products_old"
  ],
  "columnTypeMap": {
    "tinyint(1)": "boolean",
    "tinyint1": "boolean"
  },
  "filename": "Database.d",
  "interfaceNameFormat": "${table}Serialized",
  "singularTableNames": true,
  "tableNameCasing": "pascal"
}

converts to data-type "any", too.

Installed database connectors are "mariadb@3.3.2", "mysql@2.18.1", and "mysql2@3.10.3".
I assume mysql will be used here because of the configuration.

$ sql-ts --version
1.0.0

is also weird.

Example:
MariaDB [backend]> show columns from products;

Field Type Null Key Default Extra
urlReadOnly tinyint(1) NO 0

results in 'urlReadOnly'?: any;

Does anyone have an idea what is going wrong here?
Is this a configuration issue, wrong/outdated database connector or a bug in sql-ts 2.2.0?

Thanx for any hint! :-)

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