Hi,

I'm on Django 4.2 atop Postgres. In my project settings.py, I have a
main/default database connection, and a second set up like this:

==============
DATABASES = {
    'default': {
        ...
        'NAME': 'foo',                     # Postgres DATABASE NAME
        ...
    },
    'archive_restore': {
        ...
        'NAME': 'archive_restore',   # Postgres DATABASE NAME
        ...
    },
    # Other entries for specialised purposes such as custom Postgres
Foreign Data Wrappers.
===============

As you can see, the Postgres database names are "foo" and "archive_restore"
respectively. For all normal Django purposes, we want to use "default", aka
"foo". The "archive_restore" connection/database is used in conjunction
with a bunch of psql commands to create a subset of the main Django ORM
data. Once populated via pg_restore, I need to run the DJango migrations on
them for eventual use under Django. I had assumed that a command like this:

./manage.py migrate --database archive_restore

would modify archive_restore/archive_restore. However, what seems to happen
is that the migrations are:

   - Actually run in default/foo (the migrations include code generated by
   makemigrations and custom RunPython stuff).
   - But recorded in the django_migrations table in
   archive_restore/archive_restore.

whereas I was expecting that they would be both run and recorded in the
latter. Have I overlooked some setting/restriction, or is this a bug?

Thanks, Shaheed

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHAc2je%2B%3D67tZBeGBMUO8Dmqmq9SaCRuopLxqrECuXb1C8YriQ%40mail.gmail.com.

Reply via email to