lecaillon / Evolve

Database migration tool for .NET and .NET Core projects. Inspired by Flyway.
https://evolve-db.netlify.com
MIT License
849 stars 111 forks source link

Sort repeatables scripts with dependencies #287

Open wonolivier opened 2 years ago

wonolivier commented 2 years ago

Enables by default a new but it is possible to specify dependencies for each repeatable script file.

A slight refactor to the parsing of evolve file options has been necessary to permit options on several lines : -- evolve-tx-off -- evolve-repeatable-deps=XXX

Legacy behaviour is still supported : -- evolve-tx-off evolve-repeatable-deps=XXX

The "evolve-repeatable-deps" option must be declared with an equal sign then the file dependencies, separated by pipes : -- evolve-repeatable-deps=PROC_A|PROC_B|PROC_C

Spaces can be used to add spacing : -- evolve-repeatable-deps = PROC_A | PROC_B | PROC_C

Dependencies are repeatable script descriptions with underscores (_) instead of spaces.

This modification has been made to make RetryRepeatableMigrationsUntilNoErrorNew obsolete : if dependencies are correctly managed, script order should always be right.

Circular dependencies will make the migration fail before migrating the repeatables.