diff --git a/warehouse/migrations/versions/6cac7b706953_add_published_field.py b/warehouse/migrations/versions/6cac7b706953_add_published_field.py new file mode 100644 index 000000000000..e00c3646cfb5 --- /dev/null +++ b/warehouse/migrations/versions/6cac7b706953_add_published_field.py @@ -0,0 +1,42 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +add published field + +Revision ID: 6cac7b706953 +Revises: 2a2c32c47a8f +Create Date: 2025-01-22 08:49:17.030343 +""" + +import sqlalchemy as sa + +from alembic import op + +revision = "6cac7b706953" +down_revision = "2a2c32c47a8f" + + +def upgrade(): + conn = op.get_bind() + conn.execute(sa.text("SET statement_timeout = 120000")) + conn.execute(sa.text("SET lock_timeout = 120000")) + + op.add_column( + "releases", + sa.Column( + "published", sa.Boolean(), server_default=sa.text("true"), nullable=False + ), + ) + + +def downgrade(): + op.drop_column("releases", "published") diff --git a/warehouse/packaging/models.py b/warehouse/packaging/models.py index 476638de019b..8f6fa0d63bd3 100644 --- a/warehouse/packaging/models.py +++ b/warehouse/packaging/models.py @@ -79,7 +79,7 @@ from warehouse.sitemap.models import SitemapMixin from warehouse.utils import dotted_navigator, wheel from warehouse.utils.attrs import make_repr -from warehouse.utils.db.types import bool_false, datetime_now +from warehouse.utils.db.types import bool_false, bool_true, datetime_now if typing.TYPE_CHECKING: from warehouse.oidc.models import OIDCPublisher @@ -633,6 +633,7 @@ def __table_args__(cls): # noqa _pypi_ordering: Mapped[int | None] requires_python: Mapped[str | None] = mapped_column(Text) created: Mapped[datetime_now] = mapped_column() + published: Mapped[bool_true] = mapped_column() description_id: Mapped[UUID] = mapped_column( ForeignKey("release_descriptions.id", onupdate="CASCADE", ondelete="CASCADE"),