Adds support for multiple repositories per project (#779).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8650 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
d996cc0584
commit
1bd5e58c84
32 files changed
+384
-78
No files matched your search
@@ -0,0 +1,9 @@
|
||||
class AddRepositoriesIdentifier < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :repositories, :identifier, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :repositories, :identifier
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddRepositoriesIsDefault < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :repositories, :is_default, :boolean, :default => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :repositories, :is_default
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class SetDefaultRepositories < ActiveRecord::Migration
|
||||
def self.up
|
||||
Repository.update_all(["is_default = ?", false])
|
||||
# Sets the last repository as default in case multiple repositories exist for the same project
|
||||
Repository.connection.select_values("SELECT r.id FROM #{Repository.table_name} r" +
|
||||
" WHERE r.id = (SELECT max(r1.id) FROM #{Repository.table_name} r1 WHERE r1.project_id = r.project_id)").each do |i|
|
||||
Repository.update_all(["is_default = ?", true], ["id = ?", i])
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
Repository.update_all(["is_default = ?", false])
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user