Database initialization and migration engine