Skip to content

Instantly share code, notes, and snippets.

Created February 1, 2017 17:15
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/23e3c0d41e2beac018c4099d45ec88f5 to your computer and use it in GitHub Desktop.
Save anonymous/23e3c0d41e2beac018c4099d45ec88f5 to your computer and use it in GitHub Desktop.
File.open('./sequences.txt', 'r') do |handle|
handle.each_line do |line|
sequence = line.strip
current = `sudo gitlab-psql -c "SELECT nextval('#{sequence}')" -A -t gitlabhq_production`.strip
if current =~ /^\d+$/
puts `sudo gitlab-psql -c "SELECT setval('#{sequence}', #{current} + 100000);" gitlabhq_production`.strip
else
puts "#{sequence} failed: #{current}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment