Open knyghty opened 1 year ago
Is there a work-around for this? Is it possible to put the missing migration into my project?
Is there a work-around for this? Is it possible to put the missing migration into my project?
Not really, no. it needs to be fixed in this repo.
Hi @knyghty
Can you provide me with more info? Especially what the content of the migration file being generated is.
We already have the apps.Config.default_auto_field
set to BigAutoField
, and I'm not sure what you mean by "setting default_auto_field for the models in the project".
Hi @valberg,
The problem, as I understand it (which is somewhat, but not fully), is that there is currently the initial migration that uses AutoField
: https://github.com/jazzband/django-invitations/blob/master/invitations/migrations/0001_initial.py#L17
Because this is generated from the implicit id
field, i.e. it isn't specified explicitly in the Invitation
model, Django now wants to generate this migration, which should be added to the project:
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("invitations", "0003_auto_20151126_1523"),
]
operations = [
migrations.AlterField(
model_name="invitation",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
Ah, I now see that this has already been done, just not released, so sorry for the noise here. A release would be appreciated, though, if someone has the time to prep it.
Related to these changes: https://docs.djangoproject.com/en/4.2/releases/3.2/#customizing-type-of-auto-created-primary-keys
This makes it difficult for example to have a CI step to check for missing migrations, as this package is always generating a migration file.
This can be fixed by setting default_auto_field for the models in the project, and making a migration for them if necessary.