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?.
2 に答える
1
現在の問題の実際の決定ではなく、将来の問題の決定である可能性があります。すべてのデータベースでスキーマを一度に変更します。
プロセスを自動化できます。ループ内のすべてのデータベースに対して次の手順を実行します。
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 ) )
于 2012-02-27T10:57:22.243 に答える
0
于 2012-02-27T10:42:27.053 に答える