Skip to content

Commit 0a282a2

Browse files
Change SQL fomatting tool to pgformatter (#477)
Change the SQL formatting tool used by `make format` from [sql-formatter](https://github.com/sql-formatter-org/sql-formatter) to [pgFormatter](https://github.com/darold/pgFormatter). Stop using `sql-formatter` because it doesn't work on the `read_schema` function: ``` npx sql-formatter -l postgresql --fix pkg/state/init.sql ```` doesn't change the file regardless of whatever changes are made to `read_schema`. `pgFormatter` produces consistent formatting on the `read_schema` function so let's use that. I'm not convinced that either formatting tool gave us formatting that was better than what we were doing by hand before. It's a question of consistency vs personal preference.
1 parent 0b08a1d commit 0a282a2

File tree

3 files changed

+275
-282
lines changed

3 files changed

+275
-282
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373

7474
- name: Generate types
7575
run: |
76+
chmod 666 pkg/state/init.sql
7677
make generate
7778
7879
- name: Ensure generated types are up-to-date

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ format:
1010
# Format JSON schema
1111
docker run --rm -v $$PWD/schema.json:/mnt/schema.json node:alpine npx prettier /mnt/schema.json --parser json --tab-width 2 --single-quote --trailing-comma all --no-semi --arrow-parens always --print-width 120 --write
1212
# Format embedded SQL
13-
docker run --rm -v $$PWD/pkg/state/init.sql:/mnt/init.sql node:alpine npx sql-formatter -l postgresql -o /mnt/init.sql /mnt/init.sql
13+
docker run --rm -v $$PWD/pkg/state/init.sql:/data/init.sql backplane/pgformatter --inplace /data/init.sql
1414

1515
generate: format
1616
# Generate the types from the JSON schema

0 commit comments

Comments
 (0)