Monday, February 27, 2017

Multiple Databases --- Migrations

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 ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/33338634-5cba-45a5-b4ef-aa446a0328c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment