Sha256: 359a02cd54a00483d5116f8fc4e3120380b13ad7b5c053b9b546420550b3050e

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

module Cardio
  class Migration
    # methods for assuming migration states
    module Assumption
      def assume_current
        context do |mc|
          versions = mc.migrations.map(&:version)
          migrated = mc.get_all_versions
          to_mark = versions - migrated
          mark_as_migrated to_mark if to_mark.present?
        end
      end

      def assume_migrated_upto_version version=nil
        mode do |_paths|
          version ||= self.version
          ActiveRecord::Schema.assume_migrated_upto_version version
        end
      end

      private

      def mark_as_migrated versions
        sql = connection.send :insert_versions_sql, versions
        connection.execute sql
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
card-1.108.1 lib/cardio/migration/assumption.rb
card-1.108.0 lib/cardio/migration/assumption.rb
card-1.107.0 lib/cardio/migration/assumption.rb
card-1.106.0 lib/cardio/migration/assumption.rb