Commit b026a547e94f06992af9ce229522a315248036ae
1 parent
25948907
Exists in
master
and in
29 other branches
ActionItem466: creating the hierarchies for the existing categorizations
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2080 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
db/migrate/043_add_virtual_flag_to_categorizations.rb
1 | 1 | class AddVirtualFlagToCategorizations < ActiveRecord::Migration |
2 | 2 | def self.up |
3 | 3 | add_column :articles_categories, :virtual, :boolean, :default => false |
4 | + execute('update articles_categories set virtual = (1!=1)') | |
5 | + Article.find(:all).each do |article| | |
6 | + article.category_ids = article.categories.map(&:id) | |
7 | + end | |
8 | + | |
4 | 9 | add_column :categories_profiles, :virtual, :boolean, :default => false |
10 | + execute('update categories_profiles set virtual = (1!=1)') | |
11 | + Profile.find(:all).each do |profile| | |
12 | + profile.category_ids = profile.categories.map(&:id) | |
13 | + end | |
5 | 14 | end |
6 | 15 | |
7 | 16 | def self.down | ... | ... |