我在我的django应用程序中使用了2个postgres数据库。多个数据库 - 迁移
'newpostgre': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'new_postgre2',
'USER': 'tester',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
},
'newpostgre2': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'new_postgre3',
'USER': 'tester',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
},
我有一个非常简单的模型
class Check1(models.Model):
title = models.CharField(max_length=100)
我已经跑
python manage.py migrate --database=newpostgre
python manage.py migrate --database=newpostgre2
当我睁开new_postgre2(用于newpostgre)在postgre数据库
,我可以看到我的检查1桌上有。
但是在我的postgre的new_postgre3(for newpostgre2)数据库中,没有Check1表存在,只有那些最初的迁移。
为什么我在迁移成功后无法在new_postgre3中看到我的表?
您是否使用DB路由器? – itzMEonTV