Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Schema changes on application upgrade
Schema changes on application upgrade [message #1848742] Wed, 15 December 2021 19:56 Go to next message
Phillip Gaisford is currently offline Phillip GaisfordFriend
Messages: 1
Registered: December 2021
Junior Member
Having once deployed an application that uses JPA-based persistence, how are database schema changes best handled with subsequent versions of the application?
Re: Schema changes on application upgrade [message #1855609 is a reply to message #1848742] Sun, 23 October 2022 12:16 Go to previous message
Ulrich Cech is currently offline Ulrich CechFriend
Messages: 8
Registered: February 2018
Junior Member
The easiest way is to use Flyway.

1. Define a persistence-unit for a lokal H2 database
2. configure the persistence-unit to generate the schema and export it to a sql file
3. when you make changes to your entities, let the schema be cteated once more and compare the resulting file with the former/existing file
3a. extract the differences and create the Flyway migration files (eg. Alter table users add column age integer"
4. Let Flyway be the first action in your application (eg. use a Singleton-EJB with @Startup annotation) and call the flyway.migrate()
Finally:. your application is always and „automatically" at newest version
Previous Topic:Problem with circular references
Next Topic:L2 cache with OneToMany relationships
Goto Forum:
  


Current Time: Fri Oct 04 15:58:32 GMT 2024

Powered by FUDForum. Page generated in 0.02582 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top