Search code examples
djangodjango-evolution

Applying django evolution to multiple databases with reference to a base database


I have a django model which i would call as base model. I have created a project which dynamically creates new databases. Now, i found that i have to make a change to a table schema in the base table. How do i update this change to all the created databases?.


Solution

  • May be it's not a real decision of your current problem but the decision of future problems: do schema changes in all databases at one time.

    You could automate the process. Do the next for all databases in a loop:

    from subprocess import call
    
    # get names of your databases in list 'databases' here
    
    for database in databases:
        call( "python ./manage.py syncdb --database={0}".format( database ) )