jcass77 / django-apscheduler

APScheduler for Django
MIT License
669 stars 97 forks source link

Unapplying Migrations Fails #185

Open n4ff4h opened 1 year ago

n4ff4h commented 1 year ago

When trying to uninstall this library, I did a python manage.py migrate django_apscheduler zero and the following errors throws up:

Operations to perform:
  Unapply all migrations: django_apscheduler
Running migrations:
  Rendering model states... DONE
  Unapplying django_apscheduler.0009_djangojobexecution_unique_job_executions... OK
  Unapplying django_apscheduler.0008_remove_djangojobexecution_started... OK
  Unapplying django_apscheduler.0007_auto_20200717_1404... OK
  Unapplying django_apscheduler.0006_remove_djangojob_name... OK
  Unapplying django_apscheduler.0005_migrate_name_to_id...Traceback (most recent call last):
  File "/Users/naffah/Code/PythonProjects/erp_integrator/manage.py", line 22, in <module>
    main()
  File "/Users/naffah/Code/PythonProjects/erp_integrator/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/db/migrations/executor.py", line 141, in migrate
    state = self._migrate_all_backwards(plan, full_plan, fake=fake)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/db/migrations/executor.py", line 219, in _migrate_all_backwards
    self.unapply_migration(states[migration], migration, fake=fake)
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/db/migrations/executor.py", line 279, in unapply_migration
    state = migration.unapply(state, schema_editor)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/naffah/Library/Caches/pypoetry/virtualenvs/erp-integrator-NtQaQ5xa-py3.11/lib/python3.11/site-packages/django/db/migrations/migration.py", line 159, in unapply
    raise IrreversibleError(
django.db.migrations.exceptions.IrreversibleError: Operation <RunPython <function migrate_name_to_id at 0x136aacf40>> in django_apscheduler.0005_migrate_name_to_id is not reversible

Any ideas on how to fix this?

eduardopdev commented 3 months ago

Hello, are you still dealing with this problem?