Commit 71032893 authored by jplang's avatar jplang
Browse files

Removed 'not null' constraint on position fields.

Previous migrations updated for new sqlite databases.

git-svn-id: https://svn.redmine.org/redmine/trunk@864 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent abbaeb3c
class AddIssueStatusPosition < ActiveRecord::Migration
def self.up
add_column :issue_statuses, :position, :integer, :default => 1, :null => false
add_column :issue_statuses, :position, :integer, :default => 1
IssueStatus.find(:all).each_with_index {|status, i| status.update_attribute(:position, i+1)}
end
......
class AddRolePosition < ActiveRecord::Migration
def self.up
add_column :roles, :position, :integer, :default => 1, :null => false
add_column :roles, :position, :integer, :default => 1
Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)}
end
......
class AddTrackerPosition < ActiveRecord::Migration
def self.up
add_column :trackers, :position, :integer, :default => 1, :null => false
add_column :trackers, :position, :integer, :default => 1
Tracker.find(:all).each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
end
......
......@@ -4,7 +4,7 @@ class CreateBoards < ActiveRecord::Migration
t.column :project_id, :integer, :null => false
t.column :name, :string, :default => "", :null => false
t.column :description, :string
t.column :position, :integer, :default => 1, :null => false
t.column :position, :integer, :default => 1
t.column :topics_count, :integer, :default => 0, :null => false
t.column :messages_count, :integer, :default => 0, :null => false
t.column :last_message_id, :integer
......
class AddEnumerationsPosition < ActiveRecord::Migration
def self.up
add_column(:enumerations, :position, :integer, :default => 1, :null => false) unless Enumeration.column_names.include?('position')
add_column(:enumerations, :position, :integer, :default => 1) unless Enumeration.column_names.include?('position')
Enumeration.find(:all).group_by(&:opt).each_value do |enums|
enums.each_with_index do |enum, i|
# do not call model callbacks
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment