Flowdock
assume_migrated_upto_version(version) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 333
      def assume_migrated_upto_version(version)
        sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
        migrated = select_values("SELECT version FROM #{sm_table}").map(&:to_i)
        versions = Dir['db/migrate/[0-9]*_*.rb'].map do |filename|
          filename.split('/').last.split('_').first.to_i
        end

        execute "INSERT INTO #{sm_table} (version) VALUES ('#{version}')" unless migrated.include?(version.to_i)
        (versions - migrated).select { |v| v < version.to_i }.each do |v|
          execute "INSERT INTO #{sm_table} (version) VALUES ('#{v}')"
        end
      end
Register or log in to add new notes.