Skip to content

users

Platform learners.

  • ETL strategy: merge
  • PK: id

Columns

ColumnTypeDescription
idBIGINTPK.
id_tenantBIGINTFK → tenants.id. Which instance the learner belongs to.
is_freeBOOLEANLearner on the free tier.
nameTEXTFull name.
emailTEXTEmail (not unique — the same address may exist in different tenants).
phoneVARCHAR(50)Mobile phone.
documentVARCHAR(50)National document (CPF/CNPJ or equivalent).
scoreINTEGERCumulative gamification score.
started_atTIMESTAMPTZWhen the learner first started using the platform.
last_access_atTIMESTAMPTZMost recent access.
created_atTIMESTAMPTZAccount creation.
deleted_atTIMESTAMPTZSoft delete.

Relationships

Patterns

sql
-- Active learners (not deleted, with active tenant)
SELECT u.*
FROM lms.users u
JOIN lms.tenants t ON t.id = u.id_tenant AND t.deleted_at IS NULL
WHERE u.deleted_at IS NULL;

-- Active paying learners
SELECT count(*) FROM lms.users
WHERE deleted_at IS NULL AND is_free = FALSE;

OpenDB · Cademi LMS Data Warehouse