mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Create BaseDropper functions in a different schema.
https://meta.discourse.org/t/error-when-restore-db-backup/93145/25?u=tgxworld
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
module Migration
|
||||
class BaseDropper
|
||||
FUNCTION_SCHEMA_NAME = "discourse_functions".freeze
|
||||
|
||||
def initialize(after_migration, delay, on_drop, after_drop)
|
||||
@after_migration = after_migration
|
||||
@on_drop = on_drop
|
||||
@@ -46,6 +48,10 @@ module Migration
|
||||
end
|
||||
|
||||
def self.create_readonly_function(table_name, column_name = nil)
|
||||
DB.exec <<~SQL
|
||||
CREATE SCHEMA IF NOT EXISTS #{FUNCTION_SCHEMA_NAME};
|
||||
SQL
|
||||
|
||||
message = column_name ?
|
||||
"Discourse: #{column_name} in #{table_name} is readonly" :
|
||||
"Discourse: #{table_name} is read only"
|
||||
@@ -69,7 +75,14 @@ module Migration
|
||||
end
|
||||
|
||||
def self.readonly_function_name(table_name, column_name = nil)
|
||||
["raise", table_name, column_name, "readonly()"].compact.join("_")
|
||||
function_name = [
|
||||
"raise",
|
||||
table_name,
|
||||
column_name,
|
||||
"readonly()"
|
||||
].compact.join("_")
|
||||
|
||||
"#{FUNCTION_SCHEMA_NAME}.#{function_name}"
|
||||
end
|
||||
|
||||
def self.readonly_trigger_name(table_name, column_name = nil)
|
||||
|
||||
Reference in New Issue
Block a user