Uploaded Customer Database
Overview
This domain is a small set of tables for storing customer data tables uploaded as CSV directly into the database. Their purpose is to act as a lookup source while a user fills in a form: when someone enters an ID number or phone number, the system searches these tables and auto-fills the remaining fields — a flow known as profile mapping.
The whole set is created through manual SQL, so none of it appears in schema.prisma. It hooks into the form builder through the form_builder.profile_mapping JSONB column.
Core Data Structure
customer_database
Metadata for one uploaded dataset: line_oa_id, name, description, a columns JSONB column defining the CSV's column layout, the row_count counter, status, and the standard audit columns (created_by / created_at / updated_by / updated_at).
customer_database_row
The row-level data, linked back via database_id (FK to customer_database.id with ON DELETE CASCADE), with each entire row stored as a JSON object in the data JSONB column.
Lookups are backed by an index on (database_id) plus a GIN index using jsonb_path_ops on data, which makes searching for values inside a row fast.
form_builder.profile_mapping
A JSONB column on the form builder table that configures, per form, which database to use, which key to search on, and which fields to populate from the result. It also carries an otp sub-key for selecting which fields must be OTP-verified.
Related Files
manual-sql/6.customer_database.sql— creates both tables and adds theform_builder.profile_mappingcolumn (noted as applied to preprod on 2026-07-02)schema-dumps/2026-07-24/schema.sql:1611and:1650
Connections to Other Services
- cms-api-go — serves the
customer-databasemodule (registered inseed-data/01.system_module.sql), covering CSV upload, data preview, and mapping configuration on the form builder screen. - client-api-go — performs the row lookup when a user submits a form, in order to auto-fill their profile.
- Connects directly to Form Builder; the final values land in
line_user.custom_attribute, described in LINE Friends.