👀 Introduction toggle






SQL Advisor GitHub App

Bytebase also provides the GitHub App to let users integrate the SQL review into their GitHub PR workflow.

The App allows you to create the SQL review policy for your repositories and trigger the SQL check in the pull request.

!

The GitHub App is free to use, you don't need any subscription plan.

Install App and grant permissions

Install the app from GitHub marketplace. During installation, you need to select the target GitHub account and grant repository permissions.

app-grant-permissions

Configure SQL review policy

After installation, you will be redirected to the Bytebase hub website to create the SQL review policy.

Step 1 - Basic info

Specify the basic information, including display name, target repositories, and SQL review policy template.

app-policy-step1

Repository configuration:

  • Database dialect: for now, we support

    • MySQL dialect, vanilla MySQL, and other database engines adopting its dialect such as TiDB.
    • PostgreSQL dialect, vanilla PostgreSQL, and other database engines adopting its dialect such as CockroachDB.
  • SQL file path: the file path for the SQL files in the regex format. Only matched files will be checked in the pull request. We will subscribe all SQL files in the repository by default.

app-config-repo

Step 2 - Configure rules

You can customize the rule level and payload in step 2. You can follow this doc for details about the rule configuration.

app-policy-step2

Step 3 - Preview

Preview and confirm the SQL review policy.

SQL check in the pull request

If you create a pull request containing SQL file change, it will trigger the SQL check according to the SQL review policy.

The SQL review will run the check and comment on the pull request.

app-pr-comment

app-pr-check

You can also check the output messages on the files diff page.

app-pr-diff