0

I have an old project that I'm resurrecting that was built with Python 2. I'm getting it going with a more current version of Python and Django (v3.9 and v4.1.2 respectively). I have the app basically up and running and I just tried to get the automated testing going. But I'm getting this error: django.db.utils.OperationalError: (1074, "Column length too big for column 'body' (max = 16383); use BLOB or TEXT instead")

Unfortunately, I have the 'body' column in multiple objects in my models.py, AND each of them is defined as a TextField (e.g. body = models.TextField()).

I'm not sure how to post the offending code since the error doesn't specify the exact object. My test is simple as I'm just trying to get testing going:

from django.test import TestCase
class Test_Countries(TestCase):
    def setUp(self):
        pass
    def test_basicCompare(self):
        self.assertEqual(1, 1)

Before running the test (python manage.py test IFSServices/tests), I've ensured that makemigrations and migrate have succeeded.

Any help that anybody could provide to help (incl how to ask a more useful question) would be greatly appreciated.

UPDATE I stumbled across this: https://stackoverflow.com/a/37150997/1524875 If I implement the code to disable migrations per that post, the problem I reported here goes away and the tests behave as expected.

JET
  • 225
  • 3
  • 10
  • What database are you using (and what version?) – Clepsyd Oct 21 '22 at 20:38
  • 8.0.31 (MySQL Community Server - GPL) on OSX 12.6 x86_64 – JET Oct 22 '22 at 02:06
  • Does this answer your question? https://stackoverflow.com/questions/36953538/mysql-column-size-limit (See also self-answer in the question itself, about `SQL_MODE` being set to `STRICT_TRANS_TABLES`) – Clepsyd Oct 22 '22 at 10:53
  • I don't think so. When I ran ```SHOW VARIABLES LIKE 'sql_mode';``` it returned only ```NO_AUTO_VALUE_ON_ZERO```. But thanks. – JET Oct 22 '22 at 13:01

0 Answers0