feat(CI/CheckPending): add check version db line (#8653)

This commit is contained in:
Kargatum
2021-11-02 20:44:17 +07:00
committed by GitHub
parent 58a04d12c7
commit 2d38f36555
2 changed files with 38 additions and 20 deletions

35
apps/ci/ci-pending.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
set -e
echo "Pending SQL check script:"
echo
for i in `find data/sql/updates/pending* -name "*.sql" -type f`; do
if $(cat "$i"|sed "s/'.*'\(.*\)/\1/g"|grep -q -i -E "(PROCEDURE|FUNCTION)"); then
echo "> PROCEDURE check - Failed"
exit 1
else
echo "> PROCEDURE check - OK"
fi
done
for i in `find data/sql/updates/pending* -name "*.sql" -type f`; do
if [[ $(cat "$i"|sed 's/ --[^--]*$//'|tr -d '\n'|tr -d " "|tail -c 1) != ";" ]]; then
echo "Missing Semicolon (;) or multiple newlines at the end of the file."
exit 1
else
echo "> Semicolon check - OK"
fi
done
for i in `find data/sql/updates/pending* -name "*.sql" -type f`; do
if $(cat "$i"|sed "s/'.*'\(.*\)/\1/g"|grep -q -i -E "version_db_"); then
echo "> version_db check - OK"
else
echo "> version_db check - Failed"
exit 1
fi
done
echo
echo "Everything looks good"