Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable triggers while migration runs #7001

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
begin;

alter table tracks disable trigger on_track;
alter table tracks disable trigger trg_tracks;

SELECT pg_cancel_backend(pid) FROM pg_stat_activity WHERE state = 'active' and pid <> pg_backend_pid();
lock table tracks in access exclusive mode;

UPDATE tracks
SET release_date = created_at
WHERE release_date IS NULL;

alter table tracks enable trigger on_track;
alter table tracks enable trigger trg_tracks;

commit;