Skip to content

Commit

Permalink
Store most recent evaluation time in dedicated column (#3661)
Browse files Browse the repository at this point in the history
This will make it easier to sort the rows by date/time.

Relates to: #3556
  • Loading branch information
dmjb authored Jun 19, 2024
1 parent 95a340b commit 3292de3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
15 changes: 15 additions & 0 deletions database/migrations/000070_evaluation_history_most_recent.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Copyright 2024 Stacklok, Inc
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

ALTER TABLE evaluation_statuses DROP COLUMN most_recent_evaluation;
17 changes: 17 additions & 0 deletions database/migrations/000070_evaluation_history_most_recent.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Copyright 2024 Stacklok, Inc
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

-- Store the most recent timestamp in a dedicated field to simplify sorting the rows.

ALTER TABLE evaluation_statuses ADD COLUMN most_recent_evaluation TIMESTAMP NOT NULL DEFAULT NOW();
11 changes: 6 additions & 5 deletions internal/db/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3292de3

Please sign in to comment.