Commit c0e66bcf685c1185f872de7537c15cee09ccdb2f
1 parent
8155d272
Exists in
master
and in
29 other branches
ActionItem629: updating existing data in migration
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2429 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
db/migrate/050_add_public_column_to_articles_and_profiles.rb
1 | 1 | class AddPublicColumnToArticlesAndProfiles < ActiveRecord::Migration |
2 | 2 | def self.up |
3 | 3 | add_column :profiles, :public_profile, :boolean, :default => true |
4 | + execute("update profiles set public_profile = (1>0) where data not like '%public_profile: false%'") | |
5 | + | |
4 | 6 | add_column :articles, :public_article, :boolean, :default => true |
5 | 7 | add_column :article_versions, :public_article, :boolean, :default => true |
6 | 8 | end | ... | ... |
db/migrate/051_add_edit_appearance_permission.rb
1 | 1 | class AddEditAppearancePermission < ActiveRecord::Migration |
2 | 2 | |
3 | 3 | def self.up |
4 | - [ Profile::Roles.admin, Environment::Roles.admin].each do |item| | |
4 | + [ Profile::Roles.admin, Environment::Roles.admin].compact.each do |item| | |
5 | 5 | item.permissions += [ 'edit_appearance' ] |
6 | 6 | item.save! |
7 | 7 | end |
8 | 8 | end |
9 | 9 | |
10 | 10 | def self.down |
11 | - [ Profile::Roles.admin, Environment::Roles.admin].each do |item| | |
11 | + [ Profile::Roles.admin, Environment::Roles.admin].compact.each do |item| | |
12 | 12 | item.permissions -= [ 'edit_appearance' ] |
13 | 13 | item.save! |
14 | 14 | end | ... | ... |