Manage multi database.
moved the database creation/migration to functions.