Skip to content

Conversation

@shantanutomarr
Copy link

@shantanutomarr shantanutomarr commented Mar 24, 2025

  • When running migrate_schemas command that applies a migration to change the primary key field of a model from AutoField to BigAutoField, we get the following error:
    NotImplementedError: subclasses of BaseDatabaseIntrospection may require a get_sequences() method

  • Apparently this method is not implemented in the tenant schemas backend yet, but is expected by Django 4.2.

  • This commit adds that method by referring to earlier pull requests on this issue:

  • Added comprehensive test case that reproduces the bug and verifies the fix works

Closes #538

- When running migrate_schemas command that applies a migration to change
the primary key field of a model from `AutoField` to `BigAutoField`, we
get the following error:

`NotImplementedError: subclasses of BaseDatabaseIntrospection may require a get_sequences() method`

- Apparently this method is not implemented in the tenant schemas
backend yet, but is expected by Django 4.2.
- This commit adds that method by refering to a pull request on the
original project,
bernardopires#567.
@goodtune
Copy link
Collaborator

goodtune commented Sep 4, 2025

Thank you @shantanutomarr for your excellent contribution! Your implementation of the get_sequences() method correctly fixes the Django 4.2+ compatibility issue from #538.

I've created PR #712 which adds a comprehensive test case that:
Reproduces the exact bug from issue #538 by directly calling introspection.get_sequences()
Fails on master branch (demonstrating the bug exists)
Passes with your implementation (proving the fix works)
Provides regression protection for future Django versions

Your implementation is solid and identical to PR #704. To consolidate efforts and ensure proper test coverage, I'm closing this PR in favor of PR #712 which includes both the fix AND comprehensive testing.

The solution will be available once PR #712 is merged. Thank you for helping modernize django-tenant-schemas for current Django versions!

@goodtune goodtune closed this Sep 4, 2025
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.

Django db introspection get_sequences() NotImplementedError on flush

2 participants