schema-ownership

activetype/docdomain/anabatic

PMS — schema ownership (what is not pms_schema)

TL;DR

pms_schema holds PMS-owned tables (t_project, m_customer, and children). portal_schema owns m_entity and m_employee — PMS only references them. m_agreement is read from CMS (cover_letters). No Arsi/Conexus API at launch — customer rows are created in PMS (POST /customers or inline on projects). Conexus/CMS catalogs are optional lookup only. Chat and notifications (Claim port) use Portal uam / pms_schema chat tables.

portal_schema — not provisioned by PMS

From backend-pms-dev/script/initial_table.sql prerequisites:

TableUsed by PMSSource
portal_schema.m_entityt_project.entity_codem_entity.codeProject portal
portal_schema.m_employeet_project.created_id, updated_id; t_project_pic.user_id; t_doc.uploaded_by_user_idPortal SSO

TypeORM layout ( backend-pms-dev ):

FolderEntitiesSchema constant
src/entity/portal/EntityMaster (m_entity), Employee (m_employee)PORTAL_SCHEMA
src/entity/pms/Customer (m_customer)PMS_SCHEMA
src/entity/cms/CoverLetter, CounterPartyCMS_SCHEMA via cms connection (optional customer lookup)
src/entity/portal/EntityMaster (m_entity), Employeeportal_schema — PMS entity master (not CMS m_entity)
src/entity/pms/t_project + children, m_doc_type, m_service_category, …PMS_SCHEMA

Portal entities are read/join targets — not created in initial_table.sql.

pms_schema — owned by PMS (created in initial_table.sql)

GroupTables
Masters (PMS DB)m_entity, m_customer, m_doc_type, m_service_category, m_tran_code_seq
Transactionalt_project, t_project_pic, t_pid_link, t_sale_line, t_sale_plan, t_cogs_line, t_cogs_plan, t_doc

External source of truth (ERD — logical masters)

Per Project Manager/ERD.md — PMS stores FKs + snapshots on t_project; it does not own the canonical row in the source system:

PMS-facingSource of truthOrigin
m_customerpms_schema.m_customerPMS (app CRUD)
m_agreementcover_letterCMS
m_employeem_employeePortal SSO (portal_schema at DB layer)

m_entity is portal-owned at the DB layer (see prerequisites in SQL); treat like SSO catalog data, not PMS-authored master data.

Outside pms_schema — chat & notifications (Claim port)

Not in PMS ERD tables; live on Portal / Claim DB connections:

ModuleTypical entitiesSchema / connection
notificationFcmToken, UserNotificationportal_schema via uam
chatConversation, Message, …pms_schema via uam (context_type=project)

See [[Projects/anabatic-project-manager/backlog/p1-import-claim-chat-notification-modules]].

Agent / implementation notes

  • Do not add CREATE TABLE for m_entity or m_employee under pms_schema.
  • Set DB_PMS_DB_SCHEMA, DB_PORTAL_DB_SCHEMA, DB_CMS_DB_SCHEMA in env (src/entity/schemas.ts). Do not put portal/cms entity files under entity/pms/ except PMS-owned masters.
  • Masters OpenAPI routes (/entities, /employees, …) should read external catalogs, not imply PMS owns the physical table in pms_schema.

Related

  • SQL: Project Manager/backend-pms-dev/script/initial_table.sql (header comments)
  • ERD shared masters: Project Manager/ERD.md