django-ldapdb migration issue
When installing Re2o, Django may attempt to apply the ldap_sync
migration. However, this is a "fake" migration that should never be run, but due to a bug in django-ldapdb it might still be.
In that case, an error similar to the following will occur:
$ ./manage.py migrate
Operations to perform:
Apply all migrations: admin, api, auth, authtoken, contenttypes, cotisations, ldap_sync, machines, preferences, reversion, sessions, topologie, users
Running migrations:
Applying ldap_sync.0001_initial...Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/lib/python3/dist-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 411, in _query
rowcount = self._do_query(q)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 374, in _do_query
db.query(q)
File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 292, in query
_mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1068, 'Multiple primary key defined')
The above exception was the direct cause of the following exception:
Tables with the ldap_sync
prefix will also be created in the database.
This bug might be fixed by this MR in django-ldapdb
, but the fix is not available in our version.