Stop continuously churning through adapters in the specs.
Switch to a prepared statement for the job lock query.
Store table definitions in the same file as everything else.
Move the remaining queries that are used in normal operation to prepared statements.