From 289597b943b10d5b55340948b159536c004d4fb7 Mon Sep 17 00:00:00 2001 From: Arthur Del Esposte Date: Fri, 23 Oct 2015 17:28:49 -0200 Subject: [PATCH] Add migration to proper update blocks and tasks type in database --- src/noosfero-spb/software_communities/db/migrate/20151023183225_update_namespace_types_on_database.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+), 0 deletions(-) create mode 100644 src/noosfero-spb/software_communities/db/migrate/20151023183225_update_namespace_types_on_database.rb diff --git a/src/noosfero-spb/software_communities/db/migrate/20151023183225_update_namespace_types_on_database.rb b/src/noosfero-spb/software_communities/db/migrate/20151023183225_update_namespace_types_on_database.rb new file mode 100644 index 0000000..e603417 --- /dev/null +++ b/src/noosfero-spb/software_communities/db/migrate/20151023183225_update_namespace_types_on_database.rb @@ -0,0 +1,25 @@ +class UpdateNamespaceTypesOnDatabase < ActiveRecord::Migration + def up + block_types = %w[ + CategoriesAndTagsBlock + CategoriesSoftwareBlock + DownloadBlock + RepositoryBlock + SearchCatalogBlock + SoftwareHighlightsBlock + SoftwareTabDataBlock + SoftwaresBlock + StatisticBlock + WikiBlock + SoftwareInformationBlock + ] + + execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::' || type WHERE type IN (%s)" % [block_types.join(",").gsub(/[^,]+/, "'\\0'")]) + + execute("UPDATE tasks SET type = 'SoftwareCommunitiesPlugin::CreateSoftware' WHERE type = 'CreateSoftware'") + end + + def down + say "this migration can't be reverted" + end +end -- libgit2 0.21.2