Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: store, retrieve asset.url #209

Merged
merged 1 commit into from
Feb 22, 2023
Merged

fix: store, retrieve asset.url #209

merged 1 commit into from
Feb 22, 2023

Conversation

sudo-suhas
Copy link
Contributor

  • Add column to assets table for URL.
  • Store the asset's URL field in DB as part of insert/upsert.
  • Retrieve the asset's URL field from DB for fetch APIs.
  • Refactor UPDATE statement to use squirrel for easier maintenance.

- Add column to assets table for URL.
- Store the asset's URL field in DB as part of insert/upsert.
- Retrieve the asset's URL field from DB for fetch APIs.
- Refactor UPDATE statement to use squirrel for easier maintenance.
@sudo-suhas sudo-suhas requested a review from haveiss February 21, 2023 12:08
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4232473912

  • 24 of 26 (92.31%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 86.107%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/store/postgres/asset_repository.go 17 19 89.47%
Files with Coverage Reduction New Missed Lines %
internal/store/postgres/asset_repository.go 1 77.37%
Totals Coverage Status
Change from base Build 4232425834: -0.02%
Covered Lines: 5008
Relevant Lines: 5816

💛 - Coveralls

@@ -775,6 +776,7 @@ func (r *AssetRepository) getAssetSQL() sq.SelectBuilder {
a.service as service,
a.description as description,
a.data as data,
COALESCE(a.url, '') as url,
Copy link

@haveiss haveiss Feb 22, 2023

Choose a reason for hiding this comment

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

how this compared to set url default to '' when altering table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Altering a table with default value used to take a lock for updating all rows (which would block reads and writes). This looks to have been fixed in PG 11 but I wasn't aware of that while making these changes.

@ravisuhag ravisuhag merged commit 495c666 into main Feb 22, 2023
@ravisuhag ravisuhag deleted the fix-asset-url-fetch branch February 22, 2023 04:24
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.

4 participants