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:
Guo Xiang Tan
2018-08-23 12:51:22 +08:00
parent db05ab1868
commit 212ee15804
3 changed files with 24 additions and 25 deletions

View File

@@ -152,19 +152,23 @@ RSpec.describe Migration::ColumnDropper do
)
expect(dropped_proc_called).to eq(true)
end
it 'should prevent updates to the readonly column' do
expect do
begin
DB.exec <<~SQL
UPDATE #{table_name}
SET email = 'testing@email.com'
WHERE topic_id = 1;
SQL
end.to raise_error(
PG::RaiseException,
/Discourse: email in #{table_name} is readonly/
)
rescue PG::RaiseException => e
[
"Discourse: email in #{table_name} is readonly",
'discourse_functions.raise_table_with_readonly_column_email_readonly()'
].each do |message|
expect(e.message).to include(message)
end
end
end
it 'should allow updates to the other columns' do