Skip to content

[oidc] Remove User.has_oidc_beta_access column #13461

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

Merged
merged 2 commits into from
Apr 20, 2023
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
3 changes: 0 additions & 3 deletions warehouse/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ class User(SitemapMixin, HasEvents, db.Model):
totp_secret = Column(LargeBinary(length=20), nullable=True)
last_totp_value = Column(String, nullable=True)

# XXX: Can be removed once OIDC is removed from beta.
has_oidc_beta_access = Column(Boolean, nullable=False, server_default=sql.false())

webauthn = orm.relationship(
"WebAuthn", backref="user", cascade="all, delete-orphan", lazy=True
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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.
"""
Remove User.has_oidc_beta_access column

Revision ID: d1771b942eb6
Revises: 75ba94852cd1
Create Date: 2023-04-20 17:33:44.571959
"""

import sqlalchemy as sa

from alembic import op

revision = "d1771b942eb6"
down_revision = "75ba94852cd1"


def upgrade():
conn = op.get_bind()
conn.execute("SET statement_timeout = 120000")
Copy link
Member

Choose a reason for hiding this comment

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

Do you expect a DROP COLUMN to take a long time? In a particularly busy table, I guess getting a lock might take a while, but is users updated that much?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't, but I figure this doesn't hurt given recent lock contention.

conn.execute("SET lock_timeout = 120000")
op.drop_column("users", "has_oidc_beta_access")


def downgrade():
op.add_column(
"users",
sa.Column(
"has_oidc_beta_access",
sa.BOOLEAN(),
server_default=sa.text("false"),
autoincrement=False,
nullable=False,
),
)