Skip to content

Commit a85a3cf

Browse files
docs: update rollback doc (#834)
* update rollback doc * update wording * update * update
1 parent 7d7f048 commit a85a3cf

15 files changed

+52
-41
lines changed

mintlify/change-database/rollback-data-changes.mdx

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ feature_name: 'ROLLBACK_DATA_CHANGES'
1010
horizontal
1111
/>
1212

13-
Bytebase allows taking **Prior Backup** before a data change is made. Bytebase stores the pre-snapshot of the affected rows, which allows you to revert that data change if needed.
13+
Bytebase provides **Prior Backup** functionality that captures a snapshot of data before changes are applied. This safety mechanism stores the original state of affected rows, enabling you to revert data changes with **1-Click** when necessary. You can perform **multi-task rollbacks** to efficiently revert multiple related changes across databases in one operation.
1414

1515
<Info>
1616

17-
The backup data is stored in your own database instance. Bytebase does not purge the backup data automatically.
18-
You can manually delete the data in `bbdataarchive` database/schema.
17+
Backup data is stored within your own database instance in a dedicated `bbdataarchive` location. Bytebase does not automatically purge this backup data, so you can manually clean up the `bbdataarchive` database or schema as needed.
1918

2019
</Info>
2120

@@ -30,73 +29,85 @@ You can manually delete the data in `bbdataarchive` database/schema.
3029

3130
## Supported Operations
3231

33-
We are working on enabling backup and 1-click rollback for more SQL statements.
32+
Bytebase continues to expand backup and rollback support for additional SQL statement types.
3433

3534
### Feasibility Conditions
3635

3736
Prior backup is feasible when meeting **all** of the following conditions:
3837

3938
- The SQL statement size is less than 2M.
40-
4139
- No mixed `UPDATE`/`DELETE` on the same table.
42-
4340
- No mixed DDL/DML.
4441

4542
1-click rollback is feasible when meeting **all** of the following conditions:
4643

4744
- For `UPDATE`, the changed table has primary key and primary key columns are not updated.
4845

49-
## Create backup
46+
## Enable Prior Backup
47+
48+
You can enable the **Prior Backup** option either before or after creating a database change issue.
49+
50+
![bb-issue-backup-on](/content/docs/change-database/rollback-data-changes/bb-issue-backup-on.webp)
5051

51-
You can toggle **Prior Backup** switch before or after creating the issue.
52+
<Note>
53+
If the Prior Backup switch appears disabled, navigate to the database page and click **Sync instance** to refresh the database metadata.
54+
</Note>
5255

53-
![bb-prior-bk-on](/content/docs/change-database/rollback-data-changes/bb-prior-bk-on.webp)
56+
## Perform 1-Click and Multi-Task Rollback
5457

55-
<Note>If the switch is disabled, go to the database page and click **Sync instance** first.</Note>
58+
1. After your database change has been successfully deployed, click the **Rollback available** link to initiate the rollback process.
5659

57-
## 1-click rollback
60+
![bb-issue-done-1](/content/docs/change-database/rollback-data-changes/bb-issue-done-1.webp)
5861

59-
1. Once the change has been rolled out. You can click the **Rollback** button to create the rollback issue.
62+
1. You may see multiple rollbackable changes available, depending on your deployment scenario.
6063

61-
![bb-prior-bk-rollback](/content/docs/change-database/rollback-data-changes/bb-prior-bk-rollback.webp)
64+
<Note>
65+
This could include a single change applied to multiple databases, multiple changes to one database, or a combination of both scenarios.
66+
</Note>
6267

63-
1. The rollback issue automatically populates the rollback statements.
68+
![bb-issue-done-2](/content/docs/change-database/rollback-data-changes/bb-issue-done-2.webp)
6469

65-
![bb-prior-bk-rollback-issue](/content/docs/change-database/rollback-data-changes/bb-prior-bk-rollback-issue.webp)
70+
1. Select which changes you want to rollback - you can choose individual changes or rollback all of them at once. This **multi-task rollback** capability allows you to efficiently revert multiple related changes in a single operation.
6671

67-
## Inspect the backup data
72+
![bb-rollback-select](/content/docs/change-database/rollback-data-changes/bb-rollback-select.webp)
6873

69-
You can go to SQL Editor to inspect the backup data. If the DML change contains no more than 5 statements, then each
70-
statements will be backed up to a separate table.
74+
1. Bytebase automatically generates the appropriate rollback SQL statements based on the backup data.
7175

72-
![bb-prior-bk-separate-table](/content/docs/change-database/rollback-data-changes/bb-prior-bk-separate-table.webp)
76+
![bb-rollback-issue-1](/content/docs/change-database/rollback-data-changes/bb-rollback-issue-1.webp)
7377

74-
If the DML change contains more than 5 statements, then all statements will be backed up to a single table.
78+
![bb-rollback-issue-2](/content/docs/change-database/rollback-data-changes/bb-rollback-issue-2.webp)
7579

76-
![bb-prior-bk-single-table-issue](/content/docs/change-database/rollback-data-changes/bb-prior-bk-single-table-issue.webp)
80+
## Inspect Backup Data
7781

78-
![bb-prior-bk-single-table](/content/docs/change-database/rollback-data-changes/bb-prior-bk-single-table.webp)
82+
You can examine the stored backup data using Bytebase's SQL Editor to verify what information has been preserved.
7983

80-
## Project backup settings
84+
![bb-sql-editor-test](/content/docs/change-database/rollback-data-changes/bb-sql-editor-test.webp)
85+
![bb-sql-editor-prod](/content/docs/change-database/rollback-data-changes/bb-sql-editor-prod.webp)
8186

82-
- You can enable **Prior Backup** by default.
83-
- You can control whether you want to skip backup errors and continue changing the data.
87+
## Project Backup Settings
8488

85-
![prior-backup-default](/content/docs/change-database/rollback-data-changes/bb-prior-backup-default.webp)
89+
Configure backup behavior at the project level for consistent data protection:
90+
91+
- **Default backup**: Enable **Prior Backup** by default for all changes in the project
92+
- **Error handling**: Control whether to skip backup errors and proceed with data changes
93+
94+
![prior-backup-default](/content/docs/change-database/rollback-data-changes/bb-prior-backup-default.webp)
8695

8796
## Appendix: Setting Up `bbdataarchive`
8897

98+
Before using Prior Backup functionality, you must create the `bbdataarchive` storage location in your database instance. Follow the instructions for your specific database engine:
99+
89100
### MySQL
90101

91-
1. Create the `bbdataarchive` Database:
102+
1. **Create the backup database:**
92103

93104
```sql
94105
CREATE DATABASE bbdataarchive;
95106
```
96107

97-
1. Grant Necessary Privileges:
108+
1. **Grant necessary privileges:**
98109

99-
Replace `your_user` with the actual username.
110+
Replace `your_user` with the actual username that Bytebase uses to connect to your database.
100111

101112
```sql
102113
GRANT ALL PRIVILEGES ON bbdataarchive.* TO 'your_user'@'%';
@@ -105,15 +116,15 @@ If the DML change contains more than 5 statements, then all statements will be b
105116

106117
### PostgreSQL
107118

108-
1. Create the `bbdataarchive` Schema:
119+
1. **Create the backup schema:**
109120

110121
```sql
111122
CREATE SCHEMA bbdataarchive;
112123
```
113124

114-
1. Grant Necessary Privileges:
125+
1. **Grant necessary privileges:**
115126

116-
Replace `your_user` with the actual username.
127+
Replace `your_user` with the actual username that Bytebase uses to connect to your database.
117128

118129
```sql
119130
GRANT ALL PRIVILEGES ON SCHEMA bbdataarchive TO your_user;
@@ -122,29 +133,29 @@ If the DML change contains more than 5 statements, then all statements will be b
122133

123134
### Oracle
124135

125-
1. Create the `bbdataarchive` User:
136+
1. **Create the backup user:**
126137

127138
```sql
128139
CREATE USER bbdataarchive IDENTIFIED BY password;
129140
```
130141

131-
1. Grant Connection Privileges:
142+
1. **Grant connection privileges:**
132143

133144
```sql
134145
GRANT CREATE SESSION TO bbdataarchive;
135146
```
136147

137-
1. Grant unlimited space quota to the `bbdataarchive` user on the specified `tablespace`:
148+
1. **Grant unlimited space quota:**
138149

139-
Replace `tablespace_name` with the actual tablespace name.
150+
Replace `tablespace_name` with your actual tablespace name.
140151

141152
```sql
142153
GRANT QUOTA UNLIMITED ON tablespace_name TO bbdataarchive;
143154
```
144155

145-
1. Grant Privileges to the Instance Administrator:
156+
1. **Grant privileges to the instance administrator:**
146157

147-
Replace `admin_user` with the actual username of the instance administrator.
158+
Replace `admin_user` with the actual username that Bytebase uses as the instance administrator.
148159

149160
```sql
150161
GRANT CREATE ANY TABLE TO admin_user;
@@ -153,15 +164,15 @@ If the DML change contains more than 5 statements, then all statements will be b
153164

154165
### SQL Server
155166

156-
1. Create the `bbdataarchive` Database:
167+
1. **Create the backup database:**
157168

158169
```sql
159170
CREATE DATABASE bbdataarchive;
160171
```
161172

162-
1. Grant Necessary Privileges:
173+
1. **Grant necessary privileges:**
163174

164-
Replace `your_user` with the actual username.
175+
Replace `your_user` with the actual username that Bytebase uses to connect to your database.
165176

166177
```sql
167178
USE bbdataarchive;
68.4 KB
Loading
54.3 KB
Loading
51.9 KB
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)