Coder Social home page Coder Social logo

db_flyway_sample's Introduction

db_flyway_sample

This is an easy example how to create database migrations with Flyway

Please note that more information is given in the related blog articles on the topic: Managing Database Migrations and Execute Migrations using Maven

It is based on PostgreSQL database and should run right away after checking it out, if your postgres-server is up and running. You might need to add password to the create- and drop-scripts depending on your database configuration for the postgres-user. Of course you can also easily switch the example to make use of another database by changing JDBC imports and URL.

As it is not possible to create a new database with Flyway this needs to be done outside of Flyway. The same is true for creating the database user that is used. To do this there are two convenience scripts:

  • createDatabaseAndUser.sh
  • dropDatabaseAndUser.sh

Execution using Maven

To execute the example just execute the create-script and then you can execute Flyway using Maven. Please take a look at the POM-file to check the Flyway configuration.

mvn clean compile flyway:migrate

Execution using the Command Line Tool

Install the Flyway Command Line Tool according to these instructions

Then execute the following command from the command line. The configuration file flyway.conf contains all the needed configuration for execution from the command line. The good thing is that Flyway already comes with JDBC drivers for a good amount of database systems including PostgreSQL. Thus there is no need to install anything in addition here.

flyway migrate

db_flyway_sample's People

Contributors

thomasjaspers avatar fabriziofornari avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.