warehouse
warehouse copied to clipboard
Add published field to Release
This PR introduces the following changes :
- a new boolean
publishedfield to the Release model - ~a migration to update every existing releases and set their published value to be the creation time~
Part of https://github.com/pypi/warehouse/issues/17230
Some notes:
~I dislike how I changed the default Release creation call to force the publish time to be set to a timestamp, but I did not find a better solution. This created a new quirk: every time someone wants to create a new Release, they must make sure the published field is set.~
~The problem boils down to not setting a value for publish at the release creation, which would either semantically mean the time is not set (the solution I chose) or use a default value (e.g., the current timestamp). When choosing the latter case, we would need a placeholder value on the Python side (e.g., published=False) and to convert this placeholder to an explicit null value ( using forcing-null-on-a-column-with-a-default )~
The new implementation uses a boolean field.
Should this follow the same pattern we have for yanking, where there are yanking events with timestamps, and we have a yanked field on the model that is a boolean instead?
Should this follow the same pattern we have for yanking, where there are yanking events with timestamps, and we have a
yankedfield on the model that is a boolean instead?
I like the idea as it would also not modify how new Releases are created.
As this PR is now based on top of https://github.com/pypi/warehouse/pull/17472, I've converted it as a Draft until the other one is merged.
I'm holding off on merging this until we think through https://github.com/pypi/warehouse/issues/17230#issuecomment-2643839592 a little bit more (specifically, the last bit about project/release/file lifecycles needs a bit more thought here I think)