tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
804 stars 90 forks source link

How to add indexes in m2m table? #292

Closed Maksim-Burtsev closed 10 months ago

Maksim-Burtsev commented 1 year ago

When creating m2m relations between models table which contains ids (table1_id, table2_id) doesnt have indexes. Is it possible to add them without update sql-query in migration?

Maksim-Burtsev commented 10 months ago

I solve this by creating table with two FK and specified it in ManyToMany(..., through='my_table_with_indexes') attr.