27 lines
643 B
Bash
27 lines
643 B
Bash
#!/usr/bin/env bash
|
|
currentdbversion=8
|
|
checkDatabaseVersion() {
|
|
local dbversion
|
|
if dbversion=$(Select atom version <<<"\"1\" = 1")
|
|
then
|
|
if (( dbversion == currentdbversion ))
|
|
then
|
|
return 0
|
|
elif (( dbversion < currentdbversion ))
|
|
then
|
|
until (( dbversion == currentdbversion ))
|
|
do
|
|
upgradedatabase_${dbversion}_$((dbversion+1))
|
|
dbversion=$(Select atom version <<<"\"1\" = 1")
|
|
done
|
|
else
|
|
echo "Database schema version $dbversion is" \
|
|
"higher thanthat of this version of" \
|
|
"AtOM ($currentdbversion). Bailing out." >&2
|
|
exit $EDBVERSION
|
|
fi
|
|
else
|
|
Insert atom 1 <<<"version $currentdbversion"
|
|
fi
|
|
}
|