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