Module: Cardio::Migration::Assumption

Included in:
Cardio::Migration
Defined in:
lib/cardio/migration/assumption.rb

Overview

methods for assuming migration states

Instance Method Summary collapse

Instance Method Details

#assume_currentObject



5
6
7
8
9
10
11
12
# File 'lib/cardio/migration/assumption.rb', line 5

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

#assume_migrated_upto_version(version = nil) ⇒ Object



14
15
16
17
18
19
# File 'lib/cardio/migration/assumption.rb', line 14

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