Releases: sql-formatter-org/sql-formatter
6.0.0
From 4.x to 6.x
This release is mostly a back-merge of the Prettier SQL fork.
The latest stable release of SQL Formatter was 4.0.2. Prettier SQL continued from that, releasing Prettier SQL 5.0 ... 5.1.1. Now back in SQL Formatter we're skipping the 5.x versions and going straight to 6.
Breaking changes since 4.x
Command line options --indent (-i), --tab-indent (-t), --uppercase (-u) and --lines-between-queries have been removed in favor of using a JSON config file which can be specified using --config (-c) option.
The equivalent options in a config file are as follows:
{
"tabWidth": 4,
"useTabs": true,
"keywordCase": "upper",
"linesBetweenQueries": 2
}
When used as a library, the indent and uppercase options have been replaced similarly.
New features
New SQL Dialects: GCP BigQuery, Apache Hive.
Lots of new configuration options. See the README for a full list.
Bugfixes and minor enhancements
- Added support for DB2 hex literals #123
- Added support for PL/SQL
$$ ... $$quoted strings #183 - Added support for Postgres C-style escaped strings #198
- Scientific notation now supported for numbers #153
- Various fixes operator handling #125 #135 #150 #167 #176 #201
- Backtick-quoted identifiers and single-quoted strings now supported again in default
language: "sql"#139 #147 #192 - Fixed formatting of
CHARACTER SET#181 - The RETURNING keyword is now properly recognized in Postgres, MariaDB, N1QL and PL/SQL #196
- Improved STDOUT handling #194
- Fixed CLI command regressions #209 #210
- Fixed crash in Safary caused by regex look-behind inferrinizzard#84
6.0.0-beta.4
- Fix Safari crash because of look-ahead and look-behind regexes inferrinizzard#84
6.0.0-beta.3
- Replace
indentoption with two options:tabWidthanduseTabs - Throw
ConfigErrorinstead of plainErrorto distinguish configuration errors.
6.0.0-beta.2
- Rename
newlineoption tomultilineLists, also changing the values:newline: "never"tomultilineLists: "avoid"newline: "lineWidth"tomultilineLists: "expressionWidth"
- Rename
lineWidthoption toexpressionWidth - Reference correct type definition file from package.json
- Restore original formatting of WHEN ... THEN
- Remove special handling of LATERAL
v6.0.0-beta.1
6.0.0-beta.1
prettier-sql v5.1.1
(Released under name prettier-sql)
Updated
- restored itemCount setting for VScode extension
- added JSDocs for all files
- added conditional skips for Jest tests
- added missing BigQuery, hive from demo page language dropdown
Fixed
- fixed bug with CASE and Inline Block interaction
- fixed bug with END not adding spacings before END
- fixed bug with CommaPosition.before when the line had no preceding whitespace
- fixed bug where AS in CAST functions would get deleted when AliasAs.never
- fixed bug where AS would get deleted in CTE definition when AliasAs.never
prettier-sql v5.1.0
(Released under name prettier-sql)
Known Issues
newline: numberdoes not work with[foo],[and]both count as 1 token each so[foo]would be 3 itemsarray[0]ormap[key]do still work as they are parsed as WORD
- BigQuery formatter fails a few tests (ALTER TABLE, tricky line comments) due to those tests not including valid BigQuery SQL, those tests are currently skipped
Added
Source:
- consumed VSCode Extension as subrepo
- added support for Hive language
- added support for BigQuery language
- added keyword dedupe on Formatter classes via Set
VSCode:
- added command
prettier-sql-vscode.format-selection- Formats SQL selections
- added settings to override user/workspace
tabSizeandinsertSpacessettings - added error message on format fail
- added setting to override formatting language for
sqlfiles when SQL flavour does not have a VSCode language ID (Microsoft PostgreSQL and MSSQL Extensions)
Other:
- demo page now deployed as git repo subtree, served from root/ (subtree of static/)
Updated
- fixed handling of
newlineoptions - simplified
NewlineModeconfig - fixed ; indentation when used with
semicolonNewlineandtenSpaceconfigs - Formatter now uses numeric for loop to allow for index manipulation
- updated
linesBetweenQueriesto add an extra newline (0 lines = 1 line break, no space in between) - renamed Formatter class files to
<flavour>.formatter.ts - renamed test files to
<flavour>.test.js
Removed
- removed
newline: hybridconfignewline: numbernow acts likehybrid
prettier-sql v5.0.1
(Released under name prettier-sql)
Updated
- fixed bug when using SELECT * and
denseOperators - fixed aliasAs option on demo page
- fixed handling of tokens with
aliasAsflag - demo page now prints stack trace in textarea on error
prettier-sql v5.0.0
(Released under name prettier-sql)
Added
Source:
- added support for ES6 module exports with TypeScript
- updated webpack with ts-loader for module types
- added tsc to babel commonjs build command
- added index.ts pass-through export
Other:
- added GH Actions for CI build
- added issue templates
Updated
Source:
- updated demo page for all new options
Other:
- renamed library to
prettier-sql
Fixed
- fixed bugs related to operator tokens
Removed
- removed Travis CI (replaced by GH Actions)
prettier-sql v5.0.0-beta.1
(Released under name prettier-sql)