refactoring schema creation method