REST interface for flyway.
docker pull flyway-rest$ git clone https://github.com/stefanwalther/flyway-rest && cd flyway-rest
$ docker-comose up --f=./docker/docker-compose.dev.yml upAll endpoints share the same parameters. All endpoints are also described in an OpenAPI definition file (swagger), which can be accessed at http://{server-name}:{port}/api-docs/
Post parameters
mode- The execution mode. The following values are possible:get-cmd- Does not execute the command, just validates and processes the request and returns the generated command (seecmdin the result).sync- Executes the command synchronously and returns the result
flyway_args- Flyway arguments as used in "Flyway Command-line"files-
Result
status- Status of the operation. Can have the following values:OK- Everything OK.Error- An error occurred, seeerrorfor more details.ValidationError- A validation error occurred, seevalidationErrorsfor more details.
mode- The execution mode as passed in.cmd- The CLI command as generated, based on the input arguments.errorMsg- Error message in case ofstatusequalsErrororValidationError.validationErrors- Array of validation errors.
The examples use superagent, so install that first:
$ npm install superagent --saveimport superagent from 'superagent'
const url = 'http://localhost:9001';
let args = {
};
superagent( url )
.post( '/clean` )
.send( 'args' )
.end( (err, res) => {
// Database has been cleaned
});
import superagent from 'superagent';
import fs from 'fs';
// Create a list of file definitions
const url = '';
let args = {
mode: 'sync',
flyway_args: {
url: 'jdbc:postgresql://server-name:5432/your-db',
user: 'postgres',
password: 'postgres'
},
files: fileDefs
};
superagent( url )
.post( '/migrate' )
.send( args )
.end( ( err, res ) => {
if (err) console.error( err );
// DB has been migrated
console.log( 'Migration result: ', res.body );
});
- Clear separation of concerns:
- container flyway-rest-integration should not execute unit tests
- Container optimization
- No need to do the full install on flyway-rest-integration; could use only a subset of devDependencies
Stefan Walther
MIT
This file was generated by verb-generate-readme, v0.6.0, on October 31, 2018.