cyberfly
3/27/2020 - 4:33 AM

DB design (lesson learned)

1. When got status changed for example APPROVED to COMPLETED, create a column to store the value of status date

add_column :xray_retakes, :approved_at, :datetime, index: true
add_column :xray_retakes, :completed_at, :datetime, index: true

Having this column, you can calculate for example how many days passed since APPROVED but NOT YET COMPLETED