Devskiller / jpa2ddl

JPA Schema Generator Plugin
Apache License 2.0
109 stars 33 forks source link

Migrations with date-based versioning are incorrectly sorted #21

Open bbucko opened 6 years ago

bbucko commented 6 years ago

Versioned migrations with date-based scheme (e.g. v20180101__initial.sql) are not executed in proper order during migrate goal.

jkubrynski commented 6 years ago

Thanks for the report. We definitely need to support date formats.

The problem is with the migration comment. Currently, we execute only files labeled as jpa2ddl (we're sure there are only schema changes here) and assume all others can contain data migrations. As invoking data migrations makes no sense (there is no data in the database set up by the plugin) we must have a pattern to distinguish it. Of course we can make it configurable, however, a good default is always welcome. Any suggestions here?

bbucko commented 6 years ago

So why not just execute data migrations?

jkubrynski commented 6 years ago

Unfortunately, data migration can be related to the existing data, that is not present in the database temporarily created by the plugin. That's why we need to separate it from the schema migrations