implement basic unique_db
use unique_db in EnumUnique

Along the way, make filter_with_constraints lazy.