Upgrade django-synchro for django 2.2 : OperationalError - no such table: django_content_type"

186 views
Skip to first unread message

Loys Masquelier

unread,
Jul 6, 2019, 3:06:28 PM7/6/19
to django...@googlegroups.com

Hello,

From : https://stackoverflow.com/questions/56875632/upgrade-django-synchro-for-django-2-2-operationalerror-no-such-table-django

I am trying to upgrade django-synchro to django 2.2. I have already upgraded the project to django 2.1 but I have now a problem with ContentType object

The upgraded version to django 2.1 can be found here

(python runtests.py works, all tests pass)

With django 2.2.3 I have the error

django.db.utils.OperationalError: no such table: django_content_type

It seems that at initialisation, migrations are done on default database and the rest it is done on test database (in memory). So ContentType are not seen in the rest of the code. An error occur when models.py is read (content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE))

Any ideas would be very appreciated...

I have looked in Django 2.2 release notes

There are two backwards incompatible changes in 2.2 that can maybe do the error :

TransactionTestCase serialized data loading : Initial data migrations are now loaded in TransactionTestCase at the end of the test, after the database flush. In older versions, this data was loaded at the beginning of the test, but this prevents the test --keepdb option from working properly (the database was empty at the end of the whole test suite). This change shouldn’t have an impact on your tests unless you’ve customized TransactionTestCase’s internals.

Test : Deferrable database constraints are now checked at the end of each TestCase test on SQLite 3.20+, just like on other backends that support deferrable constraints. These checks aren’t implemented for older versions of SQLite because they would require expensive table introspection there.





Reply all
Reply to author
Forward
0 new messages