sql_beautifier 0.10.4 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/sql_beautifier/cte_definition.rb +2 -1
- data/lib/sql_beautifier/cte_query.rb +2 -7
- data/lib/sql_beautifier/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb887e1c6ce5f0084f039ec0fd92717e861dc425bd40ce447c113726a7e16a30
|
|
4
|
+
data.tar.gz: e13a2ea6cb4986e819d5653fa4dc714592c56faadd71b2826e457b7208dc8464
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9964b5ed83c63bc41b79be3356ca96b448b460c380caf7e73431fc4a2009d7473483546bb3a1e90cfd106f878fe0b01a808eda60e38ffdcb1abba4e2a5ad61f
|
|
7
|
+
data.tar.gz: 6e7c5ac77fc86253a8e83f1ce2e8acbc578a3799f3d768d8f5fae26181724b104635f35c5fb5ea2ada9fb044c1f0daabdddc5af3c7eb78661caa63e1e6b57022
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## [X.X.X] - YYYY-MM-DD
|
|
4
4
|
|
|
5
|
+
## [0.10.5] - 2026-04-08
|
|
6
|
+
|
|
7
|
+
- Change CTE formatting to use compact `with` prefix — `with` is no longer padded to the keyword column width; CTE body lines are indented by `indent_spaces` from column zero instead of from the keyword column, and the closing `)` sits at column zero; subsequent CTE definitions in multi-CTE queries also start at column zero
|
|
8
|
+
- Apply table name formatting to CTE definition names — CTE names in the `with ... as (` header now follow the `table_name_format` setting (PascalCase by default), matching how CTE references are formatted in `FROM` clauses
|
|
9
|
+
|
|
5
10
|
## [0.10.4] - 2026-03-30
|
|
6
11
|
|
|
7
12
|
- Add `IN` list multiline formatting — `WHERE x IN (1, 2, 3)` value lists with 2+ items are now expanded to one item per line with proper indentation; single-item lists and `IN (SELECT ...)` subqueries are left unchanged
|
|
@@ -8,7 +8,8 @@ module SqlBeautifier
|
|
|
8
8
|
option :materialization, default: -> {}
|
|
9
9
|
|
|
10
10
|
def render_header
|
|
11
|
-
|
|
11
|
+
formatted_name = @name.start_with?(Constants::DOUBLE_QUOTE) ? @name : Util.format_table_name(@name)
|
|
12
|
+
header = +formatted_name
|
|
12
13
|
header << " (#{@column_list})" if @column_list
|
|
13
14
|
header << " #{Util.format_keyword('as')}"
|
|
14
15
|
header << " #{format_materialization}" if @materialization
|
|
@@ -102,21 +102,16 @@ module SqlBeautifier
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def render
|
|
105
|
-
keyword_width = SqlBeautifier.config_for(:keyword_column_width)
|
|
106
|
-
continuation_indent = Util.continuation_padding
|
|
107
|
-
|
|
108
105
|
output = +""
|
|
109
106
|
|
|
110
107
|
@definitions.each_with_index do |definition, index|
|
|
111
108
|
if index.zero?
|
|
112
|
-
output << Util.
|
|
109
|
+
output << "#{Util.format_keyword('with')} "
|
|
113
110
|
output << "#{Util.format_keyword('recursive')} " if @recursive
|
|
114
|
-
else
|
|
115
|
-
output << continuation_indent
|
|
116
111
|
end
|
|
117
112
|
|
|
118
113
|
output << definition.render_header
|
|
119
|
-
output << definition.render_body(
|
|
114
|
+
output << definition.render_body(0)
|
|
120
115
|
output << (index < @definitions.length - 1 ? ",\n" : "\n\n")
|
|
121
116
|
end
|
|
122
117
|
|