[migration] add sql constraints on upgrade [applied]