What is Django's migration? -
i've been wrapping head around concept while, when start new django project, urges me apply migrations:
# python manage.py runserver performing system checks... system check identified no issues (0 silenced). have 13 unapplied migration(s). project may not work until apply migrations app(s): admin, auth, contenttypes, sessions. run 'python manage.py migrate' apply them.
why need it? give concise explanation , simple use case of migration
?
edit: decided publish question because didn't see similar question here on stackoverflow, maybe there better explanation in doc.
migrations great way of managing database schema changes. has 2 main benefits (in opinion):
1 - if have multiple instances of application - development + production being typical minimum, potentially application installed others (either standalone or other django applications), migrations allow you, developer, propagate database schema changes in safe & controlled way. can guarantee up-to-date version of application (i.e., including latest database models) have functioning database match. general answer migrations solve common problem in relatively elegant manner.
2 - specifically, noted in answer, there initial migrations, absolutely brand-new django project, relating users , permissions. django application of significance can think of need these tables function - i.e., if don't make use of them are, arguably, not benefiting of django has offer framework. including migrations, developer can decide database use (sqlite, mysql, postgresql, etc.) , database reside , once have made settings (typically in settings.py project), migrations take care of rest.
Comments
Post a Comment