👀 Introduction toggle

Run an SQL Review Workflow in a Project

Create a project

Developers manage their databases within the Bytebase Project. Therefore, before dealing with the sample databases, you need to transfer them into a project first.

Click Projects > New Project to create a project called "Employee".

_

Choose Standard. The "Employee" project is created successfully and you are on its detail page.

_

Choose Transfer DB to transfer the two databases synced from the connected instances. You can find them in the default project since they have not been transferred into any specific project yet.

_

_

Now you are ready to manage these two "employee" databases in your project.

Add your teammates

!

Remember to add your teammates to the workspace before you try to add them to a specific project.

On the detail page of your created project, click Settings to add project members. In the below example, we add a project member "Adela".

_

Alter the database schema

Now that everything is prepared, it's time to try the schema change workflow. The task is to add a column named "nickname" to the "employee" table. We will create a single pipeline to propagate the change from the Test instance to the Prod instance. By default, no manual approval is required on the Test environment, so developers can run SQLs without DBAs' approval. Bytebase supports both UI and GitOps workflows to accomplish the task. This demo uses the UI workflow.

Create a SQL issue

The whole workflow is encapsulated in a SQL issue.

Open the "Employee" project. Click Alter Schema.

_

Then a dialog box will pop up.

_

You need to choose Alter multiple databases to create a pipeline propagating changes across multiple databases.

_

An issue creation page appears now.

_

Fill in the required title, SQL statement, and an optional description.

_

Click Apply to other stages. For demo purposes, select yourself as the assignee, then click Create.

_

The SQL Advisor kicks off immediately and checks your SQL statements against various rules automatically.

_

The Test environment doesn't require manual approval, thus the SQL will be applied automatically after passing those advisor checks. Then you are waiting for approval for the Prod environment.

Review the SQL issue

Click Approve if everything is OK and the change will be applied to the Prod environment.

_

_

Now that we have applied the same SQL change to both the Test and Prod databases, we can click Resolve issue to finish the workflow.

_

_