You replace it with a copy with the constraints. schema.copy(constraints = determineConstraintsFor(schema))