Skip to content

Conversation

@smithellis
Copy link
Contributor

  • A migration to safely remove wagtail tables and perms

Copy link
Collaborator

@akatsoulas akatsoulas left a comment

Choose a reason for hiding this comment

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

r+wc optionally

)

# Find all Wagtail tables dynamically using LIKE pattern
with connection.cursor() as cursor:
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: you can also use introspection here to get the tables

introspection = connection.introspection
qn = connection.ops.quote_name

table_names = introspection.table_names()
wagtail_tables = sorted([t for t in table_names if t.startswith("wagtail")], reverse=True)

You can also use introspection.get_constraints for FK relationships.

@akatsoulas
Copy link
Collaborator

For this PR since we have destructive operations, let's have also @escattone's approval

@akatsoulas
Copy link
Collaborator

Is this working locally?

@smithellis smithellis requested a review from escattone September 8, 2025 13:04
@smithellis
Copy link
Contributor Author

@escattone Added as reviewer.

Is this working locally?

@akatsoulas I don't have the complete DB locally that includes erroneous WT tables and perms. I have tested with mock data locally without issue.

Copy link
Contributor

@escattone escattone left a comment

Choose a reason for hiding this comment

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

From my experiments in production, this PR will fail to remove the Wagtail sequences. We should make sure they're removed via this PR as well.

@escattone escattone merged commit 78d7aeb into mozilla:main Sep 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants