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'
|
has_many :documents, :foreign_key => 'category_id'
|
||||||
|
|
||||||
OptionName = :enumeration_doc_categories
|
OptionName = :enumeration_doc_categories
|
||||||
# Backwards compatiblity. Can be removed post-0.9
|
|
||||||
OptName = 'DCAT'
|
|
||||||
|
|
||||||
def option_name
|
def option_name
|
||||||
OptionName
|
OptionName
|
||||||
|
|
|
@ -29,36 +29,6 @@ class Enumeration < ActiveRecord::Base
|
||||||
validates_presence_of :name
|
validates_presence_of :name
|
||||||
validates_uniqueness_of :name, :scope => [:type, :project_id]
|
validates_uniqueness_of :name, :scope => [:type, :project_id]
|
||||||
validates_length_of :name, :maximum => 30
|
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 :shared, :conditions => { :project_id => nil }
|
||||||
named_scope :active, :conditions => { :active => true }
|
named_scope :active, :conditions => { :active => true }
|
||||||
|
@ -80,12 +50,6 @@ class Enumeration < ActiveRecord::Base
|
||||||
nil
|
nil
|
||||||
end
|
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
|
def before_save
|
||||||
if is_default? && is_default_changed?
|
if is_default? && is_default_changed?
|
||||||
Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
|
Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type})
|
||||||
|
|
|
@ -19,8 +19,6 @@ class IssuePriority < Enumeration
|
||||||
has_many :issues, :foreign_key => 'priority_id'
|
has_many :issues, :foreign_key => 'priority_id'
|
||||||
|
|
||||||
OptionName = :enumeration_issue_priorities
|
OptionName = :enumeration_issue_priorities
|
||||||
# Backwards compatiblity. Can be removed post-0.9
|
|
||||||
OptName = 'IPRI'
|
|
||||||
|
|
||||||
def option_name
|
def option_name
|
||||||
OptionName
|
OptionName
|
||||||
|
|
|
@ -19,8 +19,6 @@ class TimeEntryActivity < Enumeration
|
||||||
has_many :time_entries, :foreign_key => 'activity_id'
|
has_many :time_entries, :foreign_key => 'activity_id'
|
||||||
|
|
||||||
OptionName = :enumeration_activities
|
OptionName = :enumeration_activities
|
||||||
# Backwards compatiblity. Can be removed post-0.9
|
|
||||||
OptName = 'ACTI'
|
|
||||||
|
|
||||||
def option_name
|
def option_name
|
||||||
OptionName
|
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
|
# Enumerations
|
||||||
DocumentCategory.create!(:opt => "DCAT", :name => l(:default_doc_category_user), :position => 1)
|
DocumentCategory.create!(: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_tech), :position => 2)
|
||||||
|
|
||||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_low), :position => 1)
|
IssuePriority.create!(:name => l(:default_priority_low), :position => 1)
|
||||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_normal), :position => 2, :is_default => true)
|
IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true)
|
||||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_high), :position => 3)
|
IssuePriority.create!(:name => l(:default_priority_high), :position => 3)
|
||||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_urgent), :position => 4)
|
IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4)
|
||||||
IssuePriority.create!(:opt => "IPRI", :name => l(:default_priority_immediate), :position => 5)
|
IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5)
|
||||||
|
|
||||||
TimeEntryActivity.create!(:opt => "ACTI", :name => l(:default_activity_design), :position => 1)
|
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
|
||||||
TimeEntryActivity.create!(:opt => "ACTI", :name => l(:default_activity_development), :position => 2)
|
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,7 +40,7 @@ task :migrate_from_mantis => :environment do
|
||||||
90 => closed_status # closed
|
90 => closed_status # closed
|
||||||
}
|
}
|
||||||
|
|
||||||
priorities = Enumeration.priorities
|
priorities = IssuePriority.all
|
||||||
DEFAULT_PRIORITY = priorities[2]
|
DEFAULT_PRIORITY = priorities[2]
|
||||||
PRIORITY_MAPPING = {10 => priorities[1], # none
|
PRIORITY_MAPPING = {10 => priorities[1], # none
|
||||||
20 => priorities[1], # low
|
20 => priorities[1], # low
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace :redmine do
|
||||||
'closed' => closed_status
|
'closed' => closed_status
|
||||||
}
|
}
|
||||||
|
|
||||||
priorities = Enumeration.priorities
|
priorities = IssuePriority.all
|
||||||
DEFAULT_PRIORITY = priorities[0]
|
DEFAULT_PRIORITY = priorities[0]
|
||||||
PRIORITY_MAPPING = {'lowest' => priorities[0],
|
PRIORITY_MAPPING = {'lowest' => priorities[0],
|
||||||
'low' => priorities[0],
|
'low' => priorities[0],
|
||||||
|
|
|
@ -2,63 +2,53 @@
|
||||||
enumerations_001:
|
enumerations_001:
|
||||||
name: Uncategorized
|
name: Uncategorized
|
||||||
id: 1
|
id: 1
|
||||||
opt: DCAT
|
|
||||||
type: DocumentCategory
|
type: DocumentCategory
|
||||||
active: true
|
active: true
|
||||||
enumerations_002:
|
enumerations_002:
|
||||||
name: User documentation
|
name: User documentation
|
||||||
id: 2
|
id: 2
|
||||||
opt: DCAT
|
|
||||||
type: DocumentCategory
|
type: DocumentCategory
|
||||||
active: true
|
active: true
|
||||||
enumerations_003:
|
enumerations_003:
|
||||||
name: Technical documentation
|
name: Technical documentation
|
||||||
id: 3
|
id: 3
|
||||||
opt: DCAT
|
|
||||||
type: DocumentCategory
|
type: DocumentCategory
|
||||||
active: true
|
active: true
|
||||||
enumerations_004:
|
enumerations_004:
|
||||||
name: Low
|
name: Low
|
||||||
id: 4
|
id: 4
|
||||||
opt: IPRI
|
|
||||||
type: IssuePriority
|
type: IssuePriority
|
||||||
active: true
|
active: true
|
||||||
enumerations_005:
|
enumerations_005:
|
||||||
name: Normal
|
name: Normal
|
||||||
id: 5
|
id: 5
|
||||||
opt: IPRI
|
|
||||||
type: IssuePriority
|
type: IssuePriority
|
||||||
is_default: true
|
is_default: true
|
||||||
active: true
|
active: true
|
||||||
enumerations_006:
|
enumerations_006:
|
||||||
name: High
|
name: High
|
||||||
id: 6
|
id: 6
|
||||||
opt: IPRI
|
|
||||||
type: IssuePriority
|
type: IssuePriority
|
||||||
active: true
|
active: true
|
||||||
enumerations_007:
|
enumerations_007:
|
||||||
name: Urgent
|
name: Urgent
|
||||||
id: 7
|
id: 7
|
||||||
opt: IPRI
|
|
||||||
type: IssuePriority
|
type: IssuePriority
|
||||||
active: true
|
active: true
|
||||||
enumerations_008:
|
enumerations_008:
|
||||||
name: Immediate
|
name: Immediate
|
||||||
id: 8
|
id: 8
|
||||||
opt: IPRI
|
|
||||||
type: IssuePriority
|
type: IssuePriority
|
||||||
active: true
|
active: true
|
||||||
enumerations_009:
|
enumerations_009:
|
||||||
name: Design
|
name: Design
|
||||||
id: 9
|
id: 9
|
||||||
opt: ACTI
|
|
||||||
type: TimeEntryActivity
|
type: TimeEntryActivity
|
||||||
position: 1
|
position: 1
|
||||||
active: true
|
active: true
|
||||||
enumerations_010:
|
enumerations_010:
|
||||||
name: Development
|
name: Development
|
||||||
id: 10
|
id: 10
|
||||||
opt: ACTI
|
|
||||||
type: TimeEntryActivity
|
type: TimeEntryActivity
|
||||||
position: 2
|
position: 2
|
||||||
is_default: true
|
is_default: true
|
||||||
|
@ -66,27 +56,23 @@ enumerations_010:
|
||||||
enumerations_011:
|
enumerations_011:
|
||||||
name: QA
|
name: QA
|
||||||
id: 11
|
id: 11
|
||||||
opt: ACTI
|
|
||||||
type: TimeEntryActivity
|
type: TimeEntryActivity
|
||||||
position: 3
|
position: 3
|
||||||
active: true
|
active: true
|
||||||
enumerations_012:
|
enumerations_012:
|
||||||
name: Default Enumeration
|
name: Default Enumeration
|
||||||
id: 12
|
id: 12
|
||||||
opt: ''
|
|
||||||
type: Enumeration
|
type: Enumeration
|
||||||
is_default: true
|
is_default: true
|
||||||
active: true
|
active: true
|
||||||
enumerations_013:
|
enumerations_013:
|
||||||
name: Another Enumeration
|
name: Another Enumeration
|
||||||
id: 13
|
id: 13
|
||||||
opt: ''
|
|
||||||
type: Enumeration
|
type: Enumeration
|
||||||
active: true
|
active: true
|
||||||
enumerations_014:
|
enumerations_014:
|
||||||
name: Inactive Activity
|
name: Inactive Activity
|
||||||
id: 14
|
id: 14
|
||||||
opt: ACTI
|
|
||||||
type: TimeEntryActivity
|
type: TimeEntryActivity
|
||||||
position: 4
|
position: 4
|
||||||
active: false
|
active: false
|
||||||
|
|
Loading…
Reference in New Issue