2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

DEV: remove all calls to SqlBuilder use DB.build instead

This is part of the migration to mini_sql, SqlBuilder.new is being
deprecated and replaced with DB.build
This commit is contained in:
Sam 2018-06-20 17:48:02 +10:00
parent 76707eec1b
commit cb824a6b33
25 changed files with 338 additions and 372 deletions

View file

@ -1,7 +1,7 @@
class FixTosName < ActiveRecord::Migration[4.2]
def up
I18n.overrides_disabled do
execute ActiveRecord::Base.sql_fragment('UPDATE user_fields SET name = ? WHERE name = ?', I18n.t('terms_of_service.title'), I18n.t("terms_of_service.signup_form_message"))
execute DB.sql_fragment('UPDATE user_fields SET name = ? WHERE name = ?', I18n.t('terms_of_service.title'), I18n.t("terms_of_service.signup_form_message"))
end
end

View file

@ -40,7 +40,7 @@ class AddThemes < ActiveRecord::Migration[4.2]
RETURNING *
SQL
sql = ActiveRecord::Base.sql_fragment(sql, now: Time.zone.now, key: theme_key)
sql = DB.sql_fragment(sql, now: Time.zone.now, key: theme_key)
theme_id = execute(sql).to_a[0]["id"].to_i
end
@ -62,7 +62,7 @@ SQL
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
VALUES('default_theme_key', 1, :key, :now, :now)
SQL
sql = ActiveRecord::Base.sql_fragment(sql, now: Time.zone.now, key: theme_key)
sql = DB.sql_fragment(sql, now: Time.zone.now, key: theme_key)
execute(sql)
end