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
Post a Comment