jaxio / celerio-angular-quickstart

Generate an Angular 5 CRUD application from an existing database schema (we provide a sample one)
Apache License 2.0
479 stars 138 forks source link

Problem fix when migrating Quickstart to MySQL #56

Open nemasket opened 6 years ago

nemasket commented 6 years ago

I was following the guide in the readme for migrating the quickstart from H2 to own instance of MySQL. After changing the files listed and running steps, the server on port 4200 correctly listed the entities in my MySQL database, but the back end at port 8080 was still using the H2 database.

I traced this back to a hardcoded entry in a pack-angular file. There may be a better way to set the database, I simply changed it. The key is the jdbc.url. Here's the diff:

--- a/pack-angular/celerio/pack-angular/src/main/resources/application.yml.p.vm
+++ b/pack-angular/celerio/pack-angular/src/main/resources/application.yml.p.vm
@@ -31,7 +31,7 @@ spring:
             naming.physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

         database-platform: @hibernate.dialect@
-        database: H2
+        database: MySQL 
         show_sql: true
         properties:
             hibernate.cache.use_second_level_cache: false
@@ -54,4 +54,4 @@ spring:
 # profile used by Dockerfile... just for convenient demo
 #
 spring.profiles: demowithdocker
-spring.datasource.url: jdbc:h2:/db/angulardb;MVCC=TRUE;FILE_LOCK=NO
+spring.datasource.url: @jdbc.url@ 

With this change, the steps provided work as expected.