Commit 72bf3be8aedf3339dc8c1dfb588c3b773df9bbb7
1 parent
5e076253
Exists in
gov-user-refactoring
gov-user: migration to rename models types based on plugin namescope
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
src/noosfero-spb/gov_user/db/migrate/20151029193551_update_namespace_types_on_database.rb
0 → 100644
@@ -0,0 +1,13 @@ | @@ -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 |