]> source.dussan.org Git - redmine.git/commitdiff
Use Postgresql's reset_pk_sequence in Trac importer to reset issue id sequence (...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 4 Feb 2008 18:01:38 +0000 (18:01 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 4 Feb 2008 18:01:38 +0000 (18:01 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1119 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/tasks/migrate_from_trac.rake

index 63a719b355560b58b36a5b829b6c5f04c80b8dac..2eca13dc38bdadb054e09a5648b9f41dac3a0339 100644 (file)
@@ -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