refactor database structure, add build table