Trac importer: support database schema for Trac migration (#757 by John Goerzen).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1195 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-03-05 12:54:20 +00:00
parent a70737ad59
commit fbcdfee622
1 changed files with 10 additions and 3 deletions

View File

@ -513,7 +513,11 @@ namespace :redmine do
@@trac_db_password = password @@trac_db_password = password
end end
mattr_reader :trac_directory, :trac_adapter, :trac_db_host, :trac_db_port, :trac_db_name, :trac_db_username, :trac_db_password def self.set_trac_db_schema(schema)
@@trac_db_schema = schema
end
mattr_reader :trac_directory, :trac_adapter, :trac_db_host, :trac_db_port, :trac_db_name, :trac_db_schema, :trac_db_username, :trac_db_password
def self.trac_db_path; "#{trac_directory}/db/trac.db" end def self.trac_db_path; "#{trac_directory}/db/trac.db" end
def self.trac_attachments_directory; "#{trac_directory}/attachments" end def self.trac_attachments_directory; "#{trac_directory}/attachments" end
@ -544,7 +548,9 @@ namespace :redmine do
:host => trac_db_host, :host => trac_db_host,
:port => trac_db_port, :port => trac_db_port,
:username => trac_db_username, :username => trac_db_username,
:password => trac_db_password} :password => trac_db_password,
:schema_search_path => trac_db_schema
}
end end
end end
@ -580,7 +586,7 @@ namespace :redmine do
end end
end end
DEFAULT_PORTS = {'mysql' => 3306, 'postgresl' => 5432} DEFAULT_PORTS = {'mysql' => 3306, 'postgresql' => 5432}
prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory.strip} prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory.strip}
prompt('Trac database adapter (sqlite, sqlite3, mysql, postgresql)', :default => 'sqlite') {|adapter| TracMigrate.set_trac_adapter adapter} prompt('Trac database adapter (sqlite, sqlite3, mysql, postgresql)', :default => 'sqlite') {|adapter| TracMigrate.set_trac_adapter adapter}
@ -588,6 +594,7 @@ namespace :redmine do
prompt('Trac database host', :default => 'localhost') {|host| TracMigrate.set_trac_db_host host} prompt('Trac database host', :default => 'localhost') {|host| TracMigrate.set_trac_db_host host}
prompt('Trac database port', :default => DEFAULT_PORTS[TracMigrate.trac_adapter]) {|port| TracMigrate.set_trac_db_port port} prompt('Trac database port', :default => DEFAULT_PORTS[TracMigrate.trac_adapter]) {|port| TracMigrate.set_trac_db_port port}
prompt('Trac database name') {|name| TracMigrate.set_trac_db_name name} prompt('Trac database name') {|name| TracMigrate.set_trac_db_name name}
prompt('Trac database schema', :default => 'public') {|schema| TracMigrate.set_trac_db_schema schema}
prompt('Trac database username') {|username| TracMigrate.set_trac_db_username username} prompt('Trac database username') {|username| TracMigrate.set_trac_db_username username}
prompt('Trac database password') {|password| TracMigrate.set_trac_db_password password} prompt('Trac database password') {|password| TracMigrate.set_trac_db_password password}
end end