Commit d29db98fbe4848d1b29033708b09a7f32658c153

Authored by Rodrigo Souto
1 parent 0401d770

gov-user: migration to rename models types based on plugin namescope

src/noosfero-spb/gov_user/db/migrate/20151029193551_update_namespace_types_on_database.rb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +class UpdateNamespaceTypesOnDatabase < ActiveRecord::Migration
  2 + def up
  3 + execute("UPDATE blocks SET type = 'GovUserPlugin::InstitutionsBlock' WHERE type = 'InstitutionsBlock'")
  4 + execute("UPDATE gov_user_plugin_institutions SET type = 'GovUserPlugin::PublicInstitution' WHERE type = 'PublicInstitution'")
  5 + execute("UPDATE gov_user_plugin_institutions SET type = 'GovUserPlugin::PrivateInstitution' WHERE type = 'PrivateInstitution'")
  6 + end
  7 +
  8 + def down
  9 + execute("UPDATE blocks SET type = 'InstitutionsBlock' WHERE type = 'GovUserPlugin::InstitutionsBlock'")
  10 + execute("UPDATE gov_user_plugin_institutions SET type = 'PublicInstitution' WHERE type = 'GovUserPlugin::PublicInstitution'")
  11 + execute("UPDATE gov_user_plugin_institutions SET type = 'PrivateInstitution' WHERE type = 'GovUserPlugin::PrivateInstitution'")
  12 + end
  13 +end
... ...