remove treat_missing_as_none from invalidate, and add migrate script to ensure that all licences always have a handler and handler_version