Hi all,
I'm creating multi-tenancy capabilities for out back-end application and I need to create a separate database for every current tenant.
Playing around with pg_dump and pg_restore, I noticed that a new restored PostgreSQL database is fully functional and I don't need to use the proper makemigrations+migrate procedure.
Then I can log in into the admin interface of the Django app and delete all the extraneous data leaving just the one related to the tenant.
Do you see any inconvenience in proceeding this way?
Below the procedure I use (cleansed of host, port and user options):
/usr/bin/pg_dump -Ft --no-acl --no-owner <ORIGIN_DB> -f /tmp/dump.tar
/usr/bin/pg_restore -n public -d <DESTINATION_DB> /tmp/dump.tar
Thank you very much.