Giter Club home page Giter Club logo

java_persistence_practice_flyway-2019-8-30-1-2-29-399's Introduction

Requirement

  • please forked this repo for practice
  • set up flyway environment
  • write database migration scripts for follow requirement changes (keep one migration script for per change log)

change logs

  1. create table employee with fields: id,name,age,vocation, the id should be auto increased
  2. create table user with fields: id,username,password,password_expired,role,createTime the createTime should be generated automatically. role can be a string here.
  3. add field employee_id in user
  4. change field name vocation to position in table employee to be more meaningful
  5. remove field password_expired
  6. create table role with fields: id,name
  7. change role to role_id in user table
  8. insert preset records for role with admin,company admin,user

Practice Output & Submit

  • submit your git repo url to field answer

Hint

  1. add flyway dependency in build.gradle
  2. add migration script under src/main/resource/db/migration
  3. the filename of migration script should match the PATTERN like this V1__xxxxxx.sql, V2__yyyyyy.sql
  4. run gradle bootRun to get script executed
  5. find word migration in log of spring boot
  6. check database structure in localhost:8080/h2-console to verify migration result

How to use H2

  • schema.sql will be loaded and init database when application is starting
  • navigate to web consolehttp://localhost:8080/h2-console
  • put jdbc:h2:file:./h2-db/h2;MODE=Oracle in JDBC URL field
  • we choose file as the h2 storage for migration practice

java_persistence_practice_flyway-2019-8-30-1-2-29-399's People

Contributors

linwenjun avatar

Watchers

 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.