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

Add published column #17472

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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")
3 changes: 2 additions & 1 deletion warehouse/packaging/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down