database - Django: migrations for tables that are not linked to models -


i have set of tables (mostly denormilized pre-calculated values storages) not linked model, use raw select queries on them. possible use migration frameworks them (for example, want add column , deploy change environments). thanks.

you can use usual migrations system.

first, create empty migration (in whatever app appropriate).

python manage.py makemigrations --empty yourappname 

then put in whatever runsql operations need (including sql reverting changes, if want).

operations = [     migrations.runsql("create ...",                       "drop ..."),     ... ] 

the result can run right alongside migrations django models.

python manage.py migrate 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -