Removes column opt in enumerations table.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3240 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
9fb40b1a2f
commit
8db9ecef08
|
@ -19,8 +19,6 @@ class DocumentCategory < Enumeration
|
|||
has_many :documents, :foreign_key => 'category_id'
|
||||
|
||||
OptionName = :enumeration_doc_categories
|
||||
# Backwards compatiblity. Can be removed post-0.9
|
||||
OptName = 'DCAT'
|
||||
|
||||
def option_name
|
||||
OptionName
|
||||
|
|
|
@ -29,36 +29,6 @@ class Enumeration < ActiveRecord::Base
|
|||
validates_presence_of :name
|
||||
validates_uniqueness_of :name, :scope => [:type, :project_id]
|
||||
validates_length_of :name, :maximum => 30
|
||||
|
||||
# Backwards compatiblity named_scopes.
|
||||
# Can be removed post-0.9
|
||||
named_scope :priorities, :conditions => { :type => "IssuePriority" }, :order => 'position' do
|
||||
ActiveSupport::Deprecation.warn("Enumeration#priorities is deprecated, use the IssuePriority class. (#{Redmine::Info.issue(3007)})")
|
||||
def default
|
||||
find(:first, :conditions => { :is_default => true })
|
||||
end
|
||||
end
|
||||
|
||||
named_scope :document_categories, :conditions => { :type => "DocumentCategory" }, :order => 'position' do
|
||||
ActiveSupport::Deprecation.warn("Enumeration#document_categories is deprecated, use the DocumentCategories class. (#{Redmine::Info.issue(3007)})")
|
||||
def default
|
||||
find(:first, :conditions => { :is_default => true })
|
||||
end
|
||||
end
|
||||
|
||||
named_scope :activities, :conditions => { :type => "TimeEntryActivity" }, :order => 'position' do
|
||||
ActiveSupport::Deprecation.warn("Enumeration#activities is deprecated, use the TimeEntryActivity class. (#{Redmine::Info.issue(3007)})")
|
||||
def default
|
||||
find(:first, :conditions => { :is_default => true })
|
||||
end
|
||||
end
|
||||
|
||||
named_scope :values, lambda {|type| { :conditions => { :type => type }, :order => 'position' } } do
|
||||
def default
|
||||
find(:first, :conditions => { :is_default => true })
|
||||
end
|
||||
end
|
||||
# End backwards compatiblity named_scopes
|
||||
|
||||
named_scope :shared, :conditions => { :project_id => nil }
|
||||
named_scope :active, :conditions => { :active => true }
|
||||
|
@ -80,12 +50,6 @@ class Enumeration < ActiveRecord::Base
|
|||
nil
|
||||
end
|
||||
|
||||
# Backwards compatiblity. Can be removed post-0.9
|
||||
def opt
|
||||
ActiveSupport::Deprecation.warn("Enumeration#opt is deprecated, use the STI classes now. (#{Redmine::Info.issue(3007)})")
|
||||
return OptName
|
||||
end
|
||||
|
||||
def before_save
|
||||
if is_default? && is_default_changed?
|
||||
Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
|
||||
|
|
|
@ -19,8 +19,6 @@ class IssuePriority < Enumeration
|
|||
has_many :issues, :foreign_key => 'priority_id'
|
||||
|
||||
OptionName = :enumeration_issue_priorities
|
||||
# Backwards compatiblity. Can be removed post-0.9
|
||||
OptName = 'IPRI'
|
||||
|
||||
def option_name
|
||||
OptionName
|
||||
|
|
|
@ -19,8 +19,6 @@ class TimeEntryActivity < Enumeration
|
|||
has_many :time_entries, :foreign_key => 'activity_id'
|
||||
|
||||
OptionName = :enumeration_activities
|
||||
# Backwards compatiblity. Can be removed post-0.9
|
||||
OptName = 'ACTI'
|
||||
|
||||
def option_name
|
||||
OptionName
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
class RemoveEnumerationsOpt < ActiveRecord::Migration
|
||||
def self.up
|
||||
remove_column :enumerations, :opt
|
||||
end
|
||||
|
||||
def self.down
|
||||
add_column :enumerations, :opt, :string, :limit => 4, :default => '', :null => false
|
||||
Enumeration.update_all("opt = 'IPRI'", "type = 'IssuePriority'")
|
||||
Enumeration.update_all("opt = 'DCAT'", "type = 'DocumentCategory'")
|
||||
Enumeration.update_all("opt = 'ACTI'", "type = 'TimeEntryActivity'")
|
||||
end
|
||||
end
|
|
@ -160,17 +160,17 @@ module Redmine
|
|||
}
|
||||
|
||||
# Enumerations
|
||||
DocumentCategory.create!(:opt => "DCAT", :name => l(:default_doc_category_user), :position => 1)
|
||||
DocumentCategory.create!(:opt => "DCAT", :name => l(:default_doc_category_tech), :position => 2)
|
||||
DocumentCategory.create!(:name => l(:default_doc_category_user), :position => 1)
|
||||
DocumentCategory.create!(:name => l(:default_doc_category_tech), :position => 2)
|
||||
|
||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_low), :position => 1)
|
||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_normal), :position => 2, :is_default => true)
|
||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_high), :position => 3)
|
||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_urgent), :position => 4)
|
||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_immediate), :position => 5)
|
||||
IssuePriority.create!(:name => l(:default_priority_low), :position => 1)
|
||||
IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true)
|
||||
IssuePriority.create!(:name => l(:default_priority_high), :position => 3)
|
||||
IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4)
|
||||
IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5)
|
||||
|
||||
TimeEntryActivity.create!(:opt => "ACTI", :name => l(:default_activity_design), :position => 1)
|
||||
TimeEntryActivity.create!(:opt => "ACTI", :name => l(:default_activity_development), :position => 2)
|
||||
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
|
||||
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
|
||||
end
|
||||
true
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ task :migrate_from_mantis => :environment do
|
|||
90 => closed_status # closed
|
||||
}
|
||||
|
||||
priorities = Enumeration.priorities
|
||||
priorities = IssuePriority.all
|
||||
DEFAULT_PRIORITY = priorities[2]
|
||||
PRIORITY_MAPPING = {10 => priorities[1], # none
|
||||
20 => priorities[1], # low
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace :redmine do
|
|||
'closed' => closed_status
|
||||
}
|
||||
|
||||
priorities = Enumeration.priorities
|
||||
priorities = IssuePriority.all
|
||||
DEFAULT_PRIORITY = priorities[0]
|
||||
PRIORITY_MAPPING = {'lowest' => priorities[0],
|
||||
'low' => priorities[0],
|
||||
|
|
|
@ -2,63 +2,53 @@
|
|||
enumerations_001:
|
||||
name: Uncategorized
|
||||
id: 1
|
||||
opt: DCAT
|
||||
type: DocumentCategory
|
||||
active: true
|
||||
enumerations_002:
|
||||
name: User documentation
|
||||
id: 2
|
||||
opt: DCAT
|
||||
type: DocumentCategory
|
||||
active: true
|
||||
enumerations_003:
|
||||
name: Technical documentation
|
||||
id: 3
|
||||
opt: DCAT
|
||||
type: DocumentCategory
|
||||
active: true
|
||||
enumerations_004:
|
||||
name: Low
|
||||
id: 4
|
||||
opt: IPRI
|
||||
type: IssuePriority
|
||||
active: true
|
||||
enumerations_005:
|
||||
name: Normal
|
||||
id: 5
|
||||
opt: IPRI
|
||||
type: IssuePriority
|
||||
is_default: true
|
||||
active: true
|
||||
enumerations_006:
|
||||
name: High
|
||||
id: 6
|
||||
opt: IPRI
|
||||
type: IssuePriority
|
||||
active: true
|
||||
enumerations_007:
|
||||
name: Urgent
|
||||
id: 7
|
||||
opt: IPRI
|
||||
type: IssuePriority
|
||||
active: true
|
||||
enumerations_008:
|
||||
name: Immediate
|
||||
id: 8
|
||||
opt: IPRI
|
||||
type: IssuePriority
|
||||
active: true
|
||||
enumerations_009:
|
||||
name: Design
|
||||
id: 9
|
||||
opt: ACTI
|
||||
type: TimeEntryActivity
|
||||
position: 1
|
||||
active: true
|
||||
enumerations_010:
|
||||
name: Development
|
||||
id: 10
|
||||
opt: ACTI
|
||||
type: TimeEntryActivity
|
||||
position: 2
|
||||
is_default: true
|
||||
|
@ -66,27 +56,23 @@ enumerations_010:
|
|||
enumerations_011:
|
||||
name: QA
|
||||
id: 11
|
||||
opt: ACTI
|
||||
type: TimeEntryActivity
|
||||
position: 3
|
||||
active: true
|
||||
enumerations_012:
|
||||
name: Default Enumeration
|
||||
id: 12
|
||||
opt: ''
|
||||
type: Enumeration
|
||||
is_default: true
|
||||
active: true
|
||||
enumerations_013:
|
||||
name: Another Enumeration
|
||||
id: 13
|
||||
opt: ''
|
||||
type: Enumeration
|
||||
active: true
|
||||
enumerations_014:
|
||||
name: Inactive Activity
|
||||
id: 14
|
||||
opt: ACTI
|
||||
type: TimeEntryActivity
|
||||
position: 4
|
||||
active: false
|
||||
|
|
Loading…
Reference in New Issue