From b0f3de5c3b75c6e69ff5df31eac9f12c6cce064e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 23 Jan 2008 22:19:24 +0000 Subject: [PATCH] Fixed: PostgreSQL issues_seq_id not updated when using Trac importer. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1099 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/migrate_from_trac.rake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake index 828027b87..63a719b35 100644 --- a/lib/tasks/migrate_from_trac.rake +++ b/lib/tasks/migrate_from_trac.rake @@ -372,6 +372,17 @@ namespace :redmine do migrated_custom_values += 1 end end + + # update issue id sequence if needed + begin + case ActiveRecord::Base.connection.adapter_name.downcase + when 'mysql' + # nothing to do + when 'postgresql' + sql = "SELECT setval('#{Issue.table_name}_id_seq', (SELECT MAX(id) FROM #{Issue.table_name}))" + ActiveRecord::Base.connection.execute(sql) + end + end puts # Wiki @@ -478,7 +489,7 @@ namespace :redmine do if !project # create the target project project = Project.new :name => identifier.humanize, - :description => identifier.humanize + :description => '' project.identifier = identifier puts "Unable to create a project with identifier '#{identifier}'!" unless project.save # enable issues and wiki for the created project -- 2.39.5