mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Properly associate user_profiles background urls via upload id.
`Upload#url` is more likely and can change from time to time. When it does changes, we don't want to have to look through multiple tables to ensure that the URLs are all up to date. Instead, we simply associate uploads properly to `UserProfile` so that it does not have to replicate the URLs in the table.
This commit is contained in:
committed by
Guo Xiang Tan
parent
c9f6beba05
commit
24347ace10
@@ -20,17 +20,19 @@ module Migration
|
||||
|
||||
columns.each do |column|
|
||||
column = column.to_s
|
||||
|
||||
DB.exec <<~SQL
|
||||
DROP FUNCTION IF EXISTS #{BaseDropper.readonly_function_name(table, column)} CASCADE;
|
||||
-- Backward compatibility for old functions created in the public
|
||||
-- schema
|
||||
DROP FUNCTION IF EXISTS #{BaseDropper.old_readonly_function_name(table, column)} CASCADE;
|
||||
SQL
|
||||
|
||||
self.drop_readonly(table, column)
|
||||
# safe cause it is protected on method entry, can not be passed in params
|
||||
DB.exec("ALTER TABLE #{table} DROP COLUMN IF EXISTS #{column}")
|
||||
end
|
||||
end
|
||||
|
||||
def self.drop_readonly(table, column)
|
||||
DB.exec <<~SQL
|
||||
DROP FUNCTION IF EXISTS #{BaseDropper.readonly_function_name(table, column)} CASCADE;
|
||||
-- Backward compatibility for old functions created in the public
|
||||
-- schema
|
||||
DROP FUNCTION IF EXISTS #{BaseDropper.old_readonly_function_name(table, column)} CASCADE;
|
||||
SQL
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user