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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Iskander Ismagilov](https://uploads.teamtreehouse.com/production/profile-photos/4817582/micro_IMG_9263.jpg)
Iskander Ismagilov
13,298 PointsWhat is migration?
Is migration a process that applies all the changes which relates to models that in app or project to a database?
2 Answers
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsFrom the docs, Migrations are Django’s way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema. They’re designed to be mostly automatic, but you’ll need to know when to make migrations, when to run them, and the common problems you might run into.
Each model is represented by a table in the database, the table rows represents the instances and the table columns represent the model fields. as model definitions change, the database organization (or schema) must change to match. Migrations keep track of the differences at each snapshot so the database can be rolled back or forwards to match the state of the models if they are also rolled back or forward as during a checkout of different revisions from revision control.
If you are not using revision control to track your models and database schema, migrations provide an easy way to keep the database in sync with changes as they are made.
![Daniel Wu](https://secure.gravatar.com/avatar/c744c8689f5c6eab5aa151c224168d14?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Daniel Wu
4,349 PointsWhen I run python manage.py migrate, I receive the following error message: sqlite3.operationalError: unable to open database file
how do i fix this? i think this causes problems later on in the tutorial when I can't make a migration to the courses app.
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsThere are many ways this can break. Can you provide more information on what has been tried, and does work?
You can test DB connection using dbshell
$ python manage.py dbshell
Also review connecting to the database doc.
Iskander Ismagilov
13,298 PointsIskander Ismagilov
13,298 PointsGot it, thank's Chris.
Alejandro Ochoa
Courses Plus Student 10,671 PointsAlejandro Ochoa
Courses Plus Student 10,671 PointsHi Chris Freeman, would you happen to know if migrating applies or servers any kind of purpose when using a schemaless database such as mongoDB.
kerimcharyev
1,589 Pointskerimcharyev
1,589 PointsCould you please clarify difference between migrate and makemigrations??
Chris Freeman
Treehouse Moderator 68,425 PointsChris Freeman
Treehouse Moderator 68,425 Pointsmakemigrations examines the database and the models to create difference files that represent the incremental changes. The differences are stored in the migrations directory.
migrate applies the changes detected during the make process to the database to bring the database into sync.