oasp / oasp4j

The Open Application Standard Platform for Java
Apache License 2.0
60 stars 303 forks source link

Db integration postgre #509

Closed kiran-vadla closed 7 years ago

kiran-vadla commented 8 years ago

Please review this pull request for OASP4J - DBIntegration of PostGres 9.5.4.

oasp-ci commented 8 years ago

Can one of the admins verify this patch?

kiran-vadla commented 7 years ago

Attached is the updated guide.

Thanks, Kiran. DBIntegration - PostGreSQL - Guide.docx

anmaso commented 7 years ago

Hi,

I'm trying to make this work with Postgre using docker but I think there are some steps missing on the documentation. Also I think we can document this process with docker as it is very easy to work with different versions of different databases)

  1. Start by having docker installed (or docker-toolbox if you are in windows/mac)

  2. Start a Postgre server (version 9.5.4) docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres:9.5.4 We can access this postgre server on our docker machine, so in linux it will be @localhost:5432 but using docker-machine (in my case) it is on 192.168.99.100:5432

  3. Access postgress with sqldb docker run -it --rm --link postgres:postgres postgres psql -h postgres -U postgres

  4. Create a database create database mydb;

  5. Create an schema create schema oasp4j

  6. Execute the script on the wiki page: https://github.com/oasp-forge/oasp4j-wiki/wiki/DB-Integration-PostGres-Server-9.5.4

  7. modify the profile on app.properties of the restaurant app to use postgre profile spring.profiles.active=postgre

  8. configure the proper IP for the postgre server on application-postgre.properties spring.datasource.url=jdbc:postgresql://192.168.99.100:5432/oasp4j?currentSchema=oasp4j

  9. Runing the sample application I see this on the log files

[L: org.flywaydb.core.internal.command.DbMigrate] - [M: Current version of schema "oasp4j": << Empty Schema >>] [L: org.flywaydb.core.internal.command.DbMigrate] - [M: Schema "oasp4j" is up to date. No migration necessary.]

so... I don't know the reason it is not running the migration files and why is it thinking that oasp4j is up to date....

anmaso commented 7 years ago

Also I had to add to the application-postgres.properties the following:

flyway.schemas=oasp4j

kiran-vadla commented 7 years ago

@anmaso , To install Docker Toolbox, virtualisation has to be enabled in my system BIOS settings . I have raised a ticket with my local support team for enabling the same. This will take some time . Meanwhile , if you have some time , will you please try setting up 'DBIntegration code with PostGres' without using Docker and let me know if you face any issues.

Thanks, Kiran.

anmaso commented 7 years ago

I've found that was my mistake not renaming some of the sql files for postgre

Now I have the restaurant example running great on postgre in docker!

I will merge the changes as soon as I read through the changed files

kiran-vadla commented 7 years ago

@amarinso , closing this , as I have created a new pull request https://github.com/oasp/oasp4j/pull/526 under a branch on 'develop-2.3.0'