Bash script to validate a MySQL database
Prefer portable shell

There's no reason to use Bash [[ where [ will do, unless you already depend on other Bash features (such as arrays).  This will of course increase the number of places where you must:

Quote parameter expansions

In expansions like $(basename -s .sql $1), don't forget the quotes:

[[ $(basename -s .sql "$1") =~ ${release_format} ]]
# I removed `&amp;&amp; return 0 || return -1` - see next item


Let exit status flow naturally

The Bash manual says:


  When executed, the exit status of a function is the exit status of the last command executed in the body.


This means that adding return $? to the end of every function adds no value, as do constructs such as &amp;&amp; return 0 || return -1 - just let success/fail flow through.

Put credentials in a separate file

Don't put user and password in the script (particularly if you want to put it into a version control server).  Instead, require each user to provide their credentials in a (non-world-readable) file.  If you're particularly diligent, you could fail the script if the permissions on the credentials file are too permissive.

Don't invoke ls just to check existence

# true if the first argument exists
one_exists()
{
    test -e "$1"
}

ensureRollback() {
     test -n "$1" &amp;&amp; one_exists "${rollbacks}/$(toTicket ${1})"*
}