Database schema init and refactorings