Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 2.43 KB

schema-editor.md

File metadata and controls

46 lines (32 loc) · 2.43 KB
title feature_name
Schema Editor
SCHEMA_EDITOR

Schema Editor provides a spreadsheet-like editor to view and edit database structure. Users first use the Schema Editor to prepare the schema changes, then those changes will be converted into SQL statements and go through the change workflow.

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 for more details.

How to use

By clicking on Alter Schema in the Quick Action panel and selecting the database, you will see the Schema Editor dialog.

schema-editor-dialog

Create table

To create a new table:

  1. Select a database and click the New Table on the top of the table list tab. create-table-button
  2. Enter the table name.
  3. Add new column by clicking the Add Column on the top of column list tab. add-column-button
  4. Specify the column's attributes: name, data type, default, comment, nullable, primary key and foreign key.
  5. Click Preview Issue, then Bytebase will go to the issue creating page with the generated SQL statement.

Alter table

To alter a table:

  1. Open the table editor tab by clicking the table list.
  2. Rename the table name by clicking the Rename dropdown item in table tree node. table-rename-button
  3. Add new column by clicking on the Add Column.
  4. Specify the new column's attributes: name, data type, default, comment, nullable, primary key and foreign key.
  5. Alter the existing column's attributes, if needed.
  6. Click Preview Issue, then Bytebase will go to the issue creating page with the generated SQL statement.

Drop table

To drop an existing table:

  1. Hover to the table and click the Drop Table dropdown item, or the Trash button for the table row. drop-table-button
  2. Click Preview Issue, then Bytebase will go to the issue creating page with the generated SQL statement.