Module: DataMapper::AutoMigrations
- Defined in:
- lib/gems/dm-core-0.9.9/lib/dm-core/auto_migrations.rb
Overview
class AutoMigrator
Instance Method Summary collapse
-
#auto_migrate!(repository_name = self.repository_name) ⇒ Object
Destructively automigrates the data-store to match the model REPEAT: THIS IS DESTRUCTIVE.
-
#auto_migrate_down!(repository_name = self.repository_name) ⇒ Object
private
Destructively migrates the data-store down, which basically deletes all the models.
-
#auto_migrate_up!(repository_name = self.repository_name) ⇒ Object
private
Auto migrates the data-store to match the model.
-
#auto_upgrade!(repository_name = self.repository_name) ⇒ Object
Safely migrates the data-store to match the model preserving data already in the data-store.
Instance Method Details
#auto_migrate!(repository_name = self.repository_name) ⇒ Object
Destructively automigrates the data-store to match the model REPEAT: THIS IS DESTRUCTIVE
62 63 64 65 |
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/auto_migrations.rb', line 62 def auto_migrate!(repository_name = self.repository_name) auto_migrate_down!(repository_name) auto_migrate_up!(repository_name) end |
#auto_migrate_down!(repository_name = self.repository_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Destructively migrates the data-store down, which basically deletes all the models. REPEAT: THIS IS DESTRUCTIVE
74 75 76 77 78 79 |
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/auto_migrations.rb', line 74 def auto_migrate_down!(repository_name = self.repository_name) # repository_name ||= default_repository_name repository(repository_name) do |r| r.adapter.destroy_model_storage(r, self.base_model) end end |
#auto_migrate_up!(repository_name = self.repository_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Auto migrates the data-store to match the model
86 87 88 89 90 |
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/auto_migrations.rb', line 86 def auto_migrate_up!(repository_name = self.repository_name) repository(repository_name) do |r| r.adapter.create_model_storage(r, self.base_model) end end |
#auto_upgrade!(repository_name = self.repository_name) ⇒ Object
Safely migrates the data-store to match the model preserving data already in the data-store
97 98 99 100 101 |
# File 'lib/gems/dm-core-0.9.9/lib/dm-core/auto_migrations.rb', line 97 def auto_upgrade!(repository_name = self.repository_name) repository(repository_name) do |r| r.adapter.upgrade_model_storage(r, self) end end |