Class: Rails::Sequel::Migrations

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel-rails/migrations.rb

Class Method Summary collapse

Class Method Details

.migrate_down!(version = nil) ⇒ Object



13
14
15
16
17
# File 'lib/sequel-rails/migrations.rb', line 13

def migrate_down!(version=nil)
  opts = {}
  opts[:target] = version.to_i if version
  ::Sequel::Migrator.run(::Sequel::Model.db, "db/migrate", opts)
end

.migrate_up!(version = nil) ⇒ Object



7
8
9
10
11
# File 'lib/sequel-rails/migrations.rb', line 7

def migrate_up!(version=nil)
  opts = {}
  opts[:target] = version.to_i if version
  ::Sequel::Migrator.run(::Sequel::Model.db, "db/migrate", opts)
end

.pending_migrations?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/sequel-rails/migrations.rb', line 19

def pending_migrations?
  return false unless File.exists?("db/migrate")
  !::Sequel::Migrator.is_current?(::Sequel::Model.db, "db/migrate")
end