From 5afe4405d224750f42c39d4fcee691c90c1ad2bf Mon Sep 17 00:00:00 2001 From: Chris Williams <17027446+mistwire@users.noreply.github.com> Date: Mon, 13 May 2024 12:11:38 -0400 Subject: [PATCH] add archived column to project --- .../70a435a7a591_add_archived_to_project.py | 38 +++++++++++++++++++ warehouse/packaging/models.py | 1 + 2 files changed, 39 insertions(+) create mode 100644 warehouse/migrations/versions/70a435a7a591_add_archived_to_project.py diff --git a/warehouse/migrations/versions/70a435a7a591_add_archived_to_project.py b/warehouse/migrations/versions/70a435a7a591_add_archived_to_project.py new file mode 100644 index 000000000000..cd1ea3bf0b07 --- /dev/null +++ b/warehouse/migrations/versions/70a435a7a591_add_archived_to_project.py @@ -0,0 +1,38 @@ +# 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 archived to Project + +Revision ID: 70a435a7a591 +Revises: 78ecf599841c +Create Date: 2024-05-13 15:56:13.050983 +""" + +import sqlalchemy as sa + +from alembic import op + +revision = "70a435a7a591" +down_revision = "78ecf599841c" + + +def upgrade(): + op.add_column( + "projects", + sa.Column( + "archived", sa.Boolean(), server_default=sa.text("false"), nullable=False + ), + ) + + +def downgrade(): + op.drop_column("projects", "archived") \ No newline at end of file diff --git a/warehouse/packaging/models.py b/warehouse/packaging/models.py index dd4ddca38c68..b0d6554505dc 100644 --- a/warehouse/packaging/models.py +++ b/warehouse/packaging/models.py @@ -172,6 +172,7 @@ class Project(SitemapMixin, HasEvents, HasObservations, db.Model): total_size: Mapped[int | None] = mapped_column( BigInteger, server_default=sql.text("0") ) + archived: Mapped[bool_false] oidc_publishers: Mapped[list[OIDCPublisher]] = orm.relationship( secondary="oidc_publisher_project_association",