Commit 289597b943b10d5b55340948b159536c004d4fb7

Authored by Arthur Esposte
1 parent d8c50990

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 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +class UpdateNamespaceTypesOnDatabase < ActiveRecord::Migration
  2 + def up
  3 + block_types = %w[
  4 + CategoriesAndTagsBlock
  5 + CategoriesSoftwareBlock
  6 + DownloadBlock
  7 + RepositoryBlock
  8 + SearchCatalogBlock
  9 + SoftwareHighlightsBlock
  10 + SoftwareTabDataBlock
  11 + SoftwaresBlock
  12 + StatisticBlock
  13 + WikiBlock
  14 + SoftwareInformationBlock
  15 + ]
  16 +
  17 + execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::' || type WHERE type IN (%s)" % [block_types.join(",").gsub(/[^,]+/, "'\\0'")])
  18 +
  19 + execute("UPDATE tasks SET type = 'SoftwareCommunitiesPlugin::CreateSoftware' WHERE type = 'CreateSoftware'")
  20 + end
  21 +
  22 + def down
  23 + say "this migration can't be reverted"
  24 + end
  25 +end
... ...