File: 20131004113137_support_for_multiple_commit_keywords.rb

package info (click to toggle)
redmine 6.0.6%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 20,104 kB
  • sloc: ruby: 116,318; javascript: 12,885; sh: 460; perl: 303; python: 166; makefile: 30
file content (17 lines) | stat: -rw-r--r-- 789 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class SupportForMultipleCommitKeywords < ActiveRecord::Migration[4.2]
  def up
    # Replaces commit_fix_keywords, commit_fix_status_id, commit_fix_done_ratio settings
    # with commit_update_keywords setting
    keywords = Setting.where(:name => 'commit_fix_keywords').pick(:value)
    status_id = Setting.where(:name => 'commit_fix_status_id').pick(:value)
    done_ratio = Setting.where(:name => 'commit_fix_done_ratio').pick(:value)
    if keywords.present?
      Setting.commit_update_keywords = [{'keywords' => keywords, 'status_id' => status_id, 'done_ratio' => done_ratio}]
    end
    Setting.where(:name => %w(commit_fix_keywords commit_fix_status_id commit_fix_done_ratio)).delete_all
  end

  def down
    Setting.where(:name => 'commit_update_keywords').delete_all
  end
end