Skip to content

A platform for community discussion. Free, open, simple.

Fix incorrect data type for `SiteSetting.google_oauth2_prompt`.

Guo Xiang Tan4ac5fc8cd371
diff --git a/db/migrate/20180223041147_fix_google_oauth2_prompt_data_type.rb b/db/migrate/20180223041147_fix_google_oauth2_prompt_data_type.rb
new file mode 100644
index 00000000000..1317ec46c4c
--- /dev/null
+++ b/db/migrate/20180223041147_fix_google_oauth2_prompt_data_type.rb
@@ -0,0 +1,16 @@
+class FixGoogleOauth2PromptDataType < ActiveRecord::Migration[5.1]
+ def up
+ sql = <<~SQL
+ UPDATE site_settings
+ SET data_type=#{SiteSettings::TypeSupervisor.types[:list]}
+ WHERE data_type=#{SiteSettings::TypeSupervisor.types[:enum]}
+ AND name='google_oauth2_prompt'
+ SQL
+
+ execute sql
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end