Schema Template
Schema Template allows Workspace Admin or DBA to pre-define templates of fields and tables at the workspace level, and they may be used to change schema via Schema Editor. There're three types:
- Field Template
- Table Template
- Column Type Restriction
Field Template
- Click Settings icon on the top right, and click Schema Template under Security & Policy.
- Under Field Template, click Add Field Template and you'll see the Field Template form.
- Fill the form as below and click Create:
- Category:
test
- Engine:
PostgreSQL
- Column name:
created_at
- Column type:
DATE
- Default: Keep it empty and keep Nullable unchecked.
- Category:
- Go to a project and click Edit Schema. Choose a PostgreSQL database and click Next.
- Chooose a table on Schema Editor, and click Add from template.
- Select the
created_at
template you just created, and it will be appended in the table.
Table Template
- Click Settings icon on the top right, and click Schema Template under Security & Policy.
- Under Table Template, click Add Table Template and you'll see the Table Template form.
- Fill the form as below and click Create:
- Category:
test
- Engine:
PostgreSQL
- Table name:
user
- Add column:
- Column name:
id
- Column type:
INTEGER
- Default: EMPTY
- Not Null: Checked
- Primary: Checked
- Column name:
- Add column:
- Column name:
name
- Column type:
VARCHAR(45)
- Default: EMPTY
- Not Null: Checked
- Primary: Unchecked
- Column name:
- Add from template:
- Template:
created_at
- Template:
- Category:
- Go to a project and click Edit Schema. Choose a PostgreSQL database and click Next.
- Chooose a database on Schema Editor, and click Add from template.
- Select the
user
template you just created, and the new table will be appended in the table list on the left.
Column Type Restriction
- Click Settings icon on the top right, and click Schema Template under Security & Policy.
- Under Column Type Restriction, choose Allow limited types and you'll see allowed type list. Remove
VARCHAR(255)
and click Update. - Go to a project and click Edit Schema. Choose a PostgreSQL database and click Next.
- Chooose a table on Schema Editor, choose an existing row, click Type dropdown and you'll see
VARCHAR(255)
is not available.