OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
add columns to allow time tracking
Klaus Zanders9f5890fe16f0
diff --git a/db/migrate/20241120103858_add_start_end_times_to_time_entries.rb b/db/migrate/20241120103858_add_start_end_times_to_time_entries.rbnew file mode 100644index 00000000000..46f41356c1a--- /dev/null+++ b/db/migrate/20241120103858_add_start_end_times_to_time_entries.rb@@ -0,0 +1,36 @@+class AddStartEndTimesToTimeEntries < ActiveRecord::Migration[7.1]+ def change+ # TODO: Figure out if we need to use any timezone conversion in the generated columns++ # order of changes matter, so we cannot use bulk here+ change_table :time_entries do |t| # rubocop:disable Lint/RedundantCopDisableDirective,Rails/BulkChangeTable+ t.integer :start_time, null: true+ t.integer :end_time, null: true++ t.virtual :start_timestamp,+ type: :datetime,+ as: "CASE WHEN start_time IS NOT NULL THEN spent_on::timestamp + INTERVAL '1 minute' * start_time ELSE NULL END",+ stored: true++ t.virtual :end_timestamp,+ type: :datetime,+ as: "CASE WHEN end_time IS NOT NULL THEN spent_on::timestamp + INTERVAL '1 minute' * end_time ELSE NULL END",+ stored: true+ end++ change_table :time_entry_journals do |t| # rubocop:disable Lint/RedundantCopDisableDirective,Rails/BulkChangeTable+ t.integer :start_time, null: true+ t.integer :end_time, null: true++ t.virtual :start_timestamp,+ type: :datetime,+ as: "CASE WHEN start_time IS NOT NULL THEN spent_on::timestamp + INTERVAL '1 minute' * start_time ELSE NULL END",+ stored: true++ t.virtual :end_timestamp,+ type: :datetime,+ as: "CASE WHEN end_time IS NOT NULL THEN spent_on::timestamp + INTERVAL '1 minute' * end_time ELSE NULL END",+ stored: true+ end+ end+end