项目作者: stefanwalther

项目描述 :
REST interface for flyway (https://flywaydb.org/).
高级语言: JavaScript
项目地址: git://github.com/stefanwalther/flyway-rest.git
创建时间: 2016-10-27T06:31:01Z
项目社区:https://github.com/stefanwalther/flyway-rest

开源协议:MIT License

下载


flyway-rest

Build Status

REST interface for flyway.

Install

Run docker container

  1. docker pull flyway-rest

Run the development environment:

  1. $ git clone https://github.com/stefanwalther/flyway-rest && cd flyway-rest
  2. $ docker-comose up --f=./docker/docker-compose.dev.yml up

Usage

End Points

All 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/

Parameters

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 (see cmd in 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, see error for more details.
    • ValidationError - A validation error occurred, see validationErrors for 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 of status equals Error or ValidationError.
  • validationErrors - Array of validation errors.

Examples

The examples use superagent, so install that first:

  1. $ npm install superagent --save

Clean

  1. import superagent from 'superagent'
  2. const url = 'http://localhost:9001';
  3. let args = {
  4. };
  5. superagent( url )
  6. .post( '/clean` )
  7. .send( 'args' )
  8. .end( (err, res) => {
  9. // Database has been cleaned
  10. });

Migrate

  1. import superagent from 'superagent';
  2. import fs from 'fs';
  3. // Create a list of file definitions
  4. const url = '';
  5. let args = {
  6. mode: 'sync',
  7. flyway_args: {
  8. url: 'jdbc:postgresql://server-name:5432/your-db',
  9. user: 'postgres',
  10. password: 'postgres'
  11. },
  12. files: fileDefs
  13. };
  14. superagent( url )
  15. .post( '/migrate' )
  16. .send( args )
  17. .end( ( err, res ) => {
  18. if (err) console.error( err );
  19. // DB has been migrated
  20. console.log( 'Migration result: ', res.body );
  21. });

Todos

  • 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

Author

Stefan Walther

License

MIT


This file was generated by verb-generate-readme, v0.6.0, on October 31, 2018.