Skip to content

Commit

Permalink
Add #pausable? helper to background migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Jan 3, 2025
1 parent 0ed9e6e commit 98cf7eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
This is similar to background schema migrations scheduler's behavior.
Running multiple migrations at a time can cause unneeded database load and other bad effects.

- Add `#can_be_cancelled?` and `#can_be_paused?` helpers to background migrations
- Add `#pausable?`, `#can_be_cancelled?` and `#can_be_paused?` helpers to background migrations

## 0.21.0 (2024-12-09)

Expand Down
4 changes: 4 additions & 0 deletions lib/online_migrations/background_migrations/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def cancelled!
end
alias cancel cancelled!

def pausable?
true
end

def can_be_paused?
enqueued? || running?
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def cancelled!
end
alias cancel cancelled!

def pausable?
false
end

def can_be_paused?
false
end
Expand Down

0 comments on commit 98cf7eb

Please sign in to comment.