core-legacy/compile_migrations.sh

23 lines
588 B
Bash
Raw Normal View History

#!/usr/bin/env bash
cd "$(dirname "$0")";
migration_num=0;
2020-06-13 17:20:07 +00:00
while [ -f ./sql/migration_$migration_num.sql ]
do
2020-06-13 17:20:07 +00:00
if [ -f ./include/migrations/$migration_num.sql.h ]
then
if [ -z $(find ./sql/migration_$migration_num.sql -newer ./include/migrations/$migration_num.sql.h -print) ]
then
((migration_num++))
continue
fi
fi
echo "Recompiling migration $migration_num"
xxd -i sql/migration_$migration_num.sql | sed 's/\([0-9a-f]\)$/\0, 0x00/' > ./include/migrations/$migration_num.sql.h
((migration_num++))
done
cd $PWD;