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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -