Skip to content

products

Products / courses sold or offered by the platform.

  • ETL strategy: merge
  • PK: id

Columns

ColumnTypeDescription
idBIGINTPK.
id_tenantBIGINTFK → tenants.id.
id_originBIGINTParent product id when replicated across tenants. Joins with track_products / exam_results use COALESCE(id_origin, id) to resolve replicas.
id_showcaseBIGINTFK → showcases.id. Showcase the product appears in.
is_freeBOOLEANFree access.
is_draftBOOLEANUnpublished draft.
is_not_listedBOOLEANHidden from the public listing.
is_hiddenBOOLEANFully hidden.
positionINTEGERDisplay order.
titleTEXTProduct name.
metaJSONBProduct configuration. Currently exposes the certificate group. See structure below.
meta_overrideJSONBOverrides on top of the parent product (when replicated). Same shape as meta, restricted to override-friendly keys. NULL if no override.
created_atTIMESTAMPTZ
deleted_atTIMESTAMPTZ

meta structure

Domain-grouped JSONB. Any key may be absent — empty branches are stripped.

json
{
  "certificate": {
    "is_active",
    "is_unique_emission",
    "show_back",
    "show_dates",
    "show_product_name",
    "logo_theme",
    "file",
    "content",
    "taught_by",
    "workload",
    "availability": { "mode", "exam_id" | "progress_threshold" | "period" },
    "fields": {
      "name":   { "color", "font" },
      "date":   { "is_active", "color", "font" },
      "doc":    { "is_active", "color", "font" },
      "seq":    { "is_active", "color", "font", "source" },
      "qrcode": { "is_active", "color", "background", "position" }
    }
  }
}

meta.certificate

PathTypeMeaning
is_activebooleanCertificate enabled for the product.
is_unique_emissionbooleanOnly one certificate per learner is allowed; reissues are blocked.
show_backbooleanRender the certificate back side.
show_datesbooleanPrint start/end dates on the certificate.
show_product_namebooleanPrint the product name on the certificate.
logo_themestringLogo theme variant key.
filestringCertificate template/file reference.
contentstringCertificate body text.
taught_bystringInstructor / authoring entity printed on the certificate.
workloadstringCourse workload printed on the certificate (e.g. 40h).
availabilityobjectWhen the certificate is unlocked. Polymorphic — see below.
fieldsobjectPer-element rendering settings (color, font, on/off). See below.

meta.certificate.availability (polymorphic)

Only one of these shapes will be present, identified by mode:

modeExtra fieldsMeaning
examexam_id: integerAvailable after the learner passes a specific exam.
progressprogress_threshold: integer (0–100)Available after the learner reaches a course-progress percentage.
periodperiod: string (e.g. +2 weeks, +30 days)Available after a fixed delay from enrollment.
open(none)Available immediately.

meta.certificate.fields.<element>

Each rendering element shares the same shape, with subtle differences:

Elementis_activecolorfontExtras
name(always rendered)
date
doc
seqsource: "tenant" | "product"
qrcodebackground, position

meta_override

When a product is replicated across tenants, the child can override certain certificate keys. meta_override mirrors the same JSON shape as meta (restricted to override-friendly keys — no availability, no seq.source), so consumers can union the two without key rewrites:

sql
-- Effective certificate config (override > parent)
SELECT id,
       title,
       COALESCE(meta_override->'certificate', meta->'certificate') AS effective_certificate
FROM lms.products
WHERE deleted_at IS NULL;

Relationships

"Origin product" pattern

When a product is replicated across tenants, id_origin points back to the original. For queries that span tenants or need to consolidate by course (not by replica), use COALESCE(id_origin, id) as the canonical key:

sql
SELECT COALESCE(id_origin, id) AS product_key, count(*)
FROM lms.products
WHERE deleted_at IS NULL
GROUP BY product_key;

OpenDB · Cademi LMS Data Warehouse