FIX: Create readonly functions during backup

Temporarily recreate already dropped functions in the discourse_functions schema in order to allow restoring of backups which still reference dropped functions.
This commit is contained in:
Gerhard Schlager
2019-08-08 16:06:27 +02:00
parent 8aa5df69f0
commit 7cb51d0e40
11 changed files with 164 additions and 43 deletions

View File

@ -28,13 +28,11 @@ module Migration
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
def self.drop_readonly(table_name, column_name)
BaseDropper.drop_readonly_function(table_name, column_name)
# Backward compatibility for old functions created in the public schema
DB.exec("DROP FUNCTION IF EXISTS #{BaseDropper.old_readonly_function_name(table_name, column_name)} CASCADE")
end
end
end