Commit dc0dc7e1bb5b28ecc6f7b616469b489d50cdfacc
Committed by
Antonio Terceiro
1 parent
45f1890f
Exists in
master
and in
22 other branches
Adding migrate to add visible=true to profiles
* Except environment templates (ActionItem1273)
Showing
2 changed files
with
22 additions
and
1 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +class Environment < ActiveRecord::Base | |
| 2 | + set_table_name 'environments' | |
| 3 | + serialize :settings, Hash | |
| 4 | +end | |
| 5 | + | |
| 6 | +class SetVisibleToProfiles < ActiveRecord::Migration | |
| 7 | + def self.up | |
| 8 | + templates = [] | |
| 9 | + Environment.all.each do |e| | |
| 10 | + templates << e.settings[:person_template_id] | |
| 11 | + templates << e.settings[:enterprise_template_id] | |
| 12 | + templates << e.settings[:inactive_enterprise_template_id] | |
| 13 | + templates << e.settings[:community_template_id] | |
| 14 | + end | |
| 15 | + execute "update profiles set visible=(1=1) where id NOT IN (#{templates.compact.join(',')})" | |
| 16 | + end | |
| 17 | + | |
| 18 | + def self.down | |
| 19 | + say("Nothing to undo (cannot recover the data)") | |
| 20 | + end | |
| 21 | +end | ... | ... |
db/schema.rb
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | # |
| 10 | 10 | # It's strongly recommended to check this file into your version control system. |
| 11 | 11 | |
| 12 | -ActiveRecord::Schema.define(:version => 82) do | |
| 12 | +ActiveRecord::Schema.define(:version => 83) do | |
| 13 | 13 | |
| 14 | 14 | create_table "article_versions", :force => true do |t| |
| 15 | 15 | t.integer "article_id" | ... | ... |