Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental names for the Juplo-generated SQL schemas files to be consumed by Flyway #2

Open
balteo opened this issue Jun 23, 2014 · 3 comments

Comments

@balteo
Copy link

balteo commented Jun 23, 2014

I think Juplo hibernate4-maven-plugin could be used a part of a continuous delivery toolchain together with DB migration tools such as Flyway.

Instead of relying on Hibernate's out-of-the-box hbm2ddl feature, one could use Juplo plugin in order to generate the SQL migration scripts that would later be applied by Flyway.

However, as of now and for the above to work, it seems one has to rename the Juplo-generated scripts manually so that they follow Flyway's migration naming requirements i.e.

A version must have the following structure:

  • One or more numeric parts
  • Separated by a dot (.) or an underscore (_)
  • Underscores are replaced by dots at runtime
  • Leading zeroes are ignored in each part

Examples of valid versions:

  • 1
  • 001
  • 5.2
  • 5_2 (5.2 at runtime)
  • 1.2.3.4.5.6.7.8.9
  • 205.68
  • 20130115113556
  • 2013.1.15.11.35.56
  • 2013.01.15.11.35.56

See here for documentation.

Therefore, it would be great if the Juplo plugin could somehow - and upon activation/configuration - manage different versions/names of its outputFile parameter that would follow the above specification/requirements (or a subset thereof).

One would eventually end up with N generated files that would could easily be consumed by Flyway for its DB migrations.

@kai-moritz
Copy link
Collaborator

I am not sure, if I understood right, what you would like to do.
Would it be sufficient, if hibernate4-maven-plugin would automatically add the version-string of the project to the configured name of the outputFile?

@balteo
Copy link
Author

balteo commented Jun 24, 2014

@juplo This would be great yes as long as they meet the above version requirements (see quote above). And also one should be able to have several files with incremental version numbers. These files could later be fed to Flyway for a DB migration. Do you see what I mean?

@kai-moritz
Copy link
Collaborator

Whether the version string meets the flyway-requirements, or not, would depend on you: you define the version of your project in the pom.xml of your project. The same would go for several versions of that file: if you would increase the version of your project in your pom.xml and do not delete the old files (with a "mvn clean"), you would end up with what your are looking for...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants