你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

Migrations - Introduction

2021/11/18 6:45:59

Add a column called completed with data type boolean to our existing Todo model

  • We want to modify a data schema that already exists
  • Data migrations: deal with how we manage modifications to our data schema over time.

Managing changes to the schema

  • Mistakes to our database schema are very expensive to make. The entire app can go down.
  • When we make a mistake to our data schema, we want to quickly roll back changes.
  • We want to test changes before we make them.

Changing data schema

  • Migrations deals with how we manage modifications to our data schema, over time.
  • 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
  • A migration is a file that keep track of changes to our database schema (structure of our database).
    • Offers version control on our schema
    • Think of them as git commits.

Upgrades and rollback

  • Migrations stack together in order to form the latest version of our database schema
  • We can upgrade our database schema by applying migrations
  • We can roll back our database schema to a former version by reverting migrations that we applied.