Skip to content

Commit dc86722

Browse files
authored
Merge pull request #611 from bytebase/o-branch-30
docs: update schema editor doc
2 parents d6d2650 + e32f120 commit dc86722

File tree

14 files changed

+40
-26
lines changed

14 files changed

+40
-26
lines changed

content/docs/change-database/schema-editor.md

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,54 @@ feature_name: SCHEMA_EDITOR
77

88
**Schema Editor** also supports the use of templates for fields and tables. Templates can be pre-defined at the workspace level and can be used to save time and ensure consistency when creating new schema entities. See [Schema Template](/docs/administration/schema-template) for more details.
99

10-
## How to use
10+
## Schema Editor Entry
1111

12-
By clicking on **Alter Schema** in the Quick Action panel and selecting the database, you will see the Schema Editor dialog.
12+
Select a certain project and go to **Database** -> **Databases** in the left-side menu. Select _one_ of the databases and click **Edit Schema**.
1313

14-
![schema-editor-dialog](/content/docs/change-database/schema-editor/schema-editor-dialog.webp)
14+
![](/content/docs/change-database/schema-editor/schema-editor-entry.webp)
1515

16-
### Create table
16+
## Create Table / Schema
1717

18-
To create a new table:
18+
To create a new table, select a database and click the **New Table** button on top of the Edit Schema page. Enter table name and **Create**.
1919

20-
1. Select a database and click the **New Table** on the top of the table list tab.
21-
![create-table-button](/content/docs/change-database/schema-editor/create-table-button.webp)
22-
1. Enter the table name.
23-
1. Add new column by clicking the **Add Column** on the top of column list tab.
24-
![add-column-button](/content/docs/change-database/schema-editor/add-column-button.webp)
25-
1. Specify the column's attributes: name, data type, default, comment, nullable, primary key and foreign key.
26-
1. Click **Preview Issue**, then Bytebase will go to the issue creating page with the generated SQL statement.
20+
![](/content/docs/change-database/schema-editor/create-table.webp)
2721

28-
### Alter table
22+
You can also create a new table by clicking the `···` button by a schema, then click the **New table** button and enter your Table Name. Click the **Create** button, and you'll have created a table under this schema.
2923

30-
To alter a table:
24+
![](/content/docs/change-database/schema-editor/new-table-button.webp)
3125

32-
1. Open the table editor tab by clicking the table list.
33-
1. Rename the table name by clicking the **Rename** dropdown item in table tree node.
34-
![table-rename-button](/content/docs/change-database/schema-editor/table-rename-button.webp)
35-
1. Add new column by clicking on the **Add Column**.
36-
1. Specify the new column's attributes: name, data type, default, comment, nullable, primary key and foreign key.
37-
1. Alter the existing column's attributes, if needed.
38-
1. Click **Preview Issue**, then Bytebase will go to the issue creating page with the generated SQL statement.
26+
Similarly, you can click the `···` button on the database row to create a new schema under it.
3927

40-
### Drop table
28+
By clicking on the `copy` button on the table's row, you can replicate this table.
4129

42-
To drop an existing table:
30+
![](/content/docs/change-database/schema-editor/copy.webp)
4331

44-
1. Hover to the table and click the **Drop Table** dropdown item, or the **Trash** button for the table row.
45-
![drop-table-button](/content/docs/change-database/schema-editor/drop-table-button.webp)
46-
1. Click **Preview Issue**, then Bytebase will go to the issue creating page with the generated SQL statement.
32+
## Drop or Restore Table / Schema
33+
34+
To drop an existing table / schema, click the `···` button on the corresponding row of the database / schema list, and click the **Drop table** / **Drop Schema** button. Then this table / schema will be crossed out.
35+
36+
![](/content/docs/change-database/schema-editor/drop-table.webp)
37+
38+
Click on the `···` button of a table or schema you just dropped, and you can **Restore** it.
39+
40+
## Alter Table
41+
42+
### Add Column
43+
44+
To Add a new column, click on a table and click the **Add Column** button on top of table detail page.
45+
46+
Enter attributes for this column: Name, Type, Default, etc.
47+
48+
![](/content/docs/change-database/schema-editor/add-column.webp)
49+
50+
### Rename new Table
51+
52+
For _newly created_ tables, you can **Rename** in the left-side list.
53+
54+
![](/content/docs/change-database/schema-editor/rename.webp)
55+
56+
### Preview Issue
57+
58+
After your schema editing, Click the **Preview Issue** at bottom right, and you'll be redirected to the issue creating page with generated SQL statement.
59+
60+
![](/content/docs/change-database/schema-editor/edit-schema-issue.webp)
Binary file not shown.
623 KB
Loading
14.3 KB
Loading
Binary file not shown.
634 KB
Loading
Binary file not shown.
190 KB
Loading
284 KB
Loading
129 KB
Loading

0 commit comments

Comments
 (0)