-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Statuses can no longer have a NULL default done ratio
It is 0 by default. This is to ensure that the total work, total remaining work, and total % Complete are always consistent. Without it, we could have Work being set and Remaining work being unset, which is bad for the ancestors totals. See https://community.openproject.org/wp/40749 for the detailed specification.
- Loading branch information
Showing
3 changed files
with
23 additions
and
50 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
db/migrate/20240328154805_change_status_default_done_ratio_to_zero.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ChangeStatusDefaultDoneRatioToZero < ActiveRecord::Migration[7.1] | ||
def change | ||
change_column_default :statuses, :default_done_ratio, from: nil, to: 0 | ||
reversible do |dir| | ||
dir.up do | ||
execute "UPDATE statuses SET default_done_ratio = 0 WHERE default_done_ratio IS NULL" | ||
end | ||
end | ||
change_column_null :statuses, :default_done_ratio, false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters