Class: CouchMigrate::CouchMigrater

Inherits:
BaseMigrater show all
Defined in:
lib/couch_migrate/couch_migrater.rb

Instance Attribute Summary

Attributes inherited from BaseMigrater

#failed_migration

Instance Method Summary collapse

Methods inherited from BaseMigrater

#completed_migrations, #directory, #pending_migrations, #raw_migrations, #refresh_raw_migrations, #reload, #reset

Constructor Details

#initialize(database, migration_directory = "db/migrate") ⇒ CouchMigrater

Returns a new instance of CouchMigrater.



7
8
9
10
11
12
# File 'lib/couch_migrate/couch_migrater.rb', line 7

def initialize(database, migration_directory="db/migrate")
  persisted_list = CouchPersistedList.new(database)
  executer = CouchExecuter
  super(persisted_list, executer, migration_directory)
  self
end

Instance Method Details

#migrate(*args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/couch_migrate/couch_migrater.rb', line 14

def migrate(*args)
  if defined?( CouchRest::Model::Base)
    orig_auto_update_design_doc = CouchRest::Model::Base.auto_update_design_doc
    CouchRest::Model::Base.auto_update_design_doc = false
  end
  begin
    super
  ensure
    if defined?(CouchRest::Model::Base)
      CouchRest::Model::Base.auto_update_design_doc = orig_auto_update_design_doc 
    end
  end

end