In theory this solution supports all databases supported by the Liquibase library, such as PostgreSQL, Oracle, Microsoft SQL Server, MySQL, H2, Apache Derby, HSQLDB (HyperSQL), DB2, Firebird, MariaDB, Sybase, SQLite
, but that's not tested yet.
-
Add the
jitpack
repository in yourpom.xml
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories>
-
Add the dependency
<dependency> <groupId>com.github.0x100</groupId> <artifactId>liquibase-backup-spring-boot-starter</artifactId> <version>master-SNAPSHOT</version> </dependency>
-
Add the
jitpack
repository in your rootbuild.gradle
at the end of repositories:allprojects { repositories { // ... maven { url 'https://jitpack.io' } } }
-
Add the dependency
dependencies { implementation 'com.github.0x100:liquibase-backup-spring-boot-starter:master-SNAPSHOT' }
Configure SMTP and backup params in your application.yaml
(or application.properties
) file.
-
sample
YAML
-config:spring: mail: host: smtp.gmail.com port: 587 username: [email protected] password: password backup: enabled: true format: sql # or `xml` tables: # optional property - users - tasks - comments schedule: '0 0 3 ? * *' #cron schedule expression receiverEmail: [email protected] deleteFileAfterSend: true # optional property
-
sample
properties
-config:spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username[email protected] spring.mail.password=password backup.enabled=true # or `xml` backup.format=sql # optional property backup.tables=users,tasks,comments #cron schedule expression backup.schedule='0 0 3 ? * *' backup.receiverEmail[email protected] # optional property backup.deleteFileAfterSend=true
The
format
property is optional, can takesql
orxml
values. Default format issql
.The
tables
property is optional. If is not set all tables will backed up.The
deleteFileAfterSend
property is optional. This option determines whether will a generated changeset file deleted or not after sending its via email. Default value istrue
.
If you did everything correctly at your email at the scheduled time will be sent a backup file.
Fork the repository, make changes, write a test for your code, send me a pull request. I will review your changes and apply them to the master branch shortly, provided they don't violate quality standards. To avoid frustration, before sending a pull request please run the Maven build:
$ mvnw clean package
Good luck and have fun!