what i'm trying to do is to change the default path for migrations for a specific application in a django project to put it outside the project itself but keeping it transparent, keeping use of makemigrations and migrate. Is it possible? if yes, how?
Reset the Whole Database in Django sqlite3 and then delete all the migrations folders inside all the apps. After deleting the migrations folders, we can remake the migrations and migrate them using two commands; namely, python manage.py makemigrations and python manage.py migrate .
Short answer: the migrations originate from Django apps and third party apps you installed in INSTALLED_APPS . Not the ones you defined yourself. Migrations are generated per app, and are stored in some_app/migrations .
You should think of migrations as a version control system for your database schema. makemigrations is responsible for packaging up your model changes into individual migration files - analogous to commits - and migrate is responsible for applying those to your database.
Django has a MIGRATION_MODULES
setting. It allows you to specify a different module for migrations per app. The module can be outside of the Django project, it just needs to be on your python path.
MIGRATION_MODULES = {'myapp': 'othermodule.db_migrations'}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With