22 lines
588 B
Bash
Executable file
22 lines
588 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
cd "$(dirname "$0")";
|
|
|
|
migration_num=0;
|
|
|
|
while [ -f ./sql/migration_$migration_num.sql ]
|
|
do
|
|
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;
|