Multiple Databases --- Migrations

15 views
Skip to first unread message

Luvpreet Singh

unread,
Feb 27, 2017, 3:57:25 PM2/27/17
to Django users

I am using 2 postgres databases in my django app.



     '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': '',
     },


I have a very simple model

    

     class Check1(models.Model):
          title = models.CharField(max_length=100)


I had run

    

    python manage.py migrate --database=newpostgre
    python manage.py migrate --database=newpostgre2


when I open my new_postgre2(for newpostgre) database in postgre, I can see my Check1 table there.


But in my new_postgre3(for newpostgre2) database in postgre, no Check1 table is there, only those initial migrations are there.


Why I can't see my table in new_postgre3 when migrations have been successfully made? Or is there any rule that model can be migrated to only 1 database ?

Reply all
Reply to author
Forward
0 new messages