Skip to content

Commit d4540fd

Browse files
docs: more approval related tuts update (#1034)
* update approval flow tuts * update related tuts * update * Update docs/tutorials/database-change-management-with-risk-adjusted-approval-flow.mdx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 62f1a94 commit d4540fd

4 files changed

Lines changed: 18 additions & 29 deletions

docs/tutorials/database-change-management-with-risk-adjusted-approval-flow.mdx

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: 'Database Change with Risk-Based Approval Flow'
2+
title: 'Database Change with Custom Approval Flow'
33
author: Adela
4-
updated_at: 2023/06/01 16:15
4+
updated_at: 2026/03/04 16:15
55
tags: Tutorial
66
integrations: General
77
category: 'UI-Driven Workflow'
@@ -13,14 +13,13 @@ import TerminalDockerRunVolume from '/snippets/install/terminal-docker-run-volum
1313

1414
Bytebase provides a basic yet configurable rollout mechanism by default. This means that manual rollout is skipped for **Test** environments and required for **Prod** environments.
1515

16-
However, for more complicated enterprise-level cases, users may need different approval flows to handle database changes according to different potential risks. For example, DDL in Prod environments is considered high risk, while DML in Test environments is low risk. Additionally, users may need to involve roles other than **DBA/Developer/Project Leader**, such as **Testers**.
16+
However, for more complicated enterprise-level cases, users may need different approval flows to handle database changes according to different conditions. For example, DDL that drops tables should require multi-level approval, while creating a new table may only need DBA review. Additionally, users may need to involve roles other than **DBA/Developer/Project Leader**, such as **Testers**.
1717

18-
This tutorial will walk you through how to create custom approval flows based on self-defined risk rules and how to add new roles to be involved.
18+
This tutorial will walk you through how to create custom approval flows with condition-based rules and how to add new roles to be involved.
1919

2020
## Feature included
2121

2222
- Custom approval
23-
- Risk center
2423
- Custom roles
2524

2625
## Prerequisites
@@ -74,24 +73,14 @@ This tutorial will walk you through how to create custom approval flows based on
7473

7574
![bb-issue-no-approval-flow](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-issue-no-approval-flow.webp)
7675

77-
## Step 4 - Configure a Custom Approval and Run a Schema Change
76+
## Step 4 - Configure Custom Approval Rules and Run a Schema Change
7877

79-
<Tip>
78+
1. Login as **Admin**. Click **CI/CD > Custom Approval** on the left bar. Under the **Change Database** section, click **Add Rule** to create approval rules with conditions:
8079

81-
To learn the best practice, check out [Risks Best Practice](/tutorials/risks-best-practice/).
80+
- Rule 1: Title: `DDL ALTER in Prod`; Condition: `statement.sql_type == "ALTER_TABLE" && resource.environment_id == "prod"`; Approval Flow: `Project Owner -> DBA`
81+
- Rule 2: Title: `DDL CREATE in Prod`; Condition: `statement.sql_type == "CREATE_TABLE" && resource.environment_id == "prod"`; Approval Flow: `DBA`
8282

83-
</Tip>
84-
85-
1. Login as **Admin**. Click **CI/CD > Custom Approval** on the left bar. Choose `Project Owner → DBA` for **DDL** > **High Risk** and `DBA` for **DDL** > **Moderate Risk**.
86-
87-
![bb-custom-approval](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-custom-approval.webp)
88-
89-
1. Either click **the related risk rules** or **CI/CD > Risks** on the left bar. Add two new rules
90-
91-
- Name: `DDL ALTER`; Risk Level: `High`; Type: `DDL`; Condition: `sql_type == 'ALTER_TABLE'`
92-
- Name: `DDL CREATE`; Risk Level: `Moderate`; Type: `DDL`; Condition: `sql_type == 'CREATE_TABLE'`
93-
94-
![bb-risks](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-risks.webp)
83+
Rules are evaluated top to bottom - the first matching rule wins. You can drag to reorder them.
9584

9685
1. Logout and login as **Developer**. Go into the project, select both databases and click **Edit Schema**. Paste the same SQL as before and click **Create**.
9786

@@ -103,7 +92,7 @@ To learn the best practice, check out [Risks Best Practice](/tutorials/risks-bes
10392
);
10493
```
10594

106-
1. This time, the issue is detected as **Moderate** risk, so it will be reviewed by **DBA** workflow.
95+
1. This time, the CREATE TABLE statement matches the second rule, so it will be reviewed by the **DBA** approval flow.
10796

10897
![bb-issue-moderate](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-issue-moderate.webp)
10998

@@ -113,7 +102,7 @@ To learn the best practice, check out [Risks Best Practice](/tutorials/risks-bes
113102
ALTER TABLE employee ADD COLUMN age INT NOT NULL;
114103
```
115104

116-
1. This time, the issue is detected as **High** risk, so it will be reviewed by **Project Owner -> DBA** workflow.
105+
1. This time, the ALTER TABLE statement matches the first rule, so it will be reviewed by the **Project Owner -> DBA** approval flow.
117106

118107
![bb-issue-high](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-issue-high.webp)
119108

@@ -125,13 +114,13 @@ What if there is other roles in the team, for example, a **Tester** . Bytebase h
125114

126115
![bb-roles-tester](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-roles-tester.webp)
127116

128-
1. Click **CI/CD > Custom Approval**, and click **Approval Flows** tab. Click **Create** and fill in the form like this.
117+
1. Click **CI/CD > Custom Approval**. Under the **Change Database** section, click **Add Rule** and create a new approval flow with `Tester -> DBA` as the approval nodes.
129118

130119
![bb-new-approval-flow](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-new-approval-flow.webp)
131120

132121
1. Create a new user with the role **Tester**.
133122

134-
1. Go to **CI/CD > Custom Approval**, and select `Tester->DBA` as the Moderate Risk approval flow.
123+
1. Go to **CI/CD > Custom Approval**, and edit the CREATE TABLE rule to use the `Tester -> DBA` approval flow instead.
135124

136125
1. Logout and login as **Developer**. Go into the project, select both databases and click **Edit Schema**. Paste the same SQL as before and click **Create**.
137126

@@ -143,10 +132,10 @@ What if there is other roles in the team, for example, a **Tester** . Bytebase h
143132
);
144133
```
145134

146-
1. This time, the issue is detected as **Moderate** risk, so it will be reviewed by **Tester -> DBA** workflow.
135+
1. This time, the CREATE TABLE statement matches the rule and will be reviewed by the **Tester -> DBA** approval flow.
147136

148137
![bb-issue-tester-dba](/content/docs/tutorials/database-change-management-with-risk-adjusted-approval-flow/bb-issue-tester-dba.webp)
149138

150139
## Summary
151140

152-
Now you have tried database change with risk-adjusted custom approval flow, and also create your own custom roles as well. Bytebase provides more enterprise-level features regarding data security and data access control. If you're interested in that, follow [Just-in-Time Database Access](/tutorials/just-in-time-database-access-part1/).
141+
Now you have tried database change with condition-based custom approval flow, and also created your own custom roles. Bytebase provides more enterprise-level features regarding data security and data access control. If you're interested in that, follow [Just-in-Time Database Access](/tutorials/just-in-time-database-access-part1/).

docs/tutorials/deploy-schema-migration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Bytebase offers **Community**, **Pro**, and **Enterprise** [plans](https://www.b
101101

102102
### Level 3: Manual rollout with custom approval (Enterprise)
103103

104-
If you want the approval flow to be dynamic based on context, such as the type of SQL statements, follow this tutorial: [Database Change with Risk-Based Approval Flow](/tutorials/database-change-management-with-risk-adjusted-approval-flow/).
104+
If you want the approval flow to be dynamic based on context, such as the type of SQL statements, follow this tutorial: [Database Change with Custom Approval Flow](/tutorials/database-change-management-with-risk-adjusted-approval-flow/).
105105

106106
### Summary
107107

docs/tutorials/first-schema-change.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ You've completed your first schema change. Continue with:
7777

7878
- [Move Schema Changes from Test to Prod](/tutorials/how-to-move-schema-change-from-test-to-prod/) - for environment transitions
7979
- [Deploy with Rollout Policy](/tutorials/deploy-schema-migration/) - for manual rollouts
80-
- [Risk-Based Approval Flow](/tutorials/database-change-management-with-risk-adjusted-approval-flow/) - for adding approvers
80+
- [Custom Approval Flow](/tutorials/database-change-management-with-risk-adjusted-approval-flow/) - for adding approvers

docs/tutorials/just-in-time-database-access-amazon-aurora.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ In Bytebase **Enterprise Plan**, you can request a JIT access to the production
193193

194194
![bb-assign-license](/content/docs/tutorials/just-in-time-database-access-amazon-aurora/bb-assign-license.webp)
195195

196-
To elaborate on custom approval, take a look at the following diagram. By defining a custom approval flow along with risk policy, Bytebase will automatically trigger the approval flow when the corresponding risk level is met. In our case, we define a high risk policy for `Request Querier Role` which triggers when the environment is `Prod`.
196+
To elaborate on custom approval, take a look at the following diagram. By defining a custom approval flow with CEL conditions, Bytebase will automatically trigger the approval flow when the condition is met. In our case, we define an approval rule for `Request Role` which triggers when the environment is `Prod`.
197197

198198
![request-query](/content/docs/tutorials/just-in-time-database-access-amazon-aurora/request-query.webp)
199199

0 commit comments

Comments
 (0)