Skip to content

Releases: rmp135/sql-ts

1.14.0

10 Sep 20:48
eb787ea
Compare
Choose a tag to compare

Breaking

  • Fix 104 Trailing numbers are now merged when converting to case. Although technically a regression it does impact the generated names.

New

Fixes

  • Fix 107. Enum names of 0 are now correctly converted to TS safe values.

(Not sure why but the linking to issues / pull requests are broken in the editor.)

1.13.0

19 Mar 10:09
27e0d17
Compare
Choose a tag to compare

All documentation can now be found at the new documentation page.

Breaking

  • Tables names ending with 'ies' are renamed to 'y' when using singularTableNames option. Thanks to @ajeffrey.
  • SQLite primary keys are now optional.
    • Although it was correctly brought up in pull #90 that SQLite primary keys are not optional, I think 90% of the time it's going to be auto-increment and therefore optional.
    • To combat this, a new option columnOptionality has been added to allow for overriding optionality on a per column basis.

New

  • Upgrade knex to 1.0. This adds support for better-sqlite3.
  • Table generated enums.
    • Enums can now be generated using static data from a table, and can be referenced as the type of another column.
    • For further info and examples, see the documentation.
  • Config option columnOptionality to allow for overriding optionality on a per column basis.
  • Fix #98 - Config option globalOptionality to set the optionality globally, allowing for creating read models.
  • Config option enumNumericKeyFormat to set the format when a numeric key is found.
  • Config option custom for defining user-defined variables in the template. Thanks to @DarkRoku12 for the idea.

Fixes

  • Column names are sorted based on their name. Thanks to @jwmonroe-outschool.
  • Enums are sorted based on their returned sort order. Thanks to @jhiesey.
  • Fix #99 - Handling of numeric enum keys.
    • Enum keys that are numeric are now passed through the enumNumericKeyFormat config option. By default, it will prepend the key with an underscore.

1.12.1

17 Nov 20:42
40f07f5
Compare
Choose a tag to compare
  • Fixes #93 Error when running from command line or without connection context.

1.12.0

13 Nov 14:29
5cf030b
Compare
Choose a tag to compare

New

  • #79 - Allow for an existing knex connection to be used.
    • toObject and toTypescript both allow for a knex connection to be passed as the second argument. In this case you do not need to specify the connection details, only the sql-ts options.
  • #68 - Importing comments from the database.
    • Table and column comments can now be imported from the database. See the README for more info on how these are populated.

Fixes

  • #88 - Enums and enum values are sorted by name for consistency between generations.
  • #92 - Fix for CLI usage when supplying the config option.
  • Better type conversions for postgres. Thanks to @DarkRoku12
  • SQLite adapter usage improvements. Thanks to @herrecito
  • Support for postgres generated columns and identities. Thanks to @xiaoyu-tamu.

1.11.0

27 Sep 14:26
64ea54c
Compare
Choose a tag to compare

Breaking

#75 - Precise types returned from postgres will be correctly set as strings instead of numbers.

#82 - Numbers are no longer removed from type names. If you're using a custom template, you need to add quotes to the types.

Enums no longer have spaces or invalid characters removed from the type name. If you're using a custom template, you need to add quotes to the enum names.

Fixed

#84 - Fixes enum references on columns being an incorrect case if enumNameCasing config option is applied.

New

#87 - Support for standard postgres views.

#84 - New config option enumKeyCasing. Changes the casing of enum keys.

1.10.0

06 Sep 09:59
fa3b3d9
Compare
Choose a tag to compare

Breaking

Hopefully nothing but some TypeScript type names were changed and a large refactor took place so 🤞.

Fixed

Fixed #76 - All clients have had their optionality and nullability standardised.
Fixed issue found in #80 - TypeMap changed to allow for per-client typings so mssql returns string for timestamp type.

1.9.0

26 Jun 07:36
Compare
Choose a tag to compare

Fixed

#72 - Modifications to the case naming to remove invalid characters.

Changes

#69 - Additions to the typing resolution map.

1.8.2

06 Mar 12:06
Compare
Choose a tag to compare

Fixed

#65 - Invalid casing issue with MSSQL.

Changes

#63 - Adds float4 and float8 data types to typemap for better postgres compatibility.

Thanks to @saostad and @edorivai for their contributions.

1.8.1

21 Feb 10:48
Compare
Choose a tag to compare

Fixed

Merged #62 - Issue with MySQL isNullable flag not being correctly read. Thanks to @tslater for the contribution.

1.8.0

13 Feb 16:00
Compare
Choose a tag to compare

New

#53 - isPrimaryKey is now available for templating. This isn't used on the default template but can be used if you need it.