From 8f7f305f7cf89c6086411ad846223bd2583f8369 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 22 Oct 2007 21:07:13 +0000 Subject: [PATCH] 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 --- db/migrate/019_add_issue_status_position.rb | 2 +- db/migrate/020_add_role_position.rb | 2 +- db/migrate/021_add_tracker_position.rb | 2 +- db/migrate/045_create_boards.rb | 2 +- db/migrate/072_add_enumerations_position.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db/migrate/019_add_issue_status_position.rb b/db/migrate/019_add_issue_status_position.rb index 1c65e52e..ed24d27c 100644 --- a/db/migrate/019_add_issue_status_position.rb +++ b/db/migrate/019_add_issue_status_position.rb @@ -1,6 +1,6 @@ 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 diff --git a/db/migrate/020_add_role_position.rb b/db/migrate/020_add_role_position.rb index 3afa8819..e220bd9f 100644 --- a/db/migrate/020_add_role_position.rb +++ b/db/migrate/020_add_role_position.rb @@ -1,6 +1,6 @@ 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 diff --git a/db/migrate/021_add_tracker_position.rb b/db/migrate/021_add_tracker_position.rb index 30a5d771..ef977562 100644 --- a/db/migrate/021_add_tracker_position.rb +++ b/db/migrate/021_add_tracker_position.rb @@ -1,6 +1,6 @@ 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 diff --git a/db/migrate/045_create_boards.rb b/db/migrate/045_create_boards.rb index b8647c81..17f2bbbe 100644 --- a/db/migrate/045_create_boards.rb +++ b/db/migrate/045_create_boards.rb @@ -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 diff --git a/db/migrate/072_add_enumerations_position.rb b/db/migrate/072_add_enumerations_position.rb index 6f2a9321..e0beaf39 100644 --- a/db/migrate/072_add_enumerations_position.rb +++ b/db/migrate/072_add_enumerations_position.rb @@ -1,6 +1,6 @@ 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