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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -