diff --git a/ormar/fields/many_to_many.py b/ormar/fields/many_to_many.py index b68821f..2f4cc3e 100644 --- a/ormar/fields/many_to_many.py +++ b/ormar/fields/many_to_many.py @@ -275,5 +275,9 @@ class ManyToManyField(ForeignKeyField, ormar.QuerySetProtocol, ormar.RelationPro "metadata": self.owner.Meta.metadata, } new_meta = type("Meta", (), new_meta_namespace) - through_model = type(class_name, (ormar.Model,), {"Meta": new_meta}) + through_model = type( + class_name, + (ormar.Model,), + {"Meta": new_meta, "id": ormar.Integer(name="id", primary_key=True)}, + ) self.through = cast(Type["Model"], through_model)