-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add migrations for new GitHub backend #632
Conversation
Codecov Report
@@ Coverage Diff @@
## master #632 +/- ##
=======================================
Coverage 90.14% 90.14%
=======================================
Files 56 56
Lines 2690 2690
Branches 352 352
=======================================
Hits 2425 2425
Misses 201 201
Partials 64 64 Continue to review full report at Codecov.
|
4247f71
to
f1d5648
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both these migrations look right to me, but I've not tested them on a database dump to make completely sure. I'll leave it up to @Zlopez to review and merge. Thanks for the PR!
I tried to test it, but right now I'm getting 404 when trying to receive database dump from production. So I need to wait until this will be fixed. |
The database is frozen now and the name of the dump is different, I changed it in ansible script and run it.
It will be enough, if you could just add also the projects with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR looks good I have only few small changes that should help catch any missing project with GitHub backend.
|
||
def downgrade(): | ||
"""No-op, as empty version_url wouldn't have worked before anyway.""" | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to raise NotImplementedError
SET version_url=trim(substr(homepage, 20), '/') | ||
WHERE backend = 'GitHub' | ||
AND homepage LIKE 'https://github.com/%' | ||
AND version_url IS NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add OR version_url=''
SET version_url=trim(substr(homepage, 19), '/') | ||
WHERE backend = 'GitHub' | ||
AND homepage LIKE 'http://github.com/%' | ||
AND version_url IS NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add OR version_url=''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more small change.
|
||
|
||
def downgrade(): | ||
"""Convert GitHub owner/project to URL to work with old GitHub backend.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessery, the old backend can work with owner/repo
in version_url.
I found out, I tried your migration script on wrong db dump. So I started again and found out, there is issue with the new dump, because it's missing all user related tables. |
The new GitHub backend expects that version_url will be an owner/project pair rather than a URL. Signed-off-by: Eli Young <[email protected]>
This uses the homepage field to populate any null version_url fields on projects that use the GitHub backend. Signed-off-by: Eli Young <[email protected]>
f1d5648
to
ef2767f
Compare
@Zlopez Comments addressed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request adds two database migrations to support the new GitHub backend, which expects that the
version_url
field will be in the formatowner/project
. The first migration converts any projects that have a URL in that field to the required format. The second migration uses the value of thehomepage
field to populate any projects that use the GitHub backend and have a null value for theversion_url
field.