Database refactoring. New migration ordering. Repository work