Schema Editor

Customize database fields at runtime — add, rename, or remove columns with automatic FTS and VectorDB rebuild.

Restricted Access

The Schema Editor is available only to superadmin users. Schema changes affect the entire system's data structure.

Overview

The Schema Editor allows you to modify the database structure of the Pricing Database and Product Specifications at runtime — without writing SQL or restarting the server. All changes are versioned and auditable.

flowchart TB A[Schema Change
Add / Rename / Remove Field] --> B{Change Type} B -->|Add Field| C[ALTER TABLE
Add Column] B -->|Rename Field| D[Create New Table
Copy Data
Drop Old Table] B -->|Remove Field| E[Create New Table
Copy Data
Drop Old Table] C --> F[Rebuild FTS5 Index] D --> F E --> F F --> G[Rebuild VectorDB Embeddings] G --> H[Yes Schema Updated
Version Incremented] style A fill:#3B82F6,color:#fff style F fill:#F59E0B,color:#fff style G fill:#8B5CF6,color:#fff style H fill:#22C55E,color:#fff

Accessing the Schema Editor

  1. Navigate to Pricing Database or Product Specifications.
  2. Click the "Schema Editor" button at the top of the page (visible only to superadmin).
  3. A modal opens showing the current schema with all fields listed.
Schema Editor
Screenshot: Schema Editor modal with drag-sortable field list and inline badges

Field Properties

Each field in the schema has the following configurable properties:

PropertyTypeDescription
nameTextColumn name in the database (snake_case)
display_labelTextHuman-readable label shown in the UI
data_typeEnumtext, real, integer, or boolean
is_requiredBooleanWhether the field must be filled when adding records
default_valueTextDefault value for new records
format_hintEnumUI display format: currency, badge, textarea, boolean_badge
is_fts_indexedBooleanWhether this field is included in FTS5 full-text search
fts_weightRealFTS5 ranking weight (higher = more important in search)
is_vectordb_fieldBooleanWhether this field is included in VectorDB embeddings
vectordb_templateTextTemplate string for how this field appears in VectorDB text
sort_orderIntegerDisplay order in the UI (drag to reorder)

Schema Operations

Add Field

  1. Click "+ Add Field" in the Schema Editor.
  2. Enter the field name (snake_case), display label, data type, and other properties.
  3. Configure FTS settings (indexed? weight?) and VectorDB settings (included? template?).
  4. Click Save. The column is added via ALTER TABLE, and FTS/VectorDB rebuild is queued.
New Field Values

Existing records will have NULL (or the default value you specify) for the new field. You can bulk-update records via import/export if needed.

Edit Field

Click the Edit button next to any field. You can change the display label, required status, default value, format hint, FTS weight, VectorDB template, and other metadata.

Data Type Changes

You cannot change a field's data type after creation. To change the type, remove the field and re-add it (data in that column will be lost).

Rename Field

  1. Click "Rename" next to the field.
  2. Enter the new column name.
  3. The system creates a new table structure, copies all data, and drops the old table. FTS and VectorDB are rebuilt.

Remove Field

Data Loss Warning

Removing a field permanently deletes the column and all its data from every record. This cannot be undone. Export your data first if you need to preserve the values.

FTS & VectorDB Configuration

FTS Weights

Each text field can be included in FTS5 search with a configurable weight. Higher weights make matches in that field rank higher in search results.

WeightMeaningExample
2.0Very high priorityproduct_name
1.5High prioritycategory
1.0Normal prioritydescription, sku
0.5Low prioritycurrency, unit

VectorDB Templates

The VectorDB template defines how a field's value is represented in the text that gets embedded. Use {value} as a placeholder.

Example templates:

Product: {value}
Category: {value}
Price is {value} IDR

Schema History & Diff

Version History

Every schema change creates a new version. The History tab shows a timeline of all changes with timestamps and descriptions.

Schema Diff

Compare any two versions side-by-side. The diff shows:

Schema diff
Screenshot: Schema history timeline and side-by-side diff viewer

Rebuild Status

After schema changes, FTS and VectorDB indexes need to be rebuilt. This happens automatically but you can also trigger a manual rebuild.

sequenceDiagram actor Admin as Superadmin participant SE as Schema Editor participant DB as SQLite participant FTS as FTS5 Index participant VDB as ChromaDB Admin->>SE: Add new field SE->>DB: ALTER TABLE ADD COLUMN SE->>FTS: Queue FTS rebuild SE->>VDB: Queue VectorDB rebuild FTS-->>SE: Rebuild progress (0%...100%) VDB-->>SE: Rebuild progress (0%...100%) SE-->>Admin: Yes Schema v2 ready