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
This commit is contained in:
Jean-Philippe Lang 2008-02-04 18:01:38 +00:00
parent 4e244be21c
commit a3dda6dc4a
1 changed files with 2 additions and 10 deletions

View 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