Fix check in jobsets

The current check happening in jobsets is incorrect. The wanted constraint is stated as follow :

  • If type is 0 (legacy), then the flake field should be null, and both nixExprInput and nixExprPath should be non-null
  • If type is 1 (flake), then the flake field should be non-null, and both nixExprInput and nixExprPath should be null

The current version will not catch (i.e. it will accept) situations where you have for instance : type = 1, nixExprPath null, nixExprInput non-null, flake non-null

This commit fixes that.

I split(ted) that into two constraints, to make it more readable and easier to extend if a new type appears in the future.

The complete query could be instead : ( type = 0 AND nixExprInput IS NOT NULL AND nixExprPath IS NOT NULL AND flake IS NULL ) OR ( type = 1 AND nixExprInput IS NULL AND nixExprPath IS NULL AND flake IS NOT NULL )

(but an "OR" cannot be split, hence the other formulation)

Created by  Ismaël Bouya  on February 1, 2021
WKZLAYIEIH2VQJGFTDZAVL2ILQWI32X5UZA7Y6YBVE7LVVS5A2TQC
Change contents