canvas-lms/db/migrate/20150518201834_encrypt_goog...

14 lines
436 B
Ruby

class EncryptGoogleDriveSettings < ActiveRecord::Migration
tag :predeploy
def up
PluginSetting.where(name: 'google_drive').each do |ps|
# do a dance so that we don't delete the unencrypted copy yet
ps.encrypt_settings
ps.initialize_plugin_setting
ps.settings[:client_secret] = ps.settings[:client_secret_dec]
PluginSetting.where(id: ps).update_all(settings: ps.settings.to_yaml)
end
end
end