Port of EE "Elasticsearch versioned schema for other ActiveRecord models" See merge request gitlab-org/gitlab-ce!31660