Skip to content

Schema column-level — Platform Core ​

Version: 1.0
Date: 2026-11-25
Status: Working baseline (foundation + profile/avatar + account_preferences PROPOSED; invitation revoked Owner-confirmed)
Owner repo: platform-core/
Schema: platform_core (D-022)

Migrated/refined từ hub platform-docs/architecture/database/01-platform-core.md. Hub giữ stub/ref.

1. Identity ​

Khái niệmOwnerLưu
Password / federated / sessionKeycloakChỉ IdP
acc_…Platform Coreaccounts.id
Link IdPPlatform Coreaccounts.keycloak_subject UNIQUE

2. accounts ​

CộtKiểuNullNguồnGhi chú
idTEXT PKNOCore acc_+NanoIDD-017
keycloak_subjectTEXT UKNOKeycloak sub1:1
emailTEXTYESKeycloak mirrorLowercase; khớp invite
display_nameTEXTYESSeed IdP; sau user=SoTensure không đè nếu user sửa (PROPOSED)
avatar_file_idTEXTYESUser via FSPROPOSED soft-ref
statusactive|inactiveNOCore
last_workspace_idTEXTYESCore switchSoft-ref; repair → Personal
last_login_atTIMESTAMPTZYESCore loginPROPOSED
created_at / updated_atTIMESTAMPTZNOCore

Không cột password.

3. account_preferences (PROPOSED) ​

1:1 với Account.

CộtKiểuNullGhi chú
account_idTEXT PK FKNO
localeTEXTNOvd. vi — danh sách OPEN
timezoneTEXTNOIANA
themeTEXTNOsystem|light|dark PROPOSED
email_notifications_enabledBOOLEANNOdefault true; chi tiết loại = DEFERRED
created_at / updated_atTIMESTAMPTZNO

4. workspaces ​

CộtKiểuNullGhi chú
idTEXT PKNOws_…
typepersonal|organizationNO
nameVARCHAR(120)NO
owner_account_idTEXT FKNOacc_…
statusactive|inactiveNO
created_at / updated_atTIMESTAMPTZNO

Invariant: một personal / owner_account_id.

5. workspace_memberships ​

CộtKiểuNullGhi chú
idTEXT PKNOwsm_…
workspace_idTEXT FKNO
account_idTEXT FKNO
platform_roleowner|admin|memberNO
statusactive|inactive|removedNO
created_at / updated_atTIMESTAMPTZNO

Unique (workspace_id, account_id).

6. workspace_invitations ​

Chỉ Organization.

CộtKiểuNullGhi chú
idTEXT PKNOwsi_…
workspace_idTEXT FKNOReject nếu Personal
invitee_emailTEXTNOLowercase
invited_roleowner|admin|memberNONghiệp vụ: không mời owner
statuspending|accepted|declined|expired|revokedNOrevoked = Owner-confirmed mở rộng
invited_by_account_idTEXT FKNOowner|admin
expires_atTIMESTAMPTZNOdefault now+7d
created_at / updated_atTIMESTAMPTZNO

7. audit_events ​

CộtKiểuNullGhi chú
idTEXT PKNOaud_…
actor_account_idTEXT FKYES
actionTEXTNOvd. account.provisioned, invite.* , membership.removed; future families PROPOSED
workspace_idTEXTYESSoft-ref
target_account_idTEXTYESSoft-ref
payloadJSONBNOKhông secret/token
created_atTIMESTAMPTZNOAppend-oriented

8. Future tables (PROPOSED) ​

VùngÝ địnhStatus
Application registryapp_…PROPOSED
Platform API credentialsHash/rotate/revoke (D-018)PROPOSED
Catalog / launchShell discoveryPROPOSED
Entitlement / subscription hooksAccount và/hoặc WSPROPOSED — không Payment/Invoice sâu
Platform configurationFlags toàn nền tảngPROPOSED/OPEN
application_workspacesEnable app trên WSPROPOSED
app_role_assignmentsApp rolesPROPOSED

Attribute-level chi tiết có thể mở rộng (discovery cho phép PROPOSED mới; không invent DECIDED).

9. Ngoài phạm vi ​

Application domain DB · File Service metadata/bytes · Keycloak sessions · Chat/Payment/Invoice · ownership transfer history (OPEN).

platform-core/docs = SoT chi tiết Platform Core · hub platform-docs giữ overview + stub/ref