H2-Snapshots

Open source making snapshots of H2 Database

License

License

Categories

Categories

H2 Data Databases
GroupId

GroupId

com.afrunt.h2s
ArtifactId

ArtifactId

h2-snapshots
Last Version

Last Version

0.4
Release Date

Release Date

Type

Type

jar
Description

Description

H2-Snapshots
Open source making snapshots of H2 Database
Project URL

Project URL

https://github.com/afrunt/h2-snapshots
Source Code Management

Source Code Management

http://github.com/afrunt/h2-snapshots/tree/master

Download h2-snapshots

How to add to project

<!-- https://jarcasting.com/artifacts/com.afrunt.h2s/h2-snapshots/ -->
<dependency>
    <groupId>com.afrunt.h2s</groupId>
    <artifactId>h2-snapshots</artifactId>
    <version>0.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.afrunt.h2s/h2-snapshots/
implementation 'com.afrunt.h2s:h2-snapshots:0.4'
// https://jarcasting.com/artifacts/com.afrunt.h2s/h2-snapshots/
implementation ("com.afrunt.h2s:h2-snapshots:0.4")
'com.afrunt.h2s:h2-snapshots:jar:0.4'
<dependency org="com.afrunt.h2s" name="h2-snapshots" rev="0.4">
  <artifact name="h2-snapshots" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.afrunt.h2s', module='h2-snapshots', version='0.4')
)
libraryDependencies += "com.afrunt.h2s" % "h2-snapshots" % "0.4"
[com.afrunt.h2s/h2-snapshots "0.4"]

Dependencies

compile (2)

Group / Artifact Type Version
org.slf4j : slf4j-api Optional jar
com.h2database : h2 Optional jar

test (7)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar
org.assertj : assertj-core jar
com.zaxxer : HikariCP jar
org.slf4j : slf4j-simple jar
org.mockito : mockito-core jar
org.mockito : mockito-junit-jupiter jar
org.springframework : spring-jdbc jar

Project Modules

There are no modules declared in this project.

Build Status

Java library that helps you to create simple H2 Database snapshots

Add H2-Snaphosts to your project. For maven projects just add this dependency:

<dependency>
    <groupId>com.afrunt.h2s</groupId>
    <artifactId>h2-snapshots</artifactId>
    <version>0.4</version>
</dependency>

Usage

Basically, you need to create the instance of the H2Snapshot class in order to create the snapshot of the current state.

import com.afrunt.h2s.H2Snapshot;
import com.sql.DataSource;

// ...
final H2Snapshot initialStateSnapshot = new H2Snapshot(dataSource);
// ...

To move database to the previous state, just invoke the apply(...) method like shown below

import com.afrunt.h2s.H2Snapshot;
import com.sql.DataSource;

// Remember the previous state
final H2Snapshot initialStateSnapshot = new H2Snapshot(dataSource);

// ...
// Apply previously created snapshot to db
initialStateSnapshot.apply(dataSource);
// ...

Versions

Version
0.4
0.3
0.2
0.1
0.0.1-dev