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

feat: list uploads joins to backup table to get backup urls #2352

Merged
merged 6 commits into from
Mar 11, 2024

Conversation

gobengo
Copy link
Contributor

@gobengo gobengo commented Jan 9, 2024

Motivation:

@gobengo gobengo changed the title list uploads joins to backup table to get backup urls feat: list uploads joins to backup table to get backup urls Jan 9, 2024
@gobengo gobengo marked this pull request as ready for review January 9, 2024 23:15
@gobengo gobengo requested a review from a team as a code owner January 9, 2024 23:15
@gobengo gobengo requested a review from alanshaw January 9, 2024 23:18
@gobengo gobengo changed the base branch from 1704755248-list-includes-car to main January 19, 2024 18:21
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

Could we get more info about why we are adding this table? We actually had it before and moved towards having a column within upload table later on.

Also a point in migration that you may not know, we have a folder https://github.com/web3-storage/web3.storage/tree/main/packages/db/postgres/migrations where when we change SQL code we should create a migration to ease the release by running it. So these changes should be added there

@gobengo
Copy link
Contributor Author

gobengo commented Jan 22, 2024

Could we get more info about why we are adding this table? We actually had it before and moved towards having a column within upload table later on.

@vasco-santos I'm mainly adding it here to reflect the reality of this table existing in staging/production, and so that the local dev flow creates it so the tests can query against it and pass, and I did that because I thought you, me, and @alanshaw all wanted to make sure that this uploads list api would include backup urls from that backup table in prod.

Now, I just want to 'add it' to the code so the local dev and ci/test setup have access to it. I don't want to (re-?)add it in staging/production, because I think it's already there. That's why I didn't add a migration, because I don't want to run a migration on staging/production. I want the localdev to reflect what is running in staging/prod, but only insofar as I can run tests locally that use that table.

Does that seem reasonable why there is not a migration or do you still think I should add one @vasco-santos ?

@alanshaw
Copy link
Member

@vasco-santos we never ran a migration to get the data out of the old backup table so it still exists in production. @gobengo just needs it to exist again for local dev and testing so that in production it all works.

@vasco-santos
Copy link
Member

vasco-santos commented Jan 23, 2024

Interesting we did not run the migration, the script was created #1305

Perhaps we could just run it now and get rid of backup table instead of making the list more complex? I do not want to block the plan, so if you prefer to go this way is fine for me :) I just though the backup table had been migrated

@alanshaw
Copy link
Member

⚠️ the migration may have run but a quick check and I have found entries in backup that are not in upload.backup_urls.

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -22,6 +22,7 @@ const uploadQuery = `
created:inserted_at,
updated:updated_at,
backupUrls:backup_urls,
backup( url ),
Copy link
Member

Choose a reason for hiding this comment

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

I believe you should run https://github.com/web3-storage/web3.storage/blob/main/packages/db/package.json#L13C5-L13C63 to update the types? but I do not remember anymore how this used to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for suggesting this. I wouldn't have known. I ran that script and it produced this diff df36cfb

@alanshaw
Copy link
Member

@gobengo does this need to get deployed?

Copy link
Contributor

Website preview 🔗✨

build log

@gobengo gobengo force-pushed the 1704839541-car-from-backup-table branch from 5a8e97d to c87f5a0 Compare March 11, 2024 17:59
@gobengo gobengo merged commit 6d1a6f5 into main Mar 11, 2024
10 checks passed
@gobengo gobengo deleted the 1704839541-car-from-backup-table branch March 11, 2024 18:20
@gobengo
Copy link
Contributor Author

gobengo commented Mar 11, 2024

After deploying to staging via this, I verified w3 list calling the list uploads api still works ok. Going to release to prod.

gobengo added a commit that referenced this pull request Mar 11, 2024
…ron, api packages (#2362)

Motivation:
* I want to release the db change from here
#2352 in a way that the
api also gets released and making use of it
* When I merged that last PR, there was no release-please PR generated
for api. iiuc, that's because the PR only touched the db package, but
not the api package (that depends on db)
* hoping that this change that touches the api package.json will release
things as desired
@gobengo
Copy link
Contributor Author

gobengo commented Mar 11, 2024

i had to do this other PR to ensure this change to db package got incorporated into released api service #2362

verified in prod after deploy: w3 list works against prod.

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.

None yet

3 participants