Never accidentally reapply a past migration again! We’ve removed another barrier to using PlanetScale branches with the framework or migration tool of your choice. Now, you can automatically persist schema changes in your migration table across database branches.
Many frameworks and migration tools keep track of database schema changes in a migration table that includes data about what migrations have been applied and in what order. Without that migrations table data, many tools will incorrectly try to reapply previous migrations, which would throw errors on migration. The migrations table is the missing link for the "how" we got to the current schema by persisting "what" schema migrations were applied.
In PlanetScale, you can now turn on the ability to automatically copy migration data from these tables any time you open a deploy request or make a new database branch. There are built-in options for Rails, Phoenix, Django, .NET, Prisma, Sequelize, or you can specify the name of your framework or migration tools’ migration table name.
You may ask yourself, “How does this fit into my existing workflow?” Good question! Here’s an example workflow from PlanetScale Software Engineer, Iheanyi Ekechukwu, walking through doing a schema migration with Prisma in a TypeScript application:
Give it a try, and let us know what you think!