Skip to content

initial setup for a metadata field on the updates table, #67

Merged
ianmcorvidae merged 1 commit into
cyverse:mainfrom
ianmcorvidae:update-meta
Jun 23, 2025
Merged

initial setup for a metadata field on the updates table, #67
ianmcorvidae merged 1 commit into
cyverse:mainfrom
ianmcorvidae:update-meta

Conversation

@ianmcorvidae

Copy link
Copy Markdown
Collaborator

intended to be used for storing arbitrary info useful for debugging and auditing -- in particular, for keeping track of what analyses correspond to what updates, and what dates are being used for the calculations, for the sake of double-counting avoidance

…or storing arbitrary info useful for debugging and auditing
@ianmcorvidae ianmcorvidae requested a review from Copilot May 29, 2025 17:59

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

This PR adds a new metadata field to the updates table to facilitate debugging and auditing by linking analyses and calculation dates. Key changes include:

  • Adding a nullable metadata TEXT column to the updates table.
  • Updating the Update model to include a Metadata field.
  • Adding a Metadata field to the Usage struct and using it during update creation.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
migrations/000017_updates_metadata.up.sql Creates a metadata column in the updates table for debugging.
migrations/000017_updates_metadata.down.sql Removes the metadata column added in the up migration.
internal/model/update.go Adds a pointer Metadata field to the Update struct.
internal/controllers/usages.go Introduces a Metadata field in Usage and passes it to updates.

ResourceName string `json:"resource_name"`
UsageValue float64 `json:"usage_value"`
UpdateType string `json:"update_type"`
Metadata string `json:"metadata"`

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Minor question for someone who's worked more with this code is if this should be any other type or what. I guess this should mean that we insert blank strings rather than nulls, which is probably fine but maybe someone has a different thought there. Haven't worked to integrate with anything yet either, of course.

@ianmcorvidae

Copy link
Copy Markdown
Collaborator Author

I'm hoping this is correct enough, so I'm going to go ahead and merge it. Reviews definitely still welcome 😅

@ianmcorvidae ianmcorvidae merged commit b5130e1 into cyverse:main Jun 23, 2025
1 check 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.

2 participants