added automatic migration of database