Skip to content

Commit 9716e11

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents b1b8bf9 + 2da2d8d commit 9716e11

File tree

90 files changed

+5488
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+5488
-77
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ body:
1515
attributes:
1616
label: "Checklist"
1717
options:
18-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
18+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/micro-migration/releases/latest)"
1919
required: true
20-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
20+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/micro-migration/issues) or [closed](https://github.com/xdev-software/micro-migration/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2121
required: true
2222
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2323
required: true

.github/ISSUE_TEMPLATE/enhancement.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
attributes:
1414
label: "Checklist"
1515
options:
16-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
16+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/micro-migration/issues) or [closed](https://github.com/xdev-software/micro-migration/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1717
required: true
1818
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1919
required: true

.github/ISSUE_TEMPLATE/question.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/micro-migration/issues) or [closed](https://github.com/xdev-software/micro-migration/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true

.run/Run Demo.run.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## 3.0.1
2+
3+
* Fix for ExplicitMigrater without any scripts
4+
5+
## 3.0.0
6+
7+
* Added support for EclipseStore v2
8+
* Having an empty version for the first migration-script is now allowed
9+
10+
## 2.0.0
11+
_Major refactoring_
12+
* Consolidated all previous modules into a single one
13+
* Dropped support for MicroStream as EclipseStore is it's successor
14+
* Refactored and adjusted code accordingly
15+
* Slimed down dependencies
16+
* Minimal required Java version: 17
17+
18+
## 1.0.0
19+
* Added support for EclipseStore v1
20+
* Updated plenty of libraries
21+
22+
## 0.0.9
23+
* Added support for MicroStream v8
24+
25+
## 0.0.8
26+
* Access to the native embedded manager is now possible in the scripts (see ``VersionAgnosticMigrationEmbeddedStorageManager#getNativeStorageManager``)
27+
28+
## 0.0.7
29+
* A lot of refactoring of the module structure
30+
* A migration history is now available and automatically stored
31+
32+
## 0.0.6
33+
* Tried a new release-action...again.
34+
35+
## 0.0.5
36+
* Tried a new release-action.
37+
38+
## 0.0.4
39+
* Fixed setup. 0.0.3 was not working with the release setup.
40+
41+
## 0.0.3
42+
* Restructured the complete maven modules. Multiple MicroStream-Versions are now supported.
43+
* Added plenty of documentation
44+
45+
## 0.0.2
46+
* Updated MicroStream from v4 to v5.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ You should have the following things installed:
3434
* Ensure that the JDK/Java-Version is correct
3535

3636

37-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
37+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/micro-migration/release.yml?branch=master)](https://github.com/xdev-software/micro-migration/actions/workflows/release.yml)
3838

3939
Before releasing:
40-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
40+
* Consider doing a [test-deployment](https://github.com/xdev-software/micro-migration/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
4141
* Check the [changelog](CHANGELOG.md)
4242

4343
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

README.md

Lines changed: 116 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,122 @@
1-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
2-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
1+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/micro-migration?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/micro-migration)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/micro-migration/check-build.yml?branch=develop)](https://github.com/xdev-software/micro-migration/actions/workflows/check-build.yml?query=branch%3Adevelop)
3+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_micro-migration&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_micro-migration)
44

