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

[WIP] NEW: DefaultDbMigration is configurable from properties #3152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rPraml
Copy link
Contributor

@rPraml rPraml commented Aug 9, 2023

This PR allows to configure the DbMigration completely from properties-files and it is a plugin now.
This means, ebean can automatically generate migration files. There is no programmatic code needed any more

TODO: Write some good documentation

Refactored DbMigration

Refactored DbMigration 2

Updated Ebean.properties for DbMigration
rPraml added a commit to FOCONIS/ebean that referenced this pull request Aug 10, 2023
@rob-bygrave
Copy link
Contributor

rob-bygrave commented Aug 15, 2023

Why?

Edit: As in what is the motivation? Why would someone want to run this as a plugin?

@rPraml
Copy link
Contributor Author

rPraml commented Aug 23, 2023

I think the motivation to configure evertything from properties is clear

Q: Why a plugin:
A: You need no code. You just need to add the dbmigration to the classpath, set up the correct properties and ebean will generate the migrations automatically at startup. (Similar to ddl-generation)

What I want
Generationg dbmigration should work the same way as ddl-generation for tests.
so, if it is on classpath (and enabled in ebean.properties) it should automatically generate migration scripts.

Current situation here
We are doing this on our build server and this is controlled by special maven profiles. So a certain CI task runs this profile, generates the DDL and also auto commits it on the current branch. (And as additional feature, it runs DDL tests against various platforms to detect syntactical errors)

BTW: Ebean does a very good job in detecting model changes and generating the migration automatically. With the help of the @DbMigration annotation, we can cover nearly all of the use cases. It is extemely rare, that we have to hand craft migration scripts.

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

Successfully merging this pull request may close these issues.

None yet

2 participants