Private Database Guide

Prerequisites​

You provide the host/port/database/username/password, and we push your account data to this database in real time.

This push method automatically creates tables in your database, and requires your database to allow public internet access.

  • CaoLiao maintains the synced tables. Storing your own additional data in the same synced table is not supported. Todos update their corresponding rows by todo_id.
  • Do not create tables in the database with the same names as CaoLiao tables — they will be treated as CaoLiao data tables and overwritten in full.
  • Database type: MySQL 5.7
  • QR code information, form records, todos, status details, and plan completion details are synced according to the enabled sync configuration and scope.
  • If only bulk templates and forms are created with no submitted data, no data tables will be created.
  • If you have a firewall or other access restrictions, add the IP allowlist

Attachment: MySQL 5.7 download page

How to Use​

In the CaoLiao workbench navigation bar, go to [Data Management] > [Data API], select [Private Database], and enter your database host, port, credentials, and other details.

CaoLiao workbench data management interface

Data Table Reference​

1. base_codeinfo — QR Code Basic Info Table​

Description: This table is pushed when your account has QR code data. Includes dynamic QR codes and bulk sub-codes.

FieldTypeDescriptionExample
code_idintUnique QR code identifier67654543
码名称stringQR code nameFire Hydrant 01
码类型stringTypes include: dynamic QR code, bulk sub-code, and bulk template codebulk sub-code
urlstringQR code URLhttp://qr61.cn/o2eikt/q85Q8KL
tpl_code_idintThe bulk template ID associated with the sub-code. For non-sub-codes, this is the same as code_id56335353
模板名称stringThe bulk template name associated with the sub-code. For non-sub-codes, this is the same as the QR code nameFire Hydrant
目录stringThe name of the last-level directory containing the QR code (parent directories not included)Fire Equipment
标签集stringSet of groups assigned to the QR codeFire,Equipment

Directory info shows only the deepest-level directory; parent directories are not shown.

2. code_state — QR Code Status Table​

Description: This table is pushed when a QR code has associated statuses. View Status feature

Status data from before activation will not be pushed. If you need this historical data, contact online support and a technician can manually sync it for you.

FieldTypeDescriptionExample
code_idintUnique QR code identifier67654543
member_idintMember unique identifier2091263
auth_idintSubmitter unique identifier12789054
更新时间datetimeTime the status was last updated2020-11-20 15:00:00
e.g. Device Operating Status_720stringStatus group name; the trailing number (e.g. "_720") is a system-generated deduplication identifierNormal
......stringAll status groups in your account will appear hereAbnormal

3. code_state_log — QR Code Status Change Log Table​

Description: This table is pushed when a QR code has associated statuses. Every status change is recorded here. Status change data from before activation will not be pushed when the database is first activated.

FieldTypeDescriptionExample
code_idintUnique QR code identifier67654543
member_idintMember unique identifier2091263
auth_idintSubmitter unique identifier12789054
更新时间datetimeTime the status was updated2020-11-20 15:00:00
状态组stringName of the status groupDevice Status
状态值stringThe current status value for this status groupNormal
变更方式stringHow the status was changed: via form submission or manual editRecord/Edit
来源stringWhen changed via form submission, the unique identifier of the corresponding form record12220988

4. table_dXX — Form Data Detail Table​

Description: This table is pushed when form data is submitted. Form data tables are named with the "table_" prefix, followed by the form's unique number (e.g., table_d45). Each form corresponds to one table. View Forms feature

Form data detail table screenshot

FieldTypeDescriptionExample
record_idintUnique form record identifier12220988
code_idintUnique QR code identifier67654543
tpl_code_idintFor sub-codes: the bulk template ID. For non-sub-codes: same as code_id54349863
码名称stringQR code nameFire Hydrant 01
tpl_idintUnique form identifier346636
记录单名称stringForm nameFire Hydrant Inspection
记录时间datetimeTime the form record was added2020-11-20 15:20:00
状态stringCurrent status of this record: includes deletion status and review statusNormal/Deleted/Pending Review/Approved/Rejected
member_idintMember unique identifier2091263
auth_idintSubmitter unique identifier12789054
记录编号stringRecord serial numberL1234
处理状态stringFollow-up processing statusPending/Completed/No Action Needed/Not Marked
创建来源stringSubmission source: mobile scan submission, or submitted via follow-up actionsMobile scan/Via follow-up actions
来源编号stringWhen source is "via follow-up actions", this is the record serial number of the original recordL1235
提交编号stringCustom submission number assigned in the CaoLiao workbench11
处理状态变更时间 (Processing status change time)datetimeTime the follow-up processing status was last changed2020-11-20 15:20:00
e.g. 设备名称stringForm component nameInspection Item 1
......stringAll form component names are shown here

Form Component Push Notes:​

  1. Number components are pushed without their unit labels.
  2. For inspection item components, the values mean: 0 = not filled; 1 = checked (√); 2 = crossed (×); 3 = not selected. If the √ and × labels have been customized, the push will still use 0, 1, 2, 3 — not the custom names.
  3. Notes (descriptions and images) added to inspection items are not pushed.
  4. Location components push three fields: location name (in Chinese), latitude, and longitude.
  5. Description components are pushed; the field name is the description component's title, and the field value is its content.
  6. Group header components are not pushed.
  7. ID card components are split into multiple fields: ID card info (empty), ID number, name, gender, ethnicity, date of birth, and address.
  8. Multimedia components (images, files, videos, audio) are pushed as links that can be clicked to view the content.

5. base_table_data — Form Data Summary Table​

Description: This table is pushed when form data is submitted. It is a summary table of all form records, containing fields common to all form records — such as QR code name, submitter name, and form name. Use case: For example, if you have check-in and check-out forms, you can use this table to retrieve all entry/exit data without needing to aggregate across two separate tables.

FieldTypeDescriptionExample
record_idintUnique form record identifier12220988
code_idintUnique QR code identifier67654543
tpl_code_idintFor sub-codes: the bulk template ID. For non-sub-codes: same as code_id56335353
tpl_idintUnique form identifier346636
码名称stringQR code nameFire Hydrant 01
记录单名称stringForm nameFire Hydrant Inspection
记录时间datetimeTime the form record was added2020-11-20 12:01:02
记录人stringSubmitter nameLi Si
member_idintMember unique identifier2091263
auth_idintSubmitter unique identifier12789054
状态stringCurrent status of this record: includes deletion status and review statusNormal/Deleted/Pending Review/Approved/Rejected
记录编号stringRecord serial numberL1234

6. template_codeinfo_XXX — Bulk Template Sub-Code Info Table​

Description: This table is pushed when your account has sub-codes generated from bulk templates. It shows the variable content of each bulk sub-code. View Bulk QR Code Generation feature

The table name starts with "template_" followed by the template's identifier. There are two historical naming versions.

6.1 Naming Rules:​

  • Version 1: Suffix is "dXX", where the number after "d" is the bulk template number. For example, if the bulk template number in the workbench is M312, the corresponding table name is template_codeinfo_D312.

Bulk template number example

  • Version 2: Suffix is the internal bulk template ID. Edit the bulk template and get the ID from the URL, as shown below.

Bulk template ID example

6.2 Field Descriptions:​

FieldTypeDescriptionExample
code_idintUnique QR code identifier67654543
tpl_code_idintUnique bulk template identifier56335353
状态stringWhether the bulk sub-code has been deletedNormal
...stringThe following fields are the variable content from the bulk template

7. record_review_data — Follow-Up Actions Data Table​

Description: This table is pushed when follow-up actions are added to a form record, or when the follow-up processing status is marked. View Follow-Up Actions feature

FieldTypeDescriptionExample
review_idintUnique identifier for the follow-up action record67654543
record_idintUnique identifier of the form record this follow-up is linked to12220988
状态stringWhether this follow-up record has been deletedNormal/Deleted
来源stringHow the follow-up record was addedManual entry/Forwarded record/Forwarded to WeCom colleague/Changed processing status/Submitted form record/Sent notification/Replied to comment
文本内容stringThe specific content of the comment / the processing status change logUpdated record to [Completed]/@Zhang San/[Image]...
关键内容stringThe updated processing status / when a form is submitted via follow-up actions, key content shows the unique identifier of the corresponding form recordCompleted/12220988
附件stringMultimedia files submitted via follow-up actions (images, audio recordings, handwritten signatures, etc.)
填写人stringSubmitter nameZhang San
填写时间datetimeTime the follow-up record was added2020-11-20 15:20:00

8. base_task — Plan Basic Info Table​

Description: This table is pushed when a plan has been created in your account and execution has begun. Plan Management feature

FieldTypeDescriptionExample
task_idintUnique plan identifier33886
计划名称stringPlan nameMonthly Fire Extinguisher Inspection
描述stringPlan description

9. code_task_log — Plan Execution Log Table​

Description: This table is pushed when a plan has been created and execution has begun. After the database is activated, only plan cycle data for cycles that start executing after activation is pushed. Historical cycles and the cycle currently in progress at activation are not pushed.

This table does not include QR code name information. To get code details, join it with base_codeinfo or template_XXX.

FieldTypeDescriptionExample
log_idintUnique identifier for this plan task entry239168567
task_idintUnique plan identifier33886
计划名称stringPlan nameMonthly Fire Extinguisher Inspection
code_idintUnique QR code identifier67654543
状态stringExecution status for this cycleOptions: Completed/Incomplete/About to Expire/Completed Late/Expired Incomplete
开始时间datetimePlan cycle start time2020-12-10 12:00:00
执行时间datetimeTime the status was last changed2020-12-10 13:00:00
截止时间datetimeDeadline for this QR code in the current cycle2020-12-10 18:00:00
是否过滤stringWhether the QR code is filtered based on "no inspection required" conditionsOptions: Yes/No
变更方式stringHow the status was changedRecord
来源intWhen changed via form submission, the unique identifier of the corresponding form record12220988
来源记录结果 (Source record result)stringWhen changed via form submission, the recorded result from the corresponding form recordDevice Normal

10. code_tags — QR Code Group Table​

Description: This table is pushed when groups are in use and QR codes have been added to groups. View Group Management feature

FieldTypeDescriptionExample
code_idintUnique QR code identifier67654543
e.g. Building 1 Fire ExtinguishersintGroup name. If the QR code belongs to this group, the value is 11
e.g. Building 2 Fire ExtinguishersintGroup name1
......intAll groups in your account will appear here

11. base_members — Member Info Table​

Description: This table is pushed when advanced members are added to your account. Only advanced member information is synced; basic member information is not pushed. View Member feature

FieldTypeDescriptionExample
member_idintUnique identifier for the collaborating member2091263
姓名stringCollaborating member nameZhang San
手机号stringCollaborating member phone number135xxxx8934

12. base_auth_msg — Submitter Info Table​

Description: This table is pushed whenever a form record is submitted or a status update is recorded. The submitter is the person who filled out the form or changed the status. View Submitter Component

  1. If no form was filled out, only auth_id is shown.
  2. If a form was filled out but the submitter component was not used, only auth_id is shown; the name will be "WeChat User XXXX".
  3. If a form was filled out using submitter components (name, phone, employee ID, license plate, ID card, etc.), the corresponding field data will be shown.
FieldTypeDescriptionExample
auth_idintUnique submitter identifier12789054
姓名stringSubmitter nameLi Si
手机号stringSubmitter phone number135xxxx8934
工号stringSubmitter employee IDD234
车牌号stringSubmitter license plate浙A.12342
身份证stringSubmitter ID card number343xxxxxxxxxxxxx

13. record_audit_data — Record Approval Ticket Table​

Description: This table is pushed when a record pending approval is submitted, or when a record is reviewed. View Approval feature

FieldTypeDescriptionExample
auth_idintUnique approval ticket identifier9001
record_idintUnique identifier of the record linked to this approval ticket1001
状态stringApproval statusPending/Approved/Rejected
审核标题stringTitle of the approval stage (multi-level approvals); empty for single-level approvalsFinance Review
指定审核人stringReviewer designated by the submitter or a previous approver; empty if none designatedZhang San
审核人stringActual reviewer who performed the reviewZhang San
审核时间datetimeActual review time2024-09-20 15:20:00
审核签名stringSignature image URL signed by the actual reviewer; empty if no signaturehttps://ncstatic.clewm.net/rsrc/2024/1015/15/c12d5af513b275ba2465f923557a1f7c.png
审核回复stringReply message filled in by the reviewer during approval; empty if not filledThe submitted content does not meet requirements
创建时间datetimeApproval ticket creation time2024-09-20 10:20:00

14. base_todo — Todo Data Table​

Self-hosted MySQL supports syncing todos created from records. First configure and enable a database sync destination. Todos are written to base_todo within the existing form and QR code sync scope. You do not need to select separate todo push triggers, and the switches for member notifications and group robot notifications do not affect this sync.

ItemRule
Primary keytodo_id; the same todo always updates its corresponding row
Stored scopeCurrently visible pending and completed todos; not a complete history
Completion content完成说明 (completion notes) and 完成附件 (completion attachments) preserve details of the completion action; 完成记录ID (completion record ID) links to the record submitted to complete the todo
Deletion and hidingThe row is deleted when the todo is deleted, hidden because a new round of todos replaces it, hidden when its source record is deleted, or no longer exists at the source
RestorationWhen the source record and its associated todo are restored, the row is written again during sync
Narrowing the sync scopeOld rows that no longer fall within the new scope are not all automatically removed

The official database and self-hosted MySQL use the same public todo fields and data rules. View the complete fields, attachment format, completion record links, and FAQ.

The table is created as needed when a todo is first written. Missing required columns are added automatically during writes. The sync account needs write permissions and the necessary permissions to create and alter tables. You do not need to create the table manually; the absence of an empty table immediately after enabling sync does not indicate a failure.

A full sync backfills currently valid, visible todos within the sync scope after records and other data. It does not restore deleted or hidden historical todos. Whether backfill has finished for an existing account depends on the actual results.

Select a todo and check its data in the destination database by todo_id. After completing it, wait for sync and check the completion information and sync_time in the same row. If it has not synced, check whether the destination is enabled, the data scope, the todo's visibility, sync progress, and the database connection and permissions.

Event Push Reference​

1. Dynamic QR Codes​

EventPushedAffected TablesBehavior
Single code createdYesbase_codeinfoA new QR code record is added to base_codeinfo
Single code created — with statusYesbase_codeinfo, code_state, code_state_log, table_d[x], table_relation, base_table_dataA new record is added to each affected table
Single code editedYesbase_codeinfoThe modified data in base_codeinfo is updated, overwriting the original
Single code deletedYesbase_codeinfoA QR code record is deleted from base_codeinfo
Single code deleted — with form dataYesbase_codeinfo, table_d[x], base_table_dataA record is deleted from each affected table
Single code deleted — with statusYesbase_codeinfo, code_state, table_d[x], code_state_log, base_table_dataA record is deleted from each affected table

2. Bulk Templates​

EventPushedAffected TablesBehavior
New bulk template createdNo--
New bulk template created — with statusYescode_state, code_state_logcode_state adds a status record for the template; code_state_log adds the initial status change log
Bulk template title editedNo--
Bulk template variable content edited — no sub-codesNo--
Bulk template variable content edited — with sub-codesNo--
Bulk template deleted — with sub-codesYesbase_codeinfo, template_codeinfo_[x]Corresponding records are deleted from each affected table
Bulk template deleted — with sub-codes/form dataYesbase_codeinfo, template_codeinfo_[x], base_table_data, table_d[x]Corresponding records are deleted from each affected table
Bulk template deleted — with sub-codes/statusYesbase_codeinfo, template_codeinfo_[x], code_state, code_state_logCorresponding records are deleted from each affected table
Sub-code createdYesbase_codeinfo, template_codeinfo_[x]Corresponding records are added to each affected table
Sub-code created — with statusYesbase_codeinfo, template_codeinfo_[x], code_state, code_state_logCorresponding records are added to each affected table
Sub-code deletedYesbase_codeinfo, template_codeinfo_[x]Corresponding records are deleted from each affected table
Sub-code deleted — with statusYesbase_codeinfo, template_codeinfo_[x], code_state, code_state_logCorresponding records are deleted from each affected table
Sub-code deleted — with form dataYesbase_codeinfo, template_codeinfo_[x], base_table_data, table_d[x]Corresponding records are deleted from each affected table
Sub-code editedYesbase_codeinfo, template_codeinfo_[x]If the sub-code name is edited: updates the corresponding record in base_codeinfo. If a variable content value is edited: updates the corresponding sub-code record in template_codeinfo_[x]

3. Forms​

The following events apply when form data exists; no push occurs if there is no form data.

EventPushedAffected TablesBehavior
Form deletedYestable_d[x], base_table_dataAll records in table_d[x] are deleted (table structure is retained); matching records are removed from base_table_data
Form component addedYestable_d[x]A new component field is added to table_d[x] with an empty value
Form component editedYestable_d[x]The original component field is retained with an empty value; the edited component field is added as a new column
Form component deletedYestable_d[x]The original component field is retained with an empty value
Form name editedYestable_d[x], table_relationThe form name is updated in table_d[x] and table_relation
Form data submittedYesbase_table_data, table_d[x], table_relation, base_auth_msgCorresponding records are added to each affected table
Form data pending reviewYesbase_table_data, table_d[x], table_relation, base_auth_msgCorresponding records are added to each affected table; differs from a regular submission in that base_table_data and table_d[x] include an additional review status field
Form data approved or rejectedYestable_d[x], base_table_dataThe review status field value is updated in table_d[x] and base_table_data
Form data editedYestable_d[x], base_table_dataThe specified record is updated in table_d[x] and base_table_data, overwriting the original
Form data deletedYestable_d[x], base_table_dataThe specified record is deleted from table_d[x] and base_table_data (table structure is retained)

4. Status​

Status-related data sync is delayed by 60 seconds.

EventPushedAffected TablesBehavior
Status group addedNo--
Status group name editedNo--
Status item name editedNo--
Status item added/deletedNo--
Status group deletedNo--
QR code status changedYestable_d[x], table_relation, base_table_data, code_state, code_state_log, base_auth_msgcode_state: if a record for this QR code exists, it is overwritten; otherwise a new record is added
QR code status changed after status group editedYestable_d[x], table_relation, base_table_data, code_state, code_state_logcode_state: the original status group field is retained with an empty value; the new status group field and its value are added
QR code status changed after status item editedYestable_d[x], table_relation, base_table_data, code_state, code_state_log, base_auth_msgcode_state: the value of the corresponding status item field is updated; code_state_log: a new status change record is added

5. Plan Management​

Data is only pushed after a plan starts executing (after creation or modification).

EventPushedAffected TablesBehavior
Plan createdNo--
Plan startedYesbase_task, code_task_logCorresponding records are added to each affected table
Plan overdueYescode_task_logThe status field value is updated in code_task_log; the execution time field is automatically set to the time of the status change
Plan deletedYesbase_task, code_task_logCorresponding records are deleted from each affected table
Plan editedYesbase_task, code_task_logIf the plan name is changed, the corresponding record in base_task is updated and overwritten

6. Follow-Up Actions​

EventPushedAffected TablesBehavior
Follow-up actions enabledNo--
Follow-up actions disabledNo--
Follow-up action submittedYesrecord_review_dataA new record is added to record_review_data
Follow-up action [Form] submittedYesrecord_review_data, base_table_data, table_d[x], table_relation, base_auth_msgA new record is added to record_review_data; the form submission logic is also re-run. The source record number field in table_d[x] will contain the record serial number of the linked form record
Follow-up action record deletedYesrecord_review_dataThe corresponding record is retained in record_review_data; the status field is changed to "Deleted"
Processing status markedYesrecord_review_dataA new record is added to record_review_data

7. Directories​

EventPushedAffected TablesBehavior
Directory renamedNo--
QR code moved to a different directoryYesbase_codeinfoThe directory field value is updated in base_codeinfo
Directory deletedYesbase_codeinfo, template_codeinfo_[x], table_d[x], base_table_data, code_state_log, code_state, code_task_logAll table data for QR codes in this directory is deleted (table fields are retained with empty values)

8. Members​

EventPushedAffected TablesBehavior
Basic member addedNo--
Advanced member addedYesbase_membersA new member record is added to base_members
Advanced member name editedYesbase_membersThe corresponding member record is updated in base_members
Advanced member deletedNo--

9. Todos​

Creating or completing a todo, or changing its information, updates base_todo. Deletion, hiding, and restoration follow the todo sync rules.

FAQ​

1. Data Is Not Being Pushed to the Private Database​

This is likely caused by a table encoding issue. Change the database encoding to utf8mb4.

2. After Renaming a QR Code, Why Isn't the QR Code Name Updated in the Form Data Table?​

QR code names in form data tables are not updated automatically. If you need the latest QR code name, use a LEFT JOIN with the base_codeinfo table on the code_id field.

3. After Renaming a Form Component, There Are Two Columns in the Table — One with the Old Name and One with the New Name.​

This is expected behavior. When a component is renamed, the original column is retained.

4. I Set Up a Filter to Exclude QR Codes with Abnormal Status Values in the Plan, but the Data Still Appears in the Table.​

The table contains all plan task data. Use the [是否过滤] (Is Filtered) field to determine whether a specific plan entry has been filtered. Note: filtering only takes effect in the next cycle after a status change.

5. After Activation, I Notice Some Data Is Missing​

First check whether the data is within the sync scope and review the historical sync rules for that data type. The initial sync needs to process existing data. Todos are backfilled after records and other data, so they may still be waiting for earlier steps to finish. If sync is not progressing normally, check the connection and permissions, or contact online support for troubleshooting.

6. Why Didn't the Database Update After I Edited a Form Field?​

Editing a form does not trigger a database update. Updates are only triggered when new form data is added or existing records are edited. Simply submitting a new record will trigger the update.

7. My Server Uses an Allowlist — How Do I Configure It?​

Contact technical support to get the list of CaoLiao outbound IP addresses.

8. Why Isn't There a Dynamic Data Table?​

Dynamic data is an aggregate of multiple data types, including form data and status change data. There is no dedicated dynamic data table in the pushed database. Select the form data table or status change data table as needed.

9. The Image Component Stores Multiple Image URLs Concatenated Together. How Do I Retrieve Individual Image URLs?​

Image component data is stored in the format urls_1,urls_2,.... The number of image URLs can vary. Here are SQL functions to extract individual image URLs — replace 照片_233233 with your actual field name:

urls_1: SUBSTRING_INDEX(照片_233233, ',', 1) urls_2: if( LENGTH(照片_233233) - LENGTH(REPLACE(照片_233233, ',', '')) >= 1, SUBSTRING_INDEX(SUBSTRING_INDEX(照片_233233, ',', 2), ',', -1) ,'') urls_3: if( LENGTH(照片_233233) - LENGTH(REPLACE(照片_233233, ',', '')) >= 2, SUBSTRING_INDEX(SUBSTRING_INDEX(照片_233233, ',', 3), ',', -1) ,'')
urls_3: if( LENGTH(照片_233233) - LENGTH(REPLACE(照片_233233, ',', '')) >= 3, SUBSTRING_INDEX(SUBSTRING_INDEX(照片_233233, ',', 4), ',', -1) ,'')

Continue incrementing the pattern for additional images.

10. Why Does the Todo Table Have No Assignee, or Why Can't I Find Deleted Todos?​

base_todo currently does not provide assignee or handling group columns. 完成人 (the person who completed the todo) is not a substitute for the assignee. This table only stores currently visible todos. Rows for deleted or hidden todos are removed during sync. For fields and deletion/restoration rules, see the Todo Data Table Reference.