freesinger opened a new issue, #10843:
URL: https://github.com/apache/gravitino/issues/10843

   ### Describe the feature
   
   When Gravitino uses an external relational database backend (e.g., 
MySQL/PostgreSQL) for the relational entity store, allow the server to 
automatically initialize the required schema/tables on startup (opt-in).
   
   ### Motivation
   
   Today, operators must manually run schema/upgrade SQL scripts. In dev/test 
environments it is easy to hit missing-table errors after upgrading or starting 
the server against a fresh database (schema not initialized). Auto-creating the 
schema (opt-in) can significantly improve the developer/test experience and 
reduce manual setup steps.
   
   ### Describe the solution
   
   Introduce a new configuration property:
   
   - `gravitino.entity.store.relational.autoCreateSchema` (default: `false`)
   
   When enabled, and the JDBC backend is **non-embedded**, the server checks 
whether the schema exists; if not, it executes the current schema 
initialization script under:
   
   - 
`${GRAVITINO_HOME}/scripts/{mysql,postgresql}/schema-${CURRENT_SCRIPT_VERSION}-*.sql`
   
   Safety / constraints:
   
   - Embedded H2 behavior remains unchanged.
   - Unsupported JDBC types should be skipped with a warning.
   - If the schema script is missing, skip with a warning (no startup failure).
   
   ### Additional context
   
   - Related PR (implementation): https://github.com/apache/gravitino/pull/10819
   - Suggested test:
     - `./gradlew :core:test`
     - Start server with relational store backed by MySQL/PostgreSQL and 
`gravitino.entity.store.relational.autoCreateSchema=true`, ensure tables are 
created and server starts without missing-table errors.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to