You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorials/database-change-management-with-risk-adjusted-approval-flow.mdx
+15-26Lines changed: 15 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: 'Database Change with Risk-Based Approval Flow'
2
+
title: 'Database Change with Custom Approval Flow'
3
3
author: Adela
4
-
updated_at: 2023/06/01 16:15
4
+
updated_at: 2026/03/04 16:15
5
5
tags: Tutorial
6
6
integrations: General
7
7
category: 'UI-Driven Workflow'
@@ -13,14 +13,13 @@ import TerminalDockerRunVolume from '/snippets/install/terminal-docker-run-volum
13
13
14
14
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.
15
15
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**.
17
17
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.
19
19
20
20
## Feature included
21
21
22
22
- Custom approval
23
-
- Risk center
24
23
- Custom roles
25
24
26
25
## Prerequisites
@@ -74,24 +73,14 @@ This tutorial will walk you through how to create custom approval flows based on
## Step 4 - Configure a Custom Approval and Run a Schema Change
76
+
## Step 4 - Configure Custom Approval Rules and Run a Schema Change
78
77
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:
80
79
81
-
To learn the best practice, check out [Risks Best Practice](/tutorials/risks-best-practice/).
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**.
Rules are evaluated top to bottom - the first matching rule wins. You can drag to reorder them.
95
84
96
85
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**.
97
86
@@ -103,7 +92,7 @@ To learn the best practice, check out [Risks Best Practice](/tutorials/risks-bes
103
92
);
104
93
```
105
94
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.
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.
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.
135
124
136
125
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**.
137
126
@@ -143,10 +132,10 @@ What if there is other roles in the team, for example, a **Tester** . Bytebase h
143
132
);
144
133
```
145
134
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.
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/).
### Level 3: Manual rollout with custom approval (Enterprise)
103
103
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/).
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`.
0 commit comments