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

How to generate db script based on model #710

Open
liudianpeng opened this issue Mar 23, 2021 · 3 comments
Open

How to generate db script based on model #710

liudianpeng opened this issue Mar 23, 2021 · 3 comments

Comments

@liudianpeng
Copy link

How to generate db script based on model
Create table

@raphaelbauer
Copy link
Contributor

You could either use something like JPA or ebean (https://github.com/ninjaframework/ninja-ebean) to that end.

@raphaelbauer
Copy link
Contributor

Or maybe I got it wrong and you mean the DDL? Then you could use JPA/Hibernate which support that.

But to be honest - I always do this via flyway manually. It's much better and you'll need migrations anyway in reality.

@xabolcs
Copy link

xabolcs commented Dec 31, 2022

(Sorry for necroposting.)

If you choose Ebean, then it could help you to create the whole database (CREATE ALL) with ebean-ddl-generator.
Please note that since Ebean 12.7.1 (see ebean-orm/ebean#2162) it's not included in ebean but in ebean-test only.

Ebean could also help with migrations: not just generating them but also running them:

Ebean can generate the migrations for us by performing a diff on the model and then generating database platform specific DDL for the change.

Ebean can also run the migrations (similar to FlywayDb). It is recommended to use Ebean's built in migration runner rather than FlywayDb or LiquiBase.

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

3 participants