Skip to content

Instantly share code, notes, and snippets.

@tychobrailleur
Created March 5, 2012 09:56
Show Gist options
  • Save tychobrailleur/1977689 to your computer and use it in GitHub Desktop.
Save tychobrailleur/1977689 to your computer and use it in GitHub Desktop.
Remove auto_increment in sql script; good ruby example on how to process a file
file_names = ['script.sql']
file_names.each do |file_name|
text = File.read(file_name)
File.open(file_name, 'wb') do
|file|
file.write(text.gsub(/\s*AUTO_INCREMENT\s*(\=\s*[0-9]+)?/, ""))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment