Module: DataMapper::Migrations::Repository

Defined in:
lib/dm-core/migrations.rb

Overview

module PostgresAdapter

Instance Method Summary collapse

Instance Method Details

#auto_migrate!Object

Destructively automigrates the data-store to match the model. First migrates all models down and then up. REPEAT: THIS IS DESTRUCTIVE



1183
1184
1185
# File 'lib/dm-core/migrations.rb', line 1183

def auto_migrate!
  DataMapper.auto_migrate!(name)
end

#auto_upgrade!Object

Safely migrates the data-store to match the model preserving data already in the data-store



1191
1192
1193
# File 'lib/dm-core/migrations.rb', line 1191

def auto_upgrade!
  DataMapper.auto_upgrade!(name)
end

#create_model_storage(model) ⇒ Object

TODO: document



1164
1165
1166
1167
1168
# File 'lib/dm-core/migrations.rb', line 1164

def create_model_storage(model)
  if adapter.respond_to?(:create_model_storage)
    adapter.create_model_storage(model)
  end
end

#destroy_model_storage(model) ⇒ Object

TODO: document



1172
1173
1174
1175
1176
# File 'lib/dm-core/migrations.rb', line 1172

def destroy_model_storage(model)
  if adapter.respond_to?(:destroy_model_storage)
    adapter.destroy_model_storage(model)
  end
end

#storage_exists?(storage_name) ⇒ Boolean

Determine whether a particular named storage exists in this repository

Parameters:

  • storage_name (String)

    name of the storage to test for

Returns:

  • (Boolean)

    true if the data-store storage_name exists



1148
1149
1150
1151
1152
# File 'lib/dm-core/migrations.rb', line 1148

def storage_exists?(storage_name)
  if adapter.respond_to?(:storage_exists?)
    adapter.storage_exists?(storage_name)
  end
end

#upgrade_model_storage(model) ⇒ Object

TODO: document



1156
1157
1158
1159
1160
# File 'lib/dm-core/migrations.rb', line 1156

def upgrade_model_storage(model)
  if adapter.respond_to?(:upgrade_model_storage)
    adapter.upgrade_model_storage(model)
  end
end