Generator-jhipster: Provide different database name for dev and prod

Created on 27 Dec 2018  路  5Comments  路  Source: jhipster/generator-jhipster

Overview of the feature request


Generate different database name for dev and prod in application-xxx.yml. For eg, suffix with dev database like myapp_dev in application-dev.yml and myapp_prod in application-prod.yml.

Motivation for or Use Case


Running the in app in prod mode in laptop is using the same dev database which I do not like to use.

If I want to use different database name for dev and prod, I change it and use. But next time I regenerate or upgrade, it is gone. Re-changing is not a big task but having different name in first place is even better.

This makes sure that same database is not used in both dev and prod, although same database platform (may) be used.

Related issues or PR
  • [ ] Checking this box is mandatory (this is just to show you read everything)
area wont-fix needs-discussion

Most helpful comment

-1 for me, let me explain why:

  • during development, with dev or prod profile, you are still in development, so you should use the same database / service, IMO
  • applying this change will mean we need to have docker-compose files for each profile, mysql-dev.yml, mysql-prod.yml, etc.
  • for users who don't use Docker, I don't think they will install a local database twice / or they'll have to create 2 different schemas for each profile, which is really annoying
  • to do what you want, you could create easily another profiles db1, db2, db3, then start your application with dev,db1, dev,db2, etc profile. That's the power of Spring Boot

All 5 comments

+1 this is the convention used by Ruby on Rails and it's quite useful.

-1 for me, let me explain why:

  • during development, with dev or prod profile, you are still in development, so you should use the same database / service, IMO
  • applying this change will mean we need to have docker-compose files for each profile, mysql-dev.yml, mysql-prod.yml, etc.
  • for users who don't use Docker, I don't think they will install a local database twice / or they'll have to create 2 different schemas for each profile, which is really annoying
  • to do what you want, you could create easily another profiles db1, db2, db3, then start your application with dev,db1, dev,db2, etc profile. That's the power of Spring Boot

Thanks for your opinions.

@pascalgrimaud during development, If I want to run app with prod profile I would like not to use db which I use in dev profile but this again is just a personal preference.

For docker files and creating 2 db is a bit more work but IMO it is worth if I want to have different db.
And for running with spring-boot profiles, it comes to my original issue that after regenerate/upgrade I have to at least modify a few place or run the command by providing custom profile each time.

For some including me, this would be a good thing to have in first place :)

I think we could implement this feature similarly to the way we do the "angularsuffix". So it will be a somewhat hidden feature but exposed by the JDL.

It's opened for long time and very few comments.
Not sure people are interested by this feature and I think you can use Spring Boot profile to do what you want.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pascalgrimaud picture pascalgrimaud  路  4Comments

marcelinobadin picture marcelinobadin  路  3Comments

DanielFran picture DanielFran  路  3Comments

Steven-Garcia picture Steven-Garcia  路  3Comments

chegola picture chegola  路  4Comments