Use Lua scripts to update database

Removed version specific updating code from the source code and created
"migrations" located in data/migrations/. When the server starts, it
will open data/migrations/%CURRENT_VERSION%.lua where %CURRENT_VERSION%
is the current database version. If it returns true, it will increment
the database version and load %CURRENT_VERSION%+1.lua and repeat until
the next file doesn't exist or returns false.

This commit also fixes a bug with motd_hash/motd_num.