error logging and database migration