+CREATE OR REPLACE VIEW tag_type_max_role_id AS
+SELECT tag_type_id, max(role_id) from tag_type_role GROUP BY tag_type_id;
+
+-- tag_types that have at least one role in the new model get the max
+UPDATE tag_types
+SET min_role_id = tag_type_max_role_id.max
+FROM tag_type_max_role_id WHERE tag_type_max_role_id.tag_type_id = tag_types.tag_type_id;