6.3 Datamodel
Datamodel definitions and definition examples are shown below. For details of Datamodel, see “Workflow” and “Designing a workflow”.
| Label | Default Value | Required | Description | |||
|---|---|---|---|---|---|---|
| apiVersion: | 1.0 | Yes | API Version | |||
| kind: | Yes | Specify "datamodel" for datamodel. | ||||
| type: | No | Only "resource" can be specified for datamodel. | ||||
| name: | Yes | Internal name of the Datamodel definition. Specify the directory name for this YAML file. | ||||
| label: | Yes | YAML file display name | ||||
| includes: | No | List the related YAML files for use in this YAML file. | ||||
| - kind: | Yes | Type of YAML file to be loaded | ||||
| name: | Yes | Internal name of YAML file to be loaded | ||||
| description: | No | Detailed description | ||||
| tables: | Yes | Set the table details. | ||||
| - name: | Yes | Internal name of the table* The characters that can be input are as follows.
|
||||
| label: | Yes | Table display name | ||||
| inherits: | No | Inheritance settings | ||||
| table: | No | Custom table name that this table inherits from Must be included in "includes". |
||||
| description: | No | Detailed description | ||||
| documents: | No | Documents associated with the table | ||||
| - document: | No | Specify documents associated with the table. | ||||
| columns: | Yes | Settings for the columns. | ||||
| - name: | Yes | Internal name of the column The characters that can be input are as follows.
|
||||
| label: | Yes | Column display name | ||||
| description: | No | Detailed description of the column | ||||
| type: | Yes | Specify the column type. See "(Table) Column types" for the types that can be specified. |
||||
| not-null: | false | No | If this value is "true", a non-null restriction is added to this column. | |||
| primary: | false | No | If this value is "true", this column is treated as the primary key. | |||
| foreign: | false | No | If this value is "true", this column is treated as the foreign key. | |||
| ref: | No | Used to refer to the column information of a specified table. If "foreign" is "true", it is a table restriction; if "false", it is a column restriction. This value must be specified in dot notation format as follows. Referenced table name.column name Example) mytable.mycolumn The table used for reference must be included in the document specified with "includes". |
||||
| enum: | No | Defines selections when the type is "enum" | ||||
| - name: | Yes | Internal name of the selection The characters that can be input are as follows.
|
||||
| label: | Yes | Selection display name | ||||
| default: | No | Default value of this column | ||||
| index: | false | No | If this value is "true", an index will be generated for this column. | |||
| document: | No | Documents associated with the table Specify when "document" is selected as the column type. There is a need to specify a collection-type document. |
||||
| kind: | Yes | Sets the "kind" of document. | ||||
| name: | Yes | Sets the "name" of the document. | ||||
| generate: | No | Automatically populate column values. The following can be set.
|
||||
| ref-sys: | No | Refer to columns of the table (user, group, role) prepared in Ops I. Do not specify a column with "foreign: true" as the column specified for ref-sys. If a "foreign: true" column is specified, it will not be registered as a document. Only specify the record itself or a specific column, such as referred system table name or referred system table name.column name. |
||||
| schemas: | No | Defines schema Not supported in UI version 1.0. For details of UI versions, see "UI version". |
||||
| - name: | Yes | schema name | ||||
| file: | Yes | JSON Schema file path The starting point is the directory in which the Datamodel YAML file is saved. |
||||
Specify a column with “primary: true” as the ref column. If a column that is not “primary: true” is specified, it will not be registered as a document.
The column types that can be specified are as follows.
| Column type | |||||||
|---|---|---|---|---|---|---|---|
| integer*1 | numeric | varchar*2 | text | timestamp*5 | date*5 | time | boolean |
| enum | inet*3 | document*4 | decimal | uuid | - | - | - |
There are limits to the number of characters that can be set for the value of the “name” attribute of a table or column.
Also, the upper limit varies depending on the conditions.
Refer to the following and define so that all restrictions applying to the conditions are met.
(Table) Character limits for table and column name attributes
| No. | Prerequisites | Restriction |
|---|---|---|
| 1 | Always | Table names are a maximum of 45 characters |
| 2 | Always | Column names are a maximum of 63 characters |
| 3 | If there is a "foreign: true" column in the table | The total number of characters in the corresponding table name, corresponding column name, table name referred to and column name referred to is a maximum of 53 characters |
| 4 | If there is a "type: enum" column in the table | The total number of characters in the corresponding table name and corresponding column name is a maximum of 60 characters |
| 5 | If there is a "type: enum" column in the table | The maximum number of characters in the name of the selection for the corresponding enum name is 63 |
Ops I provides the following columns by default.
(Table) Columns provided by default
| Column | Type | Description |
|---|---|---|
| id | uuid | Global unique ID |
| created_on | timestamp | Date and time the record was created |
| updated_on | timestamp | Date and time the record was updated |
| created_by | varchar (256) | Username that created the record |
| updated_by | varchar (256) | Username that updated the record |
| approved | boolean | Flag indicating whether it has been approved |
| domain | varchar (256) | Domain |
| group | varchar (256) | Group it belongs to |
In addition, the following tables are provided by default.
| Column | Type | Description |
|---|---|---|
| id | varchar (36) | Global unique ID |
| username | varchar (255) | Username |
| first_name | varchar (255) | First name |
| last_name | varchar (255) | Last name |
| varchar (255) | User e-mail address |
| Column | Type | Description |
|---|---|---|
| id | varchar (36) | Global unique ID |
| name | varchar (255) | Group name |
| Column | Type | Description |
|---|---|---|
| id | varchar (36) | Global unique ID |
| name | varchar (255) | Role name |
<Definition example>
apiVersion: 1.0
kind: datamodel
type: resource
name: lend_vm_datamodel
label: lend_vm_datamodel
description: Defines the datamodel for VM lending ledger
includes:
- kind: attachment
name: Evidence of VM creation
#Define column
tables:
- name: lend_vm_table
label: VM lending ledger table
columns:
- name: app_number
label: Application number
description: Application serial number
type: varchar(32)
not-null: false
primary: false
foreign: false
- name: sys_name
label: System name
description: Name of system using VM
type: enum
enum:
- name: order_mgt_sys
label: Order management system
- name: customer_mgt_sys
label: Customer management system
- name: production_mgt_sys
label: Production management system
not-null: false
primary: false
foreign: false
- name: vm_name
label: VM name
description: Name of lent VM
type: varchar(32)
not-null: false
primary: false
foreign: false
- name: os_name
label: OS type
description: Select Windows or Linux
type: enum
enum:
- name: Windows
label: Windows
- name: Linux
label: Linux
not-null: false
primary: false
foreign: false
- name: cpu
label: CPU
description: Number of vCPU cores to use for VM
type: integer
not-null: false
primary: false
foreign: false
(omitted)
- name: start_date
label: Usage start date
description: Start date of VM usage
type: date
not-null: false
primary: false
foreign: false
- name: applicant
label: Usage requester
description: Usage requester
type: varchar(256)
not-null: false
primary: false
foreign: false
(omitted)
- name: notice
label: Notice
type: text
not-null: false
primary: false
foreign: false
default:
<strong>The VM lending service will be suspended during the following time periods for system maintenance. <br>
XX XX, 20XX (Wed) 9:00 - 12:00<br>
We apologize for any inconvenience. </strong>