database migrations rewritten