mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 06:36:14 +00:00
Optimizing sql format check. (#4268)
* Optimizing sql format check. * Fixing format testing. * Fixing format testing 2.
This commit is contained in:
parent
af4d008ce4
commit
70530a8ad2
|
@ -7,9 +7,12 @@ CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
|
|
||||||
cd $CWD/../
|
cd $CWD/../
|
||||||
|
|
||||||
find migrations -type f -name "*.sql" -print0 | while read -d $'\0' FILE
|
# Copy the files to a temp dir
|
||||||
do
|
TMP_DIR=$(mktemp -d)
|
||||||
TMP_FILE="/tmp/tmp_pg_format.sql"
|
cp -a migrations/. $TMP_DIR
|
||||||
pg_format $FILE > $TMP_FILE
|
|
||||||
diff -u $FILE $TMP_FILE
|
# Format the new files
|
||||||
done
|
find $TMP_DIR -type f -name '*.sql' -exec pg_format -i {} +
|
||||||
|
|
||||||
|
# Diff the directories
|
||||||
|
diff -r migrations $TMP_DIR
|
||||||
|
|
Loading…
Reference in a new issue