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

Setting null = false on m2m fields causes migration to fail #334

Open intigratech opened 2 months ago

intigratech commented 2 months ago

I have a m2m field as follows:

class Contact(RootModel): categories = fields.ManyToManyField('core.ContactCategory', related_name='contacts', through='fkcontactcategory', description="Categories", on_delete=fields.SET_NULL)

I set null=False on the field. categories = fields.ManyToManyField('core.ContactCategory', related_name='contacts', null=False, through='fkcontactcategory', description="Categories", on_delete=fields.SET_NULL)

When performing the migration using command.migrate(app_name) I run into an error: 'bool' object is not subscriptable

Any help would be appreciated.