Posts

Showing posts from August, 2021

Introduction Migrations

Image
 Introduction Migrations What are migrations? - A migration is a file that keeps track of changes to our database schema (structure of our database). - Offers version control on our schema. - Migrations deal with how we manage modifications to our data schema, over time. Benefits of migrations in our app: - Mistakes to our database schema are very expensive to make.  - The entire app can go down, so we want to quickly roll back changes, and test changes before we make them. - Encapsulate a set of changes to our database schema, made over time. - Are uniquely named. - Are usually stored as local files in our project repo, e.g. a migrations/ folder. - There should be a one-to-one mapping between the changes made to our database, and the migration files that exist in our migrations/ folder. - Our migrations files set up the tables for our database. - All changes made to our db should exist physically as part of migration files in our repository. Upgrades and rollbacks: - Migrations stack