wsvincent/lithium

SQL Server Backend

Closed this issue · 2 comments

Hi Will,

I'm trying to use Djangox with a SQL Server backend. I see that you prefer Postgres (and understand why) but I dont have time to learn a new db. Trying to get an MVP stood up.

When I migrate, I get:

django.db.utils.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Foreign key 'account_emailaddress_user_id_2c513194_fk_users_customuser_id' references invalid table 'users_customuser'. (1767) (SQLExecDirectW)")

running migrate again gives me:
django.db.utils.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Foreign key 'account_emailaddress_user_id_2c513194_fk_users_customuser_id' references invalid table 'users_customuser'. (1767) (SQLExecDirectW)")

it looks like users_customuser is not getting created.

I have not tried migrating with sqlite but will do that.

Thanks.

Got it to work.

I changed the CustomUser class to:

from django.contrib.auth.models import AbstractUser
from django.db import models

class CustomUser(AbstractUser):
fullname = models.CharField(
verbose_name="Full Name", max_length=255, blank=True, null=True)

def __str__(self):
    return self.email

I noticed that pip installing django-pyodbc-azure moved me back to Django 2.1.8. That might have something to do with this.

I'm running so close this issue at your discretion.

creating another project and hit this again.

Users module does not have a migrations folder. Create that (and init.py) and it is good to go.