apache / apache/gravitino

[FEATURE] Add SchemaTool CLI for DB Init/Validation/Info/Upgrade

Open
#6,998 2 comments 0 reactions 1 assignee Claimed by @Abyss-lord View on GitHub
feature
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 16h
Merged PRs (30d)
298

Description

### Describe the feature

Add SchemaTool, SchemaTool is designed to replace the traditional `source` script import method by providing a unified CLI that implements the following core features:

- Database Initialization: Automatically detect MySQL or PostgreSQL and execute the corresponding versioned initialization SQL.
- Integrity Validation: Compare the server version with the schema version and verify key tables and column definitions.
- Storage Inspection: Output current database connection details, warehouse path, and version status.
- Smooth Version Upgrades: Load and execute upgrade scripts sequentially based on the specified version range.

### Motivation

Currently, Gravitino’s initialization process depends on launching the MySQL client and running the source command to load SQL scripts. This approach has two main drawbacks:

- **Lack of elegance**: It requires manually entering the MySQL console, which is cumbersome and error‑prone.
- **No integrity checks**: After initialization, there is no automated verification of database objects, which can lead to inconsistencies between environments.

### Describe the solution

To address these issues, we need to design a new Schema tool (“SchemaTool”) that provides a standardized CLI for database initialization, integrity validation, storage inspection, and version upgrades.

### Additional context

design code:https://docs.google.com/document/d/1D7rUBNIATN1JoBXBlrkwK8ogC6kwzI-Xe1BJoKeFxLc/edit?usp=sharing

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.