Revision 864
Added by Jean-Philippe Lang over 17 years ago
trunk/db/migrate/019_add_issue_status_position.rb | ||
---|---|---|
1 | 1 |
class AddIssueStatusPosition < ActiveRecord::Migration |
2 | 2 |
def self.up |
3 |
add_column :issue_statuses, :position, :integer, :default => 1, :null => false
|
|
3 |
add_column :issue_statuses, :position, :integer, :default => 1 |
|
4 | 4 |
IssueStatus.find(:all).each_with_index {|status, i| status.update_attribute(:position, i+1)} |
5 | 5 |
end |
6 | 6 |
|
trunk/db/migrate/020_add_role_position.rb | ||
---|---|---|
1 | 1 |
class AddRolePosition < ActiveRecord::Migration |
2 | 2 |
def self.up |
3 |
add_column :roles, :position, :integer, :default => 1, :null => false
|
|
3 |
add_column :roles, :position, :integer, :default => 1 |
|
4 | 4 |
Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)} |
5 | 5 |
end |
6 | 6 |
|
trunk/db/migrate/021_add_tracker_position.rb | ||
---|---|---|
1 | 1 |
class AddTrackerPosition < ActiveRecord::Migration |
2 | 2 |
def self.up |
3 |
add_column :trackers, :position, :integer, :default => 1, :null => false
|
|
3 |
add_column :trackers, :position, :integer, :default => 1 |
|
4 | 4 |
Tracker.find(:all).each_with_index {|tracker, i| tracker.update_attribute(:position, i+1)} |
5 | 5 |
end |
6 | 6 |
|
trunk/db/migrate/045_create_boards.rb | ||
---|---|---|
4 | 4 |
t.column :project_id, :integer, :null => false |
5 | 5 |
t.column :name, :string, :default => "", :null => false |
6 | 6 |
t.column :description, :string |
7 |
t.column :position, :integer, :default => 1, :null => false
|
|
7 |
t.column :position, :integer, :default => 1 |
|
8 | 8 |
t.column :topics_count, :integer, :default => 0, :null => false |
9 | 9 |
t.column :messages_count, :integer, :default => 0, :null => false |
10 | 10 |
t.column :last_message_id, :integer |
trunk/db/migrate/072_add_enumerations_position.rb | ||
---|---|---|
1 | 1 |
class AddEnumerationsPosition < ActiveRecord::Migration |
2 | 2 |
def self.up |
3 |
add_column(:enumerations, :position, :integer, :default => 1, :null => false) unless Enumeration.column_names.include?('position')
|
|
3 |
add_column(:enumerations, :position, :integer, :default => 1) unless Enumeration.column_names.include?('position') |
|
4 | 4 |
Enumeration.find(:all).group_by(&:opt).each_value do |enums| |
5 | 5 |
enums.each_with_index do |enum, i| |
6 | 6 |
# do not call model callbacks |
Also available in: Unified diff
Removed 'not null' constraint on position fields.
Previous migrations updated for new sqlite databases.