﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33576	InconsistentMigrationHistory when multiple projects with custom user models share the same database.	Artem	nobody	"Hello.

I have multiple databases and use it in 2 project. 

First project:

{{{
DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'main-admin',
    },
    'main': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'main',
    },
}
}}}

Secondary project:

{{{
DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'articles-admin',
    },
    'articles': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'articles',
    },
    'main': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'main',
    },
}
}}}

I am config routers.
For example: https://monosnap.com/file/sblvTdWM9tmSx1DFxPhcI656SyRuHW

In first project I create database ""main"" and apply all migrations.
In secondary project I create CustomUser and apply migrations.

Then I create new migration in secondary project then look:
InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency person.0001_initial on database 'main'

I need create next project with custom user and database ""main"". 
But I will get an error again if now I delete the base and recreate it on the next project that will contain the base ""main""

Main database migration sequence is not important, but every time I connect it to the next project and create a custom user, I will get an error"	Bug	closed	Core (Other)	4.0	Normal	invalid			Unreviewed	0	0	0	0	0	0
