Hello, I'm using the DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" setting in a project.
When I install django-sql-explorer and run make migrations it will create a bad migration file on the django-sql-explorer instalaltion directory that alters the id fields. It's contents are similar to this:
# Generated by Django 4.1 on 2022-08-29 08:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("explorer", "0010_sql_required"),
]
operations = [
migrations.AlterField(
model_name="query",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
migrations.AlterField(
model_name="querylog",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]
To fix that we need to add the line default_auto_field = django.db.models.AutoField on apps.py so as to not use the django.db.models.BigAutoField I'm using on my settings. See https://docs.djangoproject.com/en/4.1/ref/applications/#django.apps.AppConfig.default_auto_field for reference.
This is a single line change, I'd be happy to provide a PR if needed.
BR,
Serafeim
Hello, I'm using the DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" setting in a project.
When I install django-sql-explorer and run make migrations it will create a bad migration file on the django-sql-explorer instalaltion directory that alters the id fields. It's contents are similar to this:
To fix that we need to add the line
default_auto_field = django.db.models.AutoFieldon apps.py so as to not use thedjango.db.models.BigAutoFieldI'm using on my settings. See https://docs.djangoproject.com/en/4.1/ref/applications/#django.apps.AppConfig.default_auto_field for reference.This is a single line change, I'd be happy to provide a PR if needed.
BR,
Serafeim