Sha256: 99970e6e0df80a008c03ca0dfd7d065117f3d9359697a181b138eea889483911
Contents?: true
Size: 924 Bytes
Versions: 10
Compression:
Stored size: 924 Bytes
Contents
# frozen_string_literal: true module RedminePluginsHelper class Migrations class << self def local_versions r = {} Redmine::Plugin.registered_plugins.each_value do |p| p.migrations.each do |ts| r[p.id] ||= [] r[p.id] << ts end end r end def db_versions r = {} db_all_versions.each do |v| pv = parse_plugin_version(v) next unless pv r[pv[:plugin]] ||= [] r[pv[:plugin]] << pv[:timestamp] end r end def db_all_versions ::ActiveRecord::SchemaMigration.create_table ::ActiveRecord::SchemaMigration.all.pluck(:version) end def parse_plugin_version(version) m = version.match(/^(\d+)\-(\S+)$/) return nil unless m { plugin: m[2].to_sym, timestamp: m[1].to_i } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems