Sha256: 9620fc456a253d16aa198110d998632b5a1f5c8663fb585e2a840c81eb8be33c

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

module Mack
  module Database
    module Migrations
      
      # Migrates the database to the latest version
      def self.migrate
        ActiveRecord::Migrator.up(File.join(Mack.root, "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(File.join(Mack.root, "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

2 entries across 2 versions & 1 rubygems

Version Path
mack-active_record-0.7.0 lib/mack-active_record/database_migrations.rb
mack-active_record-0.7.0.1 lib/mack-active_record/database_migrations.rb