Skip to content
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

TypeError when reverting extra_data migration 0013_migrate_extra_data #627

Closed
niklas-scholz opened this issue Oct 28, 2024 · 1 comment · Fixed by #626
Closed

TypeError when reverting extra_data migration 0013_migrate_extra_data #627

niklas-scholz opened this issue Oct 28, 2024 · 1 comment · Fixed by #626

Comments

@niklas-scholz
Copy link
Contributor

Expected behaviour

We can revert all migrations from version 4.0.0 to 5.4.2.

Actual behaviour

We get a TypeError in 0013_migrate_extra_data.py

What are the steps to reproduce this issue?

  1. Check out the latest version
  2. Run migrations with python manage.py migrate
  3. Try to revert migrations with python manage.py migrate social_django 0011_alter_id_fields

Any logs, error output, etc?

When reverting migrations with:

python manage.py migrate social_django 0011_alter_id_fields

we get the following errors:

Operations to perform:
  Target specific migration: 0011_alter_id_fields, from social_django
Running migrations:
  Rendering model states... DONE
  Unapplying social_django.0016_alter_usersocialauth_extra_data... OK
  Unapplying social_django.0015_rename_extra_data_new_usersocialauth_extra_data... OK
  Unapplying social_django.0014_remove_usersocialauth_extra_data... OK
  Unapplying social_django.0013_migrate_extra_data...Traceback (most recent call last):
  File "/app/manage.py", line 44, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 357, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 141, in migrate
    state = self._migrate_all_backwards(plan, full_plan, fake=fake)
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 219, in _migrate_all_backwards
    self.unapply_migration(states[migration], migration, fake=fake)
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 282, in unapply_migration
    state = migration.unapply(state, schema_editor)
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/migration.py", line 193, in unapply
    operation.database_backwards(
  File "/usr/local/lib/python3.10/site-packages/django/db/migrations/operations/special.py", line 204, in database_backwards
    self.reverse_code(from_state.apps, schema_editor)
  File "/usr/local/lib/python3.10/site-packages/social_django/migrations/0013_migrate_extra_data.py", line 69, in migrate_json_field_backwards
    is_text_field = issubclass(
TypeError: issubclass() arg 1 must be a class
@niklas-scholz
Copy link
Contributor Author

I added a potential fix here: #626

@nijel nijel linked a pull request Oct 30, 2024 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant