DB warnings with mysql/mariadb - Auto-created primary key used when not defining a primary key type
Hi
I did fresh install on Debian 11 using the "How to Install Mailman 3 on a Debian 10" document as base. We changed it to use mysql / mariadb rather than postgresql. That resulted in a multitude of warnings like the below.
(venv) mailman@dev1:/opt/mailman/mm$ /opt/mailman/mm/bin/django-admin createsuperuser
System check identified some issues:
WARNINGS:
django_mailman3.MailDomain: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the DjangoMailman3Config.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
django_mailman3.Profile: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the DjangoMailman3Config.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
hyperkitty.Attachment: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the HyperKittyConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
hyperkitty.Email: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
The issue was resolved by adding
DEFAULT_AUTO_FIELD='django.db.models.AutoField'
to settings.py.
Also a note for the "Setting up your database" section of the MM3 docs, before we could 'pip install' pymysql and mysqlclient we had to install
apt-get install libmariadb-dev-compat libmariadb-dev