Skip to content

refactor: include existing ultranormalized index #14012

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 1 commit into from
Jun 26, 2023

Conversation

miketheman
Copy link
Member

In #10498 and index was manually added via migration. At the time, SQLAlchemy 1.4 did not detect this un-declared change.

Since SQLAlchemy 2.0, autogenerating a migration for the codebase wants to drop the index, since it's not declared on the table.

Adding the correct column to the __table_args__ means that the column name needs to be in scope, which it cannot be at the top of the table definition, so move it to the bottom, and add the existing Index.

With this change in place, alembic no longer suggests that we delete the index, nor does it suggest any other operations.

In pypi#10498 and index was manually added via migration.
At the time, SQLAlchemy 1.4 did not detect this un-declared change.

Since SQLAlchemy 2.0, autogenerating a migration for the codebase wants
to drop the index, since it's not declared on the table.

Adding the correct column to the `__table_args__` means that the column
name needs to be in scope, which it cannot be at the top of the table
definition, so move it to the bottom, and add the existing Index.

With this change in place, alembic no longer suggests that we delete the
index, nor does it suggest any other operations.

Signed-off-by: Mike Fiedler <[email protected]>
@miketheman miketheman added the developer experience Anything that improves the experience for Warehouse devs label Jun 23, 2023
@miketheman miketheman requested a review from a team as a code owner June 23, 2023 17:22
@ewdurbin ewdurbin merged commit b0b293e into pypi:main Jun 26, 2023
@miketheman miketheman deleted the miketheman/update-projects-table-def branch June 26, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer experience Anything that improves the experience for Warehouse devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants