tencent cloud

CloudBase

Product Introduction
Product Overview
Features and Strengths
Use Cases
System Limits
Purchase Guide
Product Pricing
Description Of Billing Capability Items
Yearly/Monthly Subscription Package Description
Alarm and Notification
Overdue Payment Instructions
Development Guide
Cloud Storage
Database
Identity Verification
Cloud function
Static website management
SDK Documentation
Client SDK
Server SDKs
Management-side SDK
Product Agreement
Cloud Development Service Level Agreement

Creating a Model

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-12-31 11:48:17
The creation of cloud databases and models involves several scenarios:
Create a blank database table or collection and define the model structure.
Use existing database tables, collections, and data, and only the model structure needs to be defined.
Use the previously configured model structures with an existing earlier version of CMS.

Based on different scenarios, currently, a data model can be created using the following methods:

Creating a Database and Configuring a Data Model

1. When creating a database, select the method of creating a database and configuring a data model to create blank database tables and collections, and configure the data model. After selecting this creation method, you can choose the database to use.
Document cloud database: Collections will be created in the document cloud database.
MySQL cloud database: Tables will be created in the MySQL cloud database.
Self-owned MySQL database: By selecting an existing self-owned database connection configuration or creating a database connection configuration, tables will be created in the self-owned MySQL database corresponding to the connection configuration.
2. After selecting the database to use, you can continue to choose the method for model creation.
Create from blank: Start with a blank model and configure the model structure yourself.
Create from a template: Some templates are provided as references to quickly create model structures.
3. During the creation process, the name is used to fill in easy-to-remember content, and Chinese characters are supported.
The identifier is used as a unique identifier and should not be duplicated in the same database instance. It supports English letters, digits, underscores, and hyphens. The identifier also serves as the collection name or table name in the database. For model configuration, see Data Model Field Description.
4. Additionally, if you only need to create a database collection without creating a model for the time being, you can skip the model configuration step. In such cases, only database tables or collections will be created, not the model. You can generate the model later based on existing database tables during use.

Connecting to Existing Database Tables and Generating a Data Model

1. When creating a model, select the method of connecting to existing database tables and generating a data model. This method does not create database tables or collections but merely connects to existing tables or collections and configures the generated data model.
2. Using this method, existing database tables or data will not be affected.
Document cloud database: Select existing cloud database collections for which no model has been created. Collections created and used before the data model goes online can generate data models in this way.
Self-owned MySQL database: Select tables in the self-owned database and generate data models based on the table structure.
3. During the creation process, the name can be filled with easy-to-remember content. The identifier will be fixed as the collection or table name and cannot be modified. When an existing database is used, if there is data in the collection of a document cloud database, the model and structure will be inferred based on the existing data. For the inferred model, you can further modify and edit the name. For self-owned MySQL database tables, a model will be generated based on the table's column structure, and you can edit the name in the model as well.
4. In the process of creating models based on existing collections or tables, the models will also include system fields and the system fields will be synchronized to the collections or table structures.

Importing Existing CMS

1. When creating an instance, select the method of importing existing CMS to connect to the existing CMS and generate a data model from the data model in the existing CMS.
2. CloudBase has provided various types of CMS, including open-source versions, headless versions, and cloud template versions. Through the current data model capabilities, the model structures from earlier versions of CMS can be imported.
3. During the model creation process, if the data of the existing CMS is stored in the document cloud database collections, the created data model can be directly connected to the collections, and the data can be obtained and processed in the new model methods. If the data is stored in the CMS, you can export the data from the earlier version and import it into the data model to migrate data.

Model Configuration

When creating a model, you need to fill in the model name and identifier:
The name is used to fill in easy-to-remember content and Chinese characters are supported.
The identifier is used as a unique identifier and should not be duplicated in the same database instance. It supports English letters, digits, underscores, and hyphens. The identifier also serves as the collection name or table name in the database.

Model Field Structure

When configuring model fields, in addition to filling in the field name and field identifier, you can specify the data structure type for the field. The field structure types are described below.
Field name: Fill in an easy-to-remember and recognizable name, and Chinese characters are supported.
Field identifier: Used as a unique identifier and should not be duplicated in the same model. It supports English letters, digits, underscores, and hyphens. The identifier also serves as the column name in the database table or the field name in the collection.
Field description: Used to describe the purpose or usage of the current field.
Required or not: Whether the current field is required when data is inserted.
Unique or not: Whether the data of the current field is unique.
Primary display column or not: When users configure associations or master-detail fields in other data models, this field will be displayed as the primary display column value to facilitate user viewing. This configuration only affects the display effect and does not affect the actual stored content of associations or master-detail fields.

Field Structure Types

The current data model fields support the following types: text, boolean, number, array, object, JSON, email, phone, URL, image, rich text, Markdown, date and time, enum, geographic location, file, auto-numbering, region, and association relationship (new).
For more detailed field descriptions, see Data Model Field Description.

System Fields

When configuring the data model structure, the model structure includes some system fields by default. System fields are used to store basic information about the data and play a role in model methods, data permissions, and other scenarios. System fields cannot be modified or deleted.
The included system fields are as follows:
Name
Identifier
Type
Required or Not
Unique or Not
Data identifier
_id
Text|Single-line text
No
Yes
Creation time
createdAt
Date and time
No
No
Update time
updatedAt
Date and time
No
No
Owner
owner
Association relationship
No
No
Creator
createBy
Association relationship
No
No
Modifier
updateBy
Association relationship
No
No
Department
_departmentList
Array
No
No
Record creator
_openid
Text|Single-line text
No
No


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백