Page 1 of 1

MySQL: Creating the Broadleaf DB Schema (initial)

Posted: Fri Jul 03, 2015 8:16 pm
by blondeMatrix
Hello All,

Evidentally Broadleaf doesn't automatically fully create the Broadleaf database schema when deployed and run for the first time. It seems that three vital SQL files are missing from the Broadleaf installation:

load_admin_menu.sql
load_admin_permissions.sql
load_admin_roles.sql

Moreover, it appears that Broadleaf will only run the necessary SQL DB schema creation files when run in 'development' mode. Is this correct?

Why are the above three SQL files not included in the Broadleaf demo distribution?

Thanks & regards,

Chris.

Re: MySQL: Creating the Broadleaf DB Schema (initial)

Posted: Sun Jul 05, 2015 8:27 pm
by kunner
Did you check runtime-properties?

It located under '/src/main/resources/'
and You can set your runtime.environment in your build.xml.
(both admin, site)

At each runtime-properties, you could setting "blPU.hibernate.hbm2ddl.auto".
If you want re-build your DB every time turn-on the system, set it "Create"(or Create-drop).
It would execute SQL statement too.

If you want reflect changed schema, you had better set "update".
But it never execute SQL statement.

For more information, see hibernate documents.
Wish I could help you.

Re: MySQL: Creating the Broadleaf DB Schema (initial)

Posted: Wed Jul 15, 2015 7:59 am
by blondeMatrix
Thanks for responding.

I simply wish to deploy to my web server, and have Broadleaf create ALL tables necessary to run the demo Heat Clinic application. Next, I intend to modify the products, categories and so forth, and thereby transition to a true 'production' shopping site.

How do you suggest I configure Broadleaf's runtime properties to accomplish this very typical scenario? Is it best to add the three abovementioned SQL files to the WAR, or manually import/run them prior to starting up Broadleaf for the first time?

Thanks,

Chris.

Re: MySQL: Creating the Broadleaf DB Schema (initial)

Posted: Mon Jul 27, 2015 4:45 am
by phillipuniverse
The reason Broadleaf creates those tables on startup is because of development.properties, blPU.hibernate.hbm2ddl.auto=create-drop. If you want Broadleaf to create the tables for you in other environments, you should set that property to create which will ensure that the tables still exist after the server shuts down.

You will want to change that value back to 'none' afterwards though since you only want to perform that operation once.