Sha256: 8c3f0e7ad9eff3807b55dcd755a7a1e60c9b4fb23017de9bcbce65f378a09943
Contents?: true
Size: 636 Bytes
Versions: 10
Compression:
Stored size: 636 Bytes
Contents
class ConvertUserViewOptionsToProps < ActiveRecord::Migration def up add_column :users, :props, :jsonb, default: {} require "progressbar" users = User.all pbar = ProgressBar.new("users", users.count) users.find_each do |user| props = user.read_attribute(:view_options) || {} props["github.username"] = props.delete("github_username") if props.key?("github_username") props["slack.username"] = props.delete("slack_username") if props.key?("slack_username") user.update_column :props, props pbar.inc end pbar.finish end def down remove_column :users, :props end end
Version data entries
10 entries across 10 versions & 1 rubygems