lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Use a different SQL formatter

Open dullbananas opened this issue 1 year ago • 3 comments

The horrific formatting of this file is forced by the formatter that's currently used

https://github.com/dullbananas/lemmy/blob/bliss/replaceable_schema.sql

dullbananas avatar Jan 26 '24 23:01 dullbananas

Any suggestions? You could also try adjusting the configuration of pg_format.

Nutomic avatar Jan 29 '24 10:01 Nutomic

I remember trying this prettier plugin for SQL, but I don't think it worked as well.

dessalines avatar Jan 29 '24 14:01 dessalines

Doesn't format function bodies:

Not fully implemented yet; throws syntax error:

dullbananas avatar Jan 29 '24 22:01 dullbananas

The link to the query above no longer works so I can't see exactly what you mean. But last time I investigated SQL formatters, the one we use now was the best there was. I checked the prettier plugin as well but it didn't work.

In a different project, what I did was add a filter if the file starts with -- pgFormatter-ignore it is skipped and not formatted. That "fixed" the few cases where pgformatter was annoying.

phiresky avatar Mar 03 '24 12:03 phiresky

Feel free to open a PR for this.

Nutomic avatar May 14 '24 21:05 Nutomic