Skip to content

Commit 6337390

Browse files
docs: update first schema tuts (#975)
* update first schema tuts * update * update * update * update
1 parent 8e7c716 commit 6337390

File tree

7 files changed

+25
-33
lines changed

7 files changed

+25
-33
lines changed
-44.7 KB
Loading
-24.2 KB
Loading
Binary file not shown.
7.84 KB
Loading
Binary file not shown.

docs/tutorials/first-schema-change.mdx

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,76 +12,69 @@ featured: true
1212

1313
import PreparationWithSampleData from '/snippets/tutorials/preparation-with-sample-data.mdx';
1414

15-
In this tutorial, you'll use the default sample databases to get familiar with the product in the quickest way.
15+
Learn Bytebase's schema change workflow using sample databases.
1616

17-
## Step 1 - Run via Docker and Setup
17+
## Step 1 - Setup Bytebase
1818

1919
<PreparationWithSampleData />
2020

21-
## Step 2 - Configure the SQL Review
21+
## Step 2 - Configure SQL Review
2222

23-
1. Navigate to **CI/CD** > **SQL Review** in the left menu. Click **+ New SQL Review** to create a new SQL review.
23+
1. Navigate to **CI/CD** > **SQL Review** and click **+ Create SQL review**.
2424

25-
1. Choose `Sample Template` which has 20 enabled rules and click **Confirm and add**. Attach the SQL review to Environment `Prod` and click **Confirm**.
26-
27-
1. You'll see the SQL review is created.
28-
![sql-review-configured](/content/docs/tutorials/first-schema-change/bb-sql-review-configured.webp)
25+
1. Select `Sample Template` (19 enabled rules), click **Next**. Attach to `Prod` environment and confirm.
2926

3027
## Step 3 - Create a Plan
3128

32-
1. Navigate to **CI/CD** > **Plans** in the left menu and click **+ New Plan**.
33-
![new-plan](/content/docs/change-database/plan/bb-new-plan.webp)
34-
35-
1. Select **Schema Migration (DDL)** as the change type.
36-
![plan-change-type](/content/docs/change-database/plan/bb-plan-change-type.webp)
29+
1. Navigate to **CI/CD** > **Plans** and click **+ New Plan**.
3730

38-
1. Select the databases where changes will be applied:
31+
1. Select both databases where changes will be applied:
3932

4033
- `hr_test` on `Test Sample instance`
4134
- `hr_prod` on `Prod Sample instance`
4235

4336
Click **Confirm** to proceed.
44-
![plan-targets](/content/docs/change-database/plan/bb-plan-targets.webp)
4537

46-
1. Add the SQL statement:
38+
1. Add this SQL statement (or use **Schema Editor** for visual design):
4739

4840
```sql
4941
ALTER TABLE public.employee ADD COLUMN IF NOT EXISTS nickname TEXT;
5042
```
5143

52-
Click **Create** to create the plan.
44+
Click **Create**.
45+
46+
1. The plan is then in `Draft` status. Any SQL review warnings appear because Bytebase automatically checks against your configured policy. Click warnings for details.
5347

54-
1. The plan will be in `Draft` status. You may see SQL review warnings, especially for the production environment. This is because Bytebase automatically runs configured checks.
55-
![plan-draft-2-targets-warning](/content/docs/tutorials/first-schema-change/bb-plan-draft-2-targets-warning.webp)
48+
![plan-warning-detail](/content/docs/tutorials/first-schema-change/bb-plan-warning-detail.webp)
5649

5750
## Step 4 - Review and Approve
5851

59-
1. To fix the SQL review warning, edit the SQL to add `NOT NULL DEFAULT ''`:
52+
1. Fix the warning by adding `NOT NULL DEFAULT ''`:
6053

6154
```sql
6255
ALTER TABLE public.employee ADD COLUMN IF NOT EXISTS nickname TEXT NOT NULL DEFAULT '';
6356
```
6457

65-
Click **Save** to update the plan. The checks will run again and should pass.
58+
Click **Save**. The checks rerun and pass.
6659

67-
1. Click **Ready for Review** and then **Confirm** to submit the plan for approval.
60+
1. Click **Ready for Review** to convert the plan into an issue and submit for approval.
6861

69-
1. The plan has no approval required.
62+
1. No approval is required for this change.
7063
![issue-2-targets-no-approval](/content/docs/tutorials/first-schema-change/bb-issue-2-targets-no-approval.webp)
7164

72-
## Step 4 - Deploy the Changes
65+
## Step 5 - Deploy Changes
7366

74-
1. Navigate to the **Rollout** section. You'll see the deployment is ready for both Test and Prod environments.
67+
1. In the **Rollout** section, both Test and Prod deployments are ready.
7568
![issue-2-targets-to-rollout](/content/docs/tutorials/first-schema-change/bb-issue-2-targets-to-rollout.webp)
7669

77-
1. Click **Run** for the Test stage first and then if it's successful, click **Run** for the Prod stage.
70+
1. Click **Run** for Test, then for Prod after success.
7871

79-
1. When all rollouts are successfully executed, the issue will be marked as `Done`.
72+
1. Once complete, the issue is marked `Done`.
8073

81-
## Next Step
74+
## Next Steps
8275

83-
Now you have successfully performed your first schema change, the core workflow in Bytebase. Next:
76+
You've completed your first schema change. Continue with:
8477

85-
- If you want to move changes between environments, follow [How to Move Schema Change from Test to Prod](/tutorials/how-to-move-schema-change-from-test-to-prod/)
86-
- If you want to rollout manually, follow [Deploy Schema Change with Rollout Policy](/tutorials/deploy-schema-migration/).
87-
- If you want to assign approvers before the rollout, follow [Database Change with Risk-Based Approval Flow](/tutorials/database-change-management-with-risk-adjusted-approval-flow/)
78+
- [Move Schema Changes from Test to Prod](/tutorials/how-to-move-schema-change-from-test-to-prod/) - for environment transitions
79+
- [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

docs/tutorials/sql-review-gui.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Make sure you have [Docker](https://www.docker.com/) installed, and if you don
4040
1. Choose `Sample Template` which has 20 enabled rules and click **Confirm and add**. Attach the SQL review to Environment `Prod` and click **Confirm**.
4141

4242
1. You'll see the SQL review is created. Note that there's a warning sign for the `NOT NULL` rule.
43-
![sql-review-configured](/content/docs/tutorials/first-schema-change/bb-sql-review-configured.webp)
4443
![sql-review-not-null](/content/docs/tutorials/sql-review-gui/bb-sql-review-not-null.webp)
4544

4645
## Trigger SQL Review

0 commit comments

Comments
 (0)