Switch back to in-memory test db

Add support to load db connection from config object in env.py for
alembic. It solves the problem that multiple db are created when using
in-memory sqlite db for testing. When a different connection is created,
a separated db is created in memory.
Make sure db version is up-to-date when (re)create db