Module: DataMapper::Migrations::Model
- Defined in:
- lib/dm-core/migrations.rb
Overview
module Repository
Class Method Summary collapse
-
.included(mod) ⇒ Object
private
TODO: document.
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.
-
#storage_exists?(repository_name = default_repository_name) ⇒ Boolean
TODO: document.
Class Method Details
.included(mod) ⇒ 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.
TODO: document
1199 1200 1201 |
# File 'lib/dm-core/migrations.rb', line 1199 def self.included(mod) mod.descendants.each { |model| model.extend self } end |
Instance Method Details
#auto_migrate!(repository_name = self.repository_name) ⇒ Object
Destructively automigrates the data-store to match the model REPEAT: THIS IS DESTRUCTIVE
1215 1216 1217 1218 1219 |
# File 'lib/dm-core/migrations.rb', line 1215 def auto_migrate!(repository_name = self.repository_name) assert_valid 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
1243 1244 1245 1246 1247 1248 1249 1250 |
# File 'lib/dm-core/migrations.rb', line 1243 def auto_migrate_down!(repository_name = self.repository_name) assert_valid if base_model == self repository(repository_name).destroy_model_storage(self) else base_model.auto_migrate_down!(repository_name) 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
1257 1258 1259 1260 1261 1262 1263 1264 |
# File 'lib/dm-core/migrations.rb', line 1257 def auto_migrate_up!(repository_name = self.repository_name) assert_valid if base_model == self repository(repository_name).create_model_storage(self) else base_model.auto_migrate_up!(repository_name) 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
1227 1228 1229 1230 1231 1232 1233 1234 |
# File 'lib/dm-core/migrations.rb', line 1227 def auto_upgrade!(repository_name = self.repository_name) assert_valid if base_model == self repository(repository_name).upgrade_model_storage(self) else base_model.auto_upgrade!(repository_name) end end |
#storage_exists?(repository_name = default_repository_name) ⇒ Boolean
TODO: document
1205 1206 1207 |
# File 'lib/dm-core/migrations.rb', line 1205 def storage_exists?(repository_name = default_repository_name) repository(repository_name).storage_exists?(storage_name(repository_name)) end |