From 77845ec114a6beaab37d4bf02436cbb3e0b3ca1c Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 22 May 2014 11:41:31 -0400 Subject: [PATCH] FIX: don't enable new google auth setting on an existing site --- .../20140521220115_google_openid_default_has_changed.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/migrate/20140521220115_google_openid_default_has_changed.rb b/db/migrate/20140521220115_google_openid_default_has_changed.rb index 4d154073d..a9964bafd 100644 --- a/db/migrate/20140521220115_google_openid_default_has_changed.rb +++ b/db/migrate/20140521220115_google_openid_default_has_changed.rb @@ -8,6 +8,12 @@ class GoogleOpenidDefaultHasChanged < ActiveRecord::Migration # The old default was true, so add a row to keep it that way. execute "INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('enable_google_logins', 5, 't', now(), now())" end + + # Don't enable the new Google setting on an existing site. + result = User.exec_sql("SELECT count(*) FROM site_settings WHERE name = 'enable_google_oauth2_logins'") + if result[0]['count'].to_i == 0 + execute "INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('enable_google_oauth2_logins', 5, 'f', now(), now())" + end end end