Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Migration

It seems to me like using the makemigration commands can possibly be avoided if the user knows SQL and SQLite very well (which I happen to). If I wanted to could I have another script that I would run which would update the database tables as needed?

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,468 Points

Yes, you can certainly edit the database directly (which is what we all did before the migration package was available. It was integrated into Django 1.7). For the rest of use migrations save us a lot of time.

The power of migrations is to create a series of files that match the current state of the models. The migration files and models are checked in to a repository together. You can then run migrations to roll-back or roll-forward the database to match the revision of models currently being worked on.

For those with the skills, there are provisions within Django to write raw optimized SQL if so desired, for improved performance over the built-in ORM.