summaryrefslogtreecommitdiffstats
path: root/lib/tasks/migrate_from_trac.rake
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-02-04 18:01:38 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-02-04 18:01:38 +0000
commita3dda6dc4a3dd898357b5aaab6acffdb03f4da5e (patch)
tree5b40ca2a11681aed2ea96b0b3eac2f0c17a245cb /lib/tasks/migrate_from_trac.rake
parent4e244be21cc1c9fbd885081a6d02527b67a5034d (diff)
downloadredmine-a3dda6dc4a3dd898357b5aaab6acffdb03f4da5e.tar.gz
redmine-a3dda6dc4a3dd898357b5aaab6acffdb03f4da5e.zip
Use Postgresql's reset_pk_sequence in Trac importer to reset issue id sequence (#595).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1119 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/tasks/migrate_from_trac.rake')
-rw-r--r--lib/tasks/migrate_from_trac.rake12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake
index 63a719b35..2eca13dc3 100644
--- a/lib/tasks/migrate_from_trac.rake
+++ b/lib/tasks/migrate_from_trac.rake
@@ -373,16 +373,8 @@ namespace :redmine do
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
+ # update issue id sequence if needed (postgresql)
+ Issue.connection.reset_pk_sequence!(Issue.table_name) if Issue.connection.respond_to?('reset_pk_sequence!')
puts
# Wiki