Sha256: 224f16e3ef552a46d28211383bdf738bc5b2c431d7b295dadda067a0bfb01aef

Contents?: true

Size: 833 Bytes

Versions: 11

Compression:

Stored size: 833 Bytes

Contents

module Mack
  module Database
    module Migrations
      
      # Migrates the database to the latest version
      def self.migrate
        ActiveRecord::Migrator.up(Mack::Paths.db("migrations"))
      end
      
      # Rolls back the database by the specified number of steps. Default is 1
      def self.rollback(step = 1)
        cur_version = version.to_i
        target_version = cur_version - step 
        target_version = 0 if target_version < 0
        ActiveRecord::Migrator.down(Mack::Paths.db("migrations"), target_version)
      end
      
      # Not implemented
      def self.abort_if_pending_migrations
      end
      
      # Returns the current version of the database
      def self.version
        ActiveRecord::Migrator.current_version
      end
            
    end # Migrations
  end # Database
end # Mack

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mack-active_record-0.8.0.3 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.0.1 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.0.2 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.1 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.2 lib/mack-active_record/database_migrations.rb
mack-active_record-0.7.1 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.0.101 lib/mack-active_record/database_migrations.rb
mack-active_record-0.7.1.1 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.0 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.3 lib/mack-active_record/database_migrations.rb
mack-active_record-0.8.3.1 lib/mack-active_record/database_migrations.rb