Skip to content

Instantly share code, notes, and snippets.

@PJZ9n
Created March 29, 2021 00:35
Show Gist options
  • Save PJZ9n/0a446b04f8812ca0d295b47755a1b751 to your computer and use it in GitHub Desktop.
Save PJZ9n/0a446b04f8812ca0d295b47755a1b751 to your computer and use it in GitHub Desktop.
サーバーID一覧データから当てはまらないものはサスペンドする
require "csv"
sql = 'UPDATE servers SET status="suspended" WHERE status IS NULL'
CSV.foreach("test.csv") do |row|
sql += ' AND NOT uuidShort="' + row[0] + '"'
end
puts sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment