Django Migration Error: admin.0001_initial is applied before its dependency users.0001_initial
I'm building a Django application with a custom user model, and I'm getting a migration error. I've already created my initial migrations but when trying to apply them, I get a dependency error. Error Message django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'.
here is my My Settings Configuration (settings/base.py):
AUTH_USER_MODEL = 'users.User'
DJANGO_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
THIRD_PARTY_APPS = [
'rest_framework',
'django_filters',
'corsheaders',
'django_extensions',
'simple_history',
'phonenumber_field',
]
LOCAL_APPS = [
'apps.users.apps.UsersConfig',
'apps.courses.apps.CoursesConfig',
'apps.calendar_app.apps.CalendarAppConfig',
]
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
What I've tried:
Running python manage.py makemigrations users Running python manage.py migrate
Both commands result in the same error. How can I fix this without deleting my database?