Skip to content

How to use new Migration Strategy (Branches Support)

ulisespulido edited this page Dec 1, 2011 · 2 revisions

Overview

Autopatch 1.3 introduces a new way strategy for patching, even though the ordering system for patches is still used, now you will be able to apply patches from different git branches.

How it works

This strategy works by looking at the patches that have not been run in the patches table and apply them if needed, so if for instance you created patch0005.sql in one branch and another developer created patch0004.sql in another one and then you merge them, autopach will look at the database to see if patch0004.sql was applied and since it has not been run, it will run maintaining your database up to date with the schema.

Be aware that if both of the developers created patch0005.sql with different sentences and you merge the file, since patch0005.sql was already run it will not run again, so you need to coordinate very well with other developers so things like this does not happen, each developer should create their patches with different numbers.

How to use it

To use it you need to update the migration.properties file and add the following line or replace it if exists:

migration.strategy=com.tacitknowledge.util.migration.MissingPatchMigrationRunnerStrategy