我在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
当我在postgre中打开新的\u postgre2(用于newpostgre)数据库时,我可以在那里看到我的Check1表。你知道吗
但是在我的postgre3(对于newpostgre2)数据库中,没有Check1表,只有那些初始迁移。你知道吗
迁移成功后,为什么在new\u postgre3中看不到我的表?你知道吗
因为同一个对象名可以在不同的模式中使用,所以有时会发生冲突。最佳实践允许许多用户使用一个数据库而不相互干扰。使用此更改第二个数据库用户并再次检查。我认为这是工作。你知道吗
Python管理.py迁移数据库=newpostgre2
相关问题 更多 >
编程相关推荐