5-
# template-placeholder
5+
# <img src="assets/Logo.png" width="400" alt="XDEV MicroMigration Logo">
6+
Tiny java library to migrate [EclipseStore](https://github.com/eclipse-store/store) datastores.
7+
Applies migration scripts on the datastores to keep them up to date.
68

9+
## Intro
10+
When you think about default database setup, you probably imagine something like this:
11+
12+
![Imaginative system layout](./assets/MigrationSequence_1.png "Imaginative system layout")
13+
14+
Yet in reality most workflows involve different systems like test systems and production systems.
15+
In code this workflow is represented with version-control systems and different branches.
16+
17+
![Code workflow](./assets/MigrationSequence_2.png "Code workflow")
18+
19+
For this code workflow to behave correctly, for each system a separate datastore is needed.
20+
To keep these datastores to represent the correspondend data for the code is a hassle.
21+
22+
![Code workflow with datastore](./assets/MigrationSequence_3.png "Code workflow with datastore")
23+
24+
That's why migration frameworks like [Flyway](https://flywaydb.org) and [Liquibase](https://www.liquibase.org/) exist.
25+
Unfortunately both these frameworks are designed to support any type of SQL databases but no NoSQL databases like [EclipseStore](https://eclipsestore.io/). This led to the creation of this library.
26+
27+
This library delivers an easy concept to keep your EclipseStore datastore versioned with migration scripts written in plain java.
28+
It's easy to create code, that automatically brings a datastore with an older version to the version, suited to the current code.
29+
30+
![Migrate datastore to new version](./assets/MigrationSequence_4.png "Migrate datastore to new version")
31+
32+
## Approaches
33+
There are two possible usages with the Micro migration library:
34+
35+
The **first**, easier approach is to use the `MigrationEmbeddedStorageManager`.
36+
It can be used on a brand new datastore or introduced later, after a EclipseStore datastore is already in use.
37+
Only the storage manager (`MigrationEmbeddedStorageManager`) knows about the versioning.
38+
The rest of application does not know about the version and can have no regards about it.
39+
40+
### MigrationEmbeddedStorageManager
41+
Extensive examples can be found in its own [own module](./micro-migration-demo).
42+
A simple example where scripts need to be registered in the `ExplicitMigrater`:
43+
44+
```java
45+
public static void main(String[] args){
46+
ExplicitMigrater migrater = new ExplicitMigrater(new UpdateToV1_0());
47+
MigrationEmbeddedStorageManager storageManager = MigrationEmbeddedStorage.start(migrater);
48+
// Do some business logic
49+
storageManager.shutdown();
50+
}
51+
```
52+
53+
The update scripts can look like this:
54+
55+
```java
56+
public class UpdateToV1_0 implements MigrationScript<Object>
57+
{
58+
@Override
59+
public MigrationVersion getTargetVersion(){
60+
return new MigrationVersion(1);
61+
}
62+
63+
@Override
64+
public void migrate(Context<String, EmbeddedStorageManager> context){
65+
// Logic of the update
66+
context.getStorageManager().setRoot("Update 1.0");
67+
}
68+
}
69+
```
70+
71+
### MigrationManager
72+
Although the approach with the `MigrationEmbeddedStorageManager` is pretty easy to handle, it is intrusive in the way, that it replaces the root entry point of the EclipseStore datastore and inserts its own `VersionedRoot` as root. Some users might find this too entrusive.
73+
74+
That's why a second approach can be used, where the `MigrationManager` is used. This class is also used internally by the `MigrationEmbeddedStorageManager`.
75+
76+
```java
77+
public static void main(String[] args){
78+
ExplicitMigrater migrater = new ExplicitMigrater(new UpdateToV1_0());
79+
EmbeddedStorageManager storageManager = EmbeddedStorage.start();
80+
VersionedObject<Object> versionedRoot =(VersionedObject<Object>)storageManager.root();
81+
new MigrationManager(versionedRoot, migrater, storageManager).migrate(versionedBranch);
82+
// Do some business logic
83+
storageManager.shutdown();
84+
}
85+
```
86+
87+
## Migrater
88+
### ExplicitMigrater
89+
Scripts for the migrations must be registered in a `MicroMigrater`.
90+
The simplest way for this is to use the `ExplicitMigrater` and just put the scripts in the constructor.
91+
A downside of this method is that you need to register all scripts (new or old) manually in the constructor.
92+
93+
```java
94+
final ExplicitMigrater migrater = new ExplicitMigrater(
95+
new UpdateToV1_0(),
96+
new UpdateToV1_1()
97+
);
98+
```
99+
100+
### ReflectiveMigrater
101+
For a more convenient usage the `ReflectiveMigrater` was built.
102+
You simply instanciate a object of this class with the package name of your `MicroMigrationScript`s.
103+
The `ReflectiveMigrater` will search for any implementations of `MicroMigrationScript` in the given package.
104+
This way scripts can simply be placed in the same package and on startup of the application all scripts are loaded in.
105+
106+
```java
107+
final ReflectiveMigrater migrater = new ReflectiveMigrater("software.xdev.micromigration.examples.reflective.scripts");
108+
```
7109

8110
## Installation
9-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
111+
[Installation guide for the latest release](https://github.com/xdev-software/micro-migration/releases/latest#Installation)
112+
113+
### Compatibility
114+
115+
| Eclipse Store version | micro-migration version |
116+
|-------------------------------------------------------------------|-------------------------|
117+
| [EclipseStore](https://github.com/eclipse-store/store) 2+ | ``3+`` |
118+
| [EclipseStore](https://github.com/eclipse-store/store) 1+ | ``2.x`` |
119+
| [MicroStream](https://github.com/microstream-one/microstream) 5-8 | ``1.x`` |
10120

11121
## Support
12122
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
@@ -15,4 +125,4 @@ If you need support as soon as possible and you can't wait for any pull request,
15125
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
16126

17127
## Dependencies and Licenses
18-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
128+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/micro-migration/dependencies)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/micro-migration/security/advisories/new).

assets/Logo.png

26.4 KB
Loading

assets/Logo2.png

27.6 KB
Loading

0 commit comments

Comments
 (0)