microsoft / mssql-django

The Microsoft Django backend for SQL Server provides a connectivity layer for Django on SQL Server or Azure SQL DB.
Other
351 stars 115 forks source link

[QUESTION] SQL Server does not support JSONFields. #391

Open Loverz55 opened 7 months ago

Loverz55 commented 7 months ago

use models.JSONField and python manage.py migrate will make Error (fields.E180) SQL Server does not support JSONFields, I want know how to sovle the problem

I see https://github.com/microsoft/mssql-django/issues/24 replyed ,But it doesn't seem to solve the problem, so I want know how to sovle the problem

absci commented 7 months ago

Hi, could you copy the full error message. Also, what's the mssql-django, SQL Server and OS version?

bobince commented 6 months ago

mssql-django's DatabaseWrapper.data_type_check_constraints['JSONField'] contains an ISJSON check. This T-SQL function is only available on SQL Server 2016 and up so if you're running an earlier version you'll get an error when you try to create such a field.

I don't know what the right thing to do is for mssql-django generally. (For us, having a schema that differed depending on mssql version was undesirable so we just unconditionally monkey-patched the constraint out of data_type_check_constraints, but for others the check may be desirable.)