Removed 'not null' constraint on position fields.

Previous migrations updated for new sqlite databases.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@864 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-10-22 21:07:13 +00:00
parent 33003e5b2d
commit 8f7f305f7c
5 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
class AddIssueStatusPosition < ActiveRecord::Migration class AddIssueStatusPosition < ActiveRecord::Migration
def self.up 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)} IssueStatus.find(:all).each_with_index {|status, i| status.update_attribute(:position, i+1)}
end end

View File

@ -1,6 +1,6 @@
class AddRolePosition < ActiveRecord::Migration class AddRolePosition < ActiveRecord::Migration
def self.up 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)} Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)}
end end

View File

@ -1,6 +1,6 @@
class AddTrackerPosition < ActiveRecord::Migration class AddTrackerPosition < ActiveRecord::Migration
def self.up 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)} Tracker.find(:all).each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)}
end end

View File

@ -4,7 +4,7 @@ class CreateBoards < ActiveRecord::Migration
t.column :project_id, :integer, :null => false t.column :project_id, :integer, :null => false
t.column :name, :string, :default => "", :null => false t.column :name, :string, :default => "", :null => false
t.column :description, :string 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 :topics_count, :integer, :default => 0, :null => false
t.column :messages_count, :integer, :default => 0, :null => false t.column :messages_count, :integer, :default => 0, :null => false
t.column :last_message_id, :integer t.column :last_message_id, :integer

View File

@ -1,6 +1,6 @@
class AddEnumerationsPosition < ActiveRecord::Migration class AddEnumerationsPosition < ActiveRecord::Migration
def self.up 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| Enumeration.find(:all).group_by(&:opt).each_value do |enums|
enums.each_with_index do |enum, i| enums.each_with_index do |enum, i|
# do not call model callbacks # do not call model callbacks