summaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-04-03 01:34:45 +0000
committerGo MAEDA <maeda@farend.jp>2021-04-03 01:34:45 +0000
commit74a6ff023075edec4d92ea5ba229b321f33e72c5 (patch)
treed0fb7fcec004ff916f112eb55a7e8da8f5b4f1fb /db/migrate
parent1eefff4d9c8a214f6abf07ad3bd3c4dcbf66931b (diff)
downloadredmine-74a6ff023075edec4d92ea5ba229b321f33e72c5.tar.gz
redmine-74a6ff023075edec4d92ea5ba229b321f33e72c5.zip
Replace pluck().first with pick() (#32909).
Patch by Pavel Rosický and Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20907 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20131004113137_support_for_multiple_commit_keywords.rb6
-rw-r--r--db/migrate/20141029181752_add_trackers_default_status_id.rb4
-rw-r--r--db/migrate/20141029181824_remove_issue_statuses_is_default.rb2
3 files changed, 6 insertions, 6 deletions
diff --git a/db/migrate/20131004113137_support_for_multiple_commit_keywords.rb b/db/migrate/20131004113137_support_for_multiple_commit_keywords.rb
index d8beb4aea..d7a9d5cc3 100644
--- a/db/migrate/20131004113137_support_for_multiple_commit_keywords.rb
+++ b/db/migrate/20131004113137_support_for_multiple_commit_keywords.rb
@@ -2,9 +2,9 @@ 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').limit(1).pluck(:value).first
- status_id = Setting.where(:name => 'commit_fix_status_id').limit(1).pluck(:value).first
- done_ratio = Setting.where(:name => 'commit_fix_done_ratio').limit(1).pluck(:value).first
+ 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
diff --git a/db/migrate/20141029181752_add_trackers_default_status_id.rb b/db/migrate/20141029181752_add_trackers_default_status_id.rb
index 74716ea63..043be0c68 100644
--- a/db/migrate/20141029181752_add_trackers_default_status_id.rb
+++ b/db/migrate/20141029181752_add_trackers_default_status_id.rb
@@ -2,8 +2,8 @@ class AddTrackersDefaultStatusId < ActiveRecord::Migration[4.2]
def up
add_column :trackers, :default_status_id, :integer
- status_id = IssueStatus.where(:is_default => true).pluck(:id).first
- status_id ||= IssueStatus.order(:position).pluck(:id).first
+ status_id = IssueStatus.where(:is_default => true).pick(:id)
+ status_id ||= IssueStatus.order(:position).pick(:id)
if status_id
Tracker.update_all :default_status_id => status_id
end
diff --git a/db/migrate/20141029181824_remove_issue_statuses_is_default.rb b/db/migrate/20141029181824_remove_issue_statuses_is_default.rb
index 09808e31c..94b518ea3 100644
--- a/db/migrate/20141029181824_remove_issue_statuses_is_default.rb
+++ b/db/migrate/20141029181824_remove_issue_statuses_is_default.rb
@@ -6,7 +6,7 @@ class RemoveIssueStatusesIsDefault < ActiveRecord::Migration[4.2]
def down
add_column :issue_statuses, :is_default, :boolean, :null => false, :default => false
# Restores the first status as default
- default_status_id = IssueStatus.order(:position).pluck(:id).first
+ default_status_id = IssueStatus.order(:position).pick(:id)
IssueStatus.where(:id => default_status_id).update_all(:is_default => true)
end
end