Reset the default values of work package and work package journal duration

pull/10829/head
Dombi Attila 2 years ago
parent 7c02816ff8
commit 64cfcaaefb
  1. 22
      db/migrate/20220620132922_change_duration_default_value.rb

@ -0,0 +1,22 @@
class ChangeDurationDefaultValue < ActiveRecord::Migration[7.0]
def up
set_duration(:work_packages)
set_duration(:work_package_journals)
end
private
def set_duration(table)
execute <<~SQL.squish
UPDATE
#{table}
SET
duration = CASE
WHEN start_date IS NULL OR due_date IS NULL
THEN NULL
ELSE
due_date - start_date + 1
END
SQL
end
end
Loading…
Cancel
Save