Skip to content
Snippets Groups Projects
Commit 892e4c0d authored by Stan Hu's avatar Stan Hu
Browse files

Merge branch 'fix-migration' into 'master'

Delete rename trigger before creating to prevent error

See merge request gitlab-org/gitlab-ce!32147
parents 523c619f 599cc499
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -746,6 +746,11 @@ module Gitlab
VOLATILE
EOF
 
execute <<-EOF.strip_heredoc
DROP TRIGGER IF EXISTS #{trigger}
ON #{table}
EOF
execute <<-EOF.strip_heredoc
CREATE TRIGGER #{trigger}
BEFORE INSERT OR UPDATE
Loading
Loading
Loading
Loading
@@ -618,11 +618,19 @@ describe Gitlab::Database::MigrationHelpers do
expect(model).to receive(:execute)
.with(/CREATE OR REPLACE FUNCTION foo()/m)
 
expect(model).to receive(:execute)
.with(/DROP TRIGGER IF EXISTS foo/m)
expect(model).to receive(:execute)
.with(/CREATE TRIGGER foo/m)
 
model.install_rename_triggers_for_postgresql('foo', :users, :old, :new)
end
it 'does not fail if trigger already exists' do
model.install_rename_triggers_for_postgresql('foo', :users, :old, :new)
model.install_rename_triggers_for_postgresql('foo', :users, :old, :new)
end
end
 
describe '#remove_rename_triggers_for_postgresql' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment