mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 03:52:41 +08:00
FIX: ChangeFullNameRequiredSetting could fail if setting was already in DB (#30605)
Followup 3187606d34
Fix full_name_requirement INSERT by adding ON CONFLICT DO NOTHING,
on sites that already have this setting this migration will fail.
This commit is contained in:
parent
51a444ab53
commit
19105bfd32
|
@ -20,11 +20,10 @@ class ChangeFullNameRequiredSetting < ActiveRecord::Migration[7.2]
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
DB.exec(<<~SQL, value: new_setting) if new_setting
|
DB.exec(<<~SQL, value: new_setting) if new_setting
|
||||||
INSERT INTO site_settings
|
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||||
(name, data_type, value, created_at, updated_at)
|
VALUES ('full_name_requirement', 7, :value, NOW(), NOW())
|
||||||
VALUES
|
ON CONFLICT (name) DO NOTHING
|
||||||
('full_name_requirement', 7, :value, NOW(), NOW())
|
SQL
|
||||||
SQL
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
|
Loading…
Reference in New Issue
Block a user