device_id
Update rule to invalidate `device_id` if a map has been assigned afterwards. Update rule to restore `device_id` if no more maps are assigned to it. Remove all maps (if any) if a rule is deleted. Fixed SQL-schema