Module: Mack::Database::Migrations
- Defined in:
- lib/mack-orm/database_migrations.rb
Class Method Summary collapse
- .abort_if_pending_migrations ⇒ Object
-
.migrate ⇒ Object
Migrates the database to the latest version.
-
.migration_files ⇒ Object
Returns a list of the all migration files.
-
.rollback(step = 1) ⇒ Object
Rolls back the database by the specified number of steps.
-
.version ⇒ Object
Returns the current version of the database.
Class Method Details
.abort_if_pending_migrations ⇒ Object
15 16 17 |
# File 'lib/mack-orm/database_migrations.rb', line 15 def self.abort_if_pending_migrations raise NoMethodError.new(:abort_if_pending_migrations) end |
.migrate ⇒ Object
Migrates the database to the latest version
6 7 8 |
# File 'lib/mack-orm/database_migrations.rb', line 6 def self.migrate raise NoMethodError.new(:migrate) end |
.migration_files ⇒ Object
Returns a list of the all migration files.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mack-orm/database_migrations.rb', line 25 def self.migration_files allmigs = {} Mack.search_path_local_first(:db).each do |path| Dir.glob(File.join(path, 'migrations', '*.rb')).each do |f| base = File.basename(f).match(/\d+_(.+)/).captures.first.downcase unless allmigs[base] allmigs[base] = f end end end allmigs.collect {|k,v| v}.sort end |
.rollback(step = 1) ⇒ Object
Rolls back the database by the specified number of steps. Default is 1
11 12 13 |
# File 'lib/mack-orm/database_migrations.rb', line 11 def self.rollback(step = 1) raise NoMethodError.new(:rollback) end |
.version ⇒ Object
Returns the current version of the database
20 21 22 |
# File 'lib/mack-orm/database_migrations.rb', line 20 def self.version raise NoMethodError.new(:version) end |