aerich icon indicating copy to clipboard operation
aerich copied to clipboard

Can't delete m2m relation

Open Maksim-Burtsev opened this issue 2 years ago • 1 comments

I have m2m relation between two tables (and table already exists in the database with default name 'model1_model2'). But after i remove this relation and run aerich migrate i have error:

    return f(get_current_context(), *args, **kwargs)
  File "/Users/zadro/yuco/yuco-backend/venv/lib/python3.10/site-packages/aerich/cli.py", line 31, in wrapper
    loop.run_until_complete(f(*args, **kwargs))
  File "/opt/homebrew/Cellar/[email protected]/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/zadro/yuco/yuco-backend/venv/lib/python3.10/site-packages/aerich/cli.py", line 86, in migrate
    ret = await command.migrate(name)
  File "/Users/zadro/yuco/yuco-backend/venv/lib/python3.10/site-packages/aerich/__init__.py", line 121, in migrate
    return await Migrate.migrate(name)
  File "/Users/zadro/yuco/yuco-backend/venv/lib/python3.10/site-packages/aerich/migrate.py", line 140, in migrate
    cls.diff_models(cls._last_version_content, new_version_content)
  File "/Users/zadro/yuco/yuco-backend/venv/lib/python3.10/site-packages/aerich/migrate.py", line 243, in diff_models
    table = change[0][1].get("through")
AttributeError: 'str' object has no attribute 'get'

I was tried everything from this issue #150 but nothing helps me.

@long2ice Is it possible to remove this relation by aerich or it will stay forever?

Maksim-Burtsev avatar Jul 28 '23 14:07 Maksim-Burtsev

you can install the previous version of aerich (0.7.1)

catarium avatar Jul 30 '23 21:07 catarium