Sha256: a3691647d58936bbe0634af5b204a3a86e72bd4cf9edb7f38cf0d86a9ed6fe92
Contents?: true
Size: 1010 Bytes
Versions: 9
Compression:
Stored size: 1010 Bytes
Contents
module Paraphraser class Convertor @@direction = :up cattr_accessor :direction @@migrations_path = 'db/migrate' cattr_accessor :migrations_path class << self def convert with_activerecord_stubbed do migrations.each { |migration| migration.migrate(direction) } end end private def connection ActiveRecord::Base.connection end def migrations @migrations ||= ActiveRecord::Migrator.new(direction, migrations_path).migrations end def with_activerecord_stubbed(&block) apply_stubs yield reset_stubs end def apply_stubs connection.instance_eval do alias_method :real_execute, :execute def execute(*args) p '--', args.first end end end def reset_stubs connection.instance_eval do alias_method :execute, :real_execute end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems