Skip to content

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

ensure timestamp values for queries

ulferts488b7520a857
diff --git a/db/migrate/20211209092519_query_views.rb b/db/migrate/20211209092519_query_views.rb
index abcc701f2a9..1b143a7bbc7 100644
--- a/db/migrate/20211209092519_query_views.rb
+++ b/db/migrate/20211209092519_query_views.rb
@@ -5,6 +5,25 @@ class QueryViews < ActiveRecord::Migration[6.1]
:boolean,
default: false
+ # Some older queries seem to lack values for created_at and updated_at. Taking NOW which is better than NULL.
+ execute <<~SQL.squish
+ UPDATE
+ queries
+ SET
+ created_at = NOW()
+ WHERE
+ created_at IS NULL
+ SQL
+
+ execute <<~SQL.squish
+ UPDATE
+ queries
+ SET
+ updated_at = NOW()
+ WHERE
+ updated_at IS NULL
+ SQL
+
execute <<~SQL.squish
INSERT INTO
views (