Skip to content

Add a migration to add a 'usage_last_update' column to the jobs table#30

Merged
ianmcorvidae merged 1 commit into
cyverse-de:mainfrom
ianmcorvidae:usage-last-update
Jun 2, 2025
Merged

Add a migration to add a 'usage_last_update' column to the jobs table#30
ianmcorvidae merged 1 commit into
cyverse-de:mainfrom
ianmcorvidae:usage-last-update

Conversation

@ianmcorvidae

Copy link
Copy Markdown
Member

(to be used for tracking when the most recent update was sent to QMS, in avoidance of double-counting)

This is in advance of resource-usage-api work integrating both this and the metadata field being added to QMS in cyverse/qms#67

…, to be used for tracking when the most recent update was sent to QMS, in avoidance of double-counting
@ianmcorvidae ianmcorvidae requested review from Copilot and slr71 June 2, 2025 19:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a timestamp column to track the last usage update for jobs in preparation for the resource-usage-api integration.

  • Introduces usage_last_update in the jobs table.
  • Provides a rollback to drop the column if needed.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
migrations/000043_job_usage_last_update.up.sql Adds usage_last_update column (nullable timestamp)
migrations/000043_job_usage_last_update.down.sql Drops usage_last_update column using DROP IF EXISTS … CASCADE
Comments suppressed due to low confidence (1)

migrations/000043_job_usage_last_update.down.sql:6

  • [nitpick] Using CASCADE on DROP COLUMN may inadvertently remove dependent objects; consider removing CASCADE if there are no dependencies that need to be cascaded.
    DROP IF EXISTS usage_last_update CASCADE;

Comment thread migrations/000043_job_usage_last_update.up.sql

@slr71 slr71 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how it managed to escape my attention before now, but it hadn't occurred to me that DROP and ADD were equivalent to DROP COLUMN and ADD COLUMN in ALTER TABLE statements. 😆 Looks good to me! 👍 :shipit:

@ianmcorvidae

Copy link
Copy Markdown
Member Author

Thanks for the review! And yeah, I admittedly mostly copied this from another migration -- I don't think I'd know that either to be honest.

@ianmcorvidae ianmcorvidae merged commit 25ed227 into cyverse-de:main Jun 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants