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

Roles: db migration to create constraints #7689

Merged
merged 11 commits into from
Mar 30, 2020

Conversation

ewdurbin
Copy link
Member

Fixes #2745

@@ -154,9 +154,11 @@ ifneq ($(PR), false)
endif

initdb:
docker-compose run --rm web psql -h db -d postgres -U postgres -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname ='warehouse';"
Copy link
Member Author

Choose a reason for hiding this comment

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

disconnects any other sessions to make make initdb run regardless of if make serve containers are accessing the db.

Makefile Outdated Show resolved Hide resolved

__repr__ = make_repr("role_name", "user_name", "package_name")
__repr__ = make_repr("role_name")
Copy link
Member Author

Choose a reason for hiding this comment

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

This is weird, it never worked before and I just noticed that it explodes when tests kept breaking when it tried to render the repr.

Copy link
Member Author

Choose a reason for hiding this comment

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

looks like it is a relic of when we had strings for 'user' and 'package' on the model.

@di
Copy link
Member

di commented Mar 27, 2020

@dstufft Yeah, seemed roughly the same (and the CI runs look roughly the same as well)

@ewdurbin ewdurbin force-pushed the guard_against_duplicate_roles branch 2 times, most recently from 0890da7 to e60ea89 Compare March 28, 2020 00:19
@ewdurbin
Copy link
Member Author

I think this is all set! Caught a template bug in manual testing see 9199242

Otherwise, just further tidied up the helper method for get_user_role_in_project. This may be worth refactoring to be on the model itself a la... Project.get_user_role(user) which should return one of Owner, Maintainer, or None? But I don't think it's worth tacking into this PR.

@ewdurbin
Copy link
Member Author

ewdurbin commented Mar 28, 2020

Also confirming that b38a674 doesn't seem to have a significant impact on our test suite performance. Thanks @di!

ewdurbin added a commit that referenced this pull request Mar 28, 2020
@ewdurbin ewdurbin merged commit a511197 into master Mar 30, 2020
@ewdurbin ewdurbin deleted the guard_against_duplicate_roles branch March 30, 2020 12:05
ewdurbin added a commit that referenced this pull request Mar 30, 2020
ewdurbin added a commit that referenced this pull request Mar 30, 2020
* Roles: db migration to make role_name not nullable

Depends on #7689, fixes #7688

* lint
di added a commit to dstufft/warehouse that referenced this pull request Apr 3, 2020
di added a commit that referenced this pull request Apr 3, 2020
di added a commit that referenced this pull request Apr 3, 2020
di added a commit that referenced this pull request Apr 3, 2020
* Add dependency on trove-classifiers=1.0.0

* Remove a random comment

* Update list classifiers HTML view

* Update list classifiers API action

* Update search filter for deprecated classifiers

* New validators for classifiers and deprecated classifiers

* Create new classifiers on upload

* Clean up Classifier model

* Remove classifier pages from admin UI

* Update translations

* Test that all trove_classifiers can be created

* Test that private classifiers can't be created

* Update w/ CalVer release

* Updates from #7689

Co-authored-by: Ernest W. Durbin III <[email protected]>
di added a commit to dstufft/warehouse that referenced this pull request Apr 3, 2020
di added a commit to dstufft/warehouse that referenced this pull request Apr 3, 2020
di added a commit to dstufft/warehouse that referenced this pull request Apr 4, 2020
di added a commit that referenced this pull request Apr 6, 2020
di added a commit to dstufft/warehouse that referenced this pull request Apr 6, 2020
di added a commit to dstufft/warehouse that referenced this pull request Apr 20, 2020
di added a commit that referenced this pull request Apr 22, 2020
* Remove an outdated comment

* Add Release.yanked to the database model

* Emit the data-yanked attribute in the simple api

* Initial work on a UI for yanking releases

* Update down_revision on migration

* Remove z-index for callout-block

As is, this makes a callout with a higher modifier appear over a modal
with a lower modifier.

* Add ability to specify modifier when creating a confirm_button or confirm_modal

* Update copy

* Switch to boolean column

* Support yanking/unyanking in the UI

* Filter out yanked releases

* Tests

* Updates from #7689

* Update icon and copy

* Update un-yank icon as well

* Update migration

* Update email templates to remove translations

* Only reindex non-yanked releases

* Don't filter yanked releases from JSON API

* Show yanked status in JSON API

* Don't filter yanked releases

This allows yanked releases to show up in the UI with the exception of:

* Project.latest_version will not return a yanked release as the latest
* The project detail page will not show a yanked release as the latest
* /pypi/<project_name>/json will not use a yanked release as the latest
* Search reindexing will not include yanked releases

* Only show 'Releases' header when there are releases

* Show badge for yanked release

* Add warning label on detail page for yanked releases

* Add help section on yanked releases

* Update PEP number on help page

* Update tests

* Update conditional in simple/detail.html

* Apply suggestions from code review

Co-Authored-By: Pradyun Gedam <[email protected]>

* Update translations

* Update migration

* Add missing commas

Co-authored-by: Dustin Ingram <[email protected]>
Co-authored-by: Nicole Harris <[email protected]>
Co-authored-by: Pradyun Gedam <[email protected]>
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.

De-duplicate "Owner" and "Maintainer" roles
4 participants