Sha256: f740ea7a74c6e6b422fbd028b3e005f1e4a8e74d0604a70f49af857517cf81bd

Contents?: true

Size: 669 Bytes

Versions: 30

Compression:

Stored size: 669 Bytes

Contents

module Migrator
  mattr_accessor :offer_migration_when_available
  @@offer_migration_when_available = true

  def self.migrations_path
    "#{RAILS_ROOT}/db/migrate"
  end

  def self.available_migrations
    Dir["#{migrations_path}/[0-9]*_*.rb"].sort_by { |name| name.scan(/\d+/).first.to_i }
  end

  def self.current_schema_version
    ActiveRecord::Migrator.current_version rescue 0
  end

  def self.max_schema_version
    available_migrations.size
  end

  def self.db_supports_migrations?
    ActiveRecord::Base.connection.supports_migrations?
  end

  def self.migrate(version = nil)
    ActiveRecord::Migrator.migrate("#{migrations_path}/", version)
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
typo-5.5 lib/migrator.rb
typo-5.4.4 lib/migrator.rb
typo-5.4.3 lib/migrator.rb
typo-5.4.2 lib/migrator.rb
typo-5.4.1 lib/migrator.rb
typo-5.4 lib/migrator.rb
typo-3.99.0 lib/migrator.rb
typo-3.99.3 lib/migrator.rb
typo-3.99.1 lib/migrator.rb
typo-3.99.2 lib/migrator.rb
typo-3.99.4 lib/migrator.rb
typo-4.0.2 lib/migrator.rb
typo-4.0.1 lib/migrator.rb
typo-4.0.0 lib/migrator.rb
typo-4.0.3 lib/migrator.rb
typo-4.1.1 lib/migrator.rb
typo-5.0.2 lib/migrator.rb
typo-5.0.1 lib/migrator.rb
typo-4.1 lib/migrator.rb
typo-5.0.3.98.1 lib/migrator.rb