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

Generic events #8324

Merged
merged 6 commits into from
Apr 19, 2022
Merged

Generic events #8324

merged 6 commits into from
Apr 19, 2022

Conversation

di
Copy link
Member

@di di commented Jul 26, 2020

This PR introduces a generic HasEvents subclass for models that have related events, and migrates the existing UserEvents and ProjectEvents models to it. It uses generic associations but maintains essentially the same underlying "table per related" structure.

This ensures that events are created and associated with their sources in a consistent and generic way, and allows us to add event support to any new or existing model simply by adding the HasEvents mixin to the models class definition.

@di di requested a review from ewdurbin July 26, 2020 07:17
Base automatically changed from master to main January 21, 2021 18:39
@di di force-pushed the generic-events branch 3 times, most recently from 68ada76 to 2ce0164 Compare April 19, 2022 16:07
@di di force-pushed the generic-events branch from 9629062 to 792ebf3 Compare April 19, 2022 16:33
@di di requested review from ewdurbin and dstufft and removed request for ewdurbin April 19, 2022 16:40
@ewdurbin
Copy link
Member

I'm going to validate the migration locally, but have no issues with this.

I will ask to coordinate merge so I can be on hand though.

warehouse/events/models.py Outdated Show resolved Hide resolved
Copy link
Member

@dstufft dstufft left a comment

Choose a reason for hiding this comment

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

One comment, this looks fine as is but the comment above may make it cleaner. Either way it looks fine to me.

warehouse/events/models.py Outdated Show resolved Hide resolved
@dstufft
Copy link
Member

dstufft commented Apr 19, 2022

👍

@di
Copy link
Member Author

di commented Apr 19, 2022

@ewdurbin I'll let you merge whenever you're free to babysit this.

@ewdurbin
Copy link
Member

🖖🏼 20.778 month old PR 🚢

@ewdurbin ewdurbin merged commit 7da6d17 into main Apr 19, 2022
@ewdurbin ewdurbin deleted the generic-events branch April 19, 2022 23:05
domdfcoding pushed a commit to domdfcoding/warehouse that referenced this pull request Jun 7, 2022
* Generic events

* Update migration to rename table/columns in place

* Use AbstractConcreteBase

* Address feedback from review

* Remove commented out line

* Linting
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.

3 participants