summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-02 19:45:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-02 19:45:14 +0000
commitdfc594c33702a123674dcae1d6b4bfe3a2f32fd3 (patch)
tree42f8653451b35f54db68bf914e1d963bfaf13418 /db
parent32b79b6fd4e3a523ee393d7a3e2bb60dbeed77c3 (diff)
downloadredmine-dfc594c33702a123674dcae1d6b4bfe3a2f32fd3.tar.gz
redmine-dfc594c33702a123674dcae1d6b4bfe3a2f32fd3.zip
Default status per tracker (#5991).
git-svn-id: http://svn.redmine.org/redmine/trunk@13535 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20141029181752_add_trackers_default_status_id.rb15
-rw-r--r--db/migrate/20141029181824_remove_issue_statuses_is_default.rb12
2 files changed, 27 insertions, 0 deletions
diff --git a/db/migrate/20141029181752_add_trackers_default_status_id.rb b/db/migrate/20141029181752_add_trackers_default_status_id.rb
new file mode 100644
index 000000000..c0315df70
--- /dev/null
+++ b/db/migrate/20141029181752_add_trackers_default_status_id.rb
@@ -0,0 +1,15 @@
+class AddTrackersDefaultStatusId < ActiveRecord::Migration
+ 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
+ if status_id
+ Tracker.update_all :default_status_id => status_id
+ end
+ end
+
+ def down
+ remove_column :trackers, :default_status_id
+ end
+end
diff --git a/db/migrate/20141029181824_remove_issue_statuses_is_default.rb b/db/migrate/20141029181824_remove_issue_statuses_is_default.rb
new file mode 100644
index 000000000..67a1696c0
--- /dev/null
+++ b/db/migrate/20141029181824_remove_issue_statuses_is_default.rb
@@ -0,0 +1,12 @@
+class RemoveIssueStatusesIsDefault < ActiveRecord::Migration
+ def up
+ remove_column :issue_statuses, :is_default
+ end
+
+ 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").first.pluck(:id)
+ IssueStatus.where(:id => default_status_id).update_all(:is_default => true)
+ end
+end