O'Reilly logo

The Node Craftsman Book by Manuel Kiessling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing automatic database migrations

Let's take the final step in automation by setting up database migrations. A migration is a change to the database structure of our application. For example, if we change our code and it now expects a new field in one of our tables, the migration would be the code that alters the table structure and adds the missing field. Making these migrations part of our code base allows us to automate this – when the tests or the application is started, all migrations that are not yet applied to the database are applied automatically; we no longer need to ensure manually that our code and our database structures are in sync.

The Node.js module that takes care of this for us is db-migrate. We already installed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required