Updated Data Model Reference

evergreenLast update on Sep 2, 2026
Download .md

Updated Data Model Reference

This document explains data-model.updated.dbml, the expanded PostgreSQL schema for AIS.

The model covers the full asset lifecycle:

  1. Asset master data and organizational context
  2. Receiving and inspection
  3. Onboarding and tag issuance
  4. Assignment and handoff
  5. Maintenance and service
  6. Compliance and disposal
  7. Approvals, notifications, reporting, and audit

Model Characteristics

CharacteristicMeaning
Multi-tenantMost business tables carry organization_id so data is isolated per organization.
Public vs internal IDspublic_id UUIDs are API-safe identifiers; BIGSERIAL IDs are internal relational keys.
PostgreSQL-firstThe schema assumes PostgreSQL features such as CITEXT, JSONB, INET, generated UUIDs, and strong indexing support.
Audit-friendlyBusiness events and forensic audit events are both modeled explicitly.
Workflow-orientedReceiving, onboarding, assignment, maintenance, approval, and disposal all have dedicated workflow tables and statuses.
Optimistic concurrencySeveral mutable workflow tables include a version column.
Soft deletion where neededMaster/reference entities often use deleted_at instead of hard deletion.

Core Conventions

ConventionUse
created_at, updated_atStandard timestamps for mutable tables
deleted_atSoft delete marker on reference/master tables
idempotency_keyDeduplicates retried writes for workflow actions
JSONB payloadsFlexible import data, validation errors, binding proof, metadata, and audit detail
Status enumsKeep lifecycle transitions explicit and queryable

Functional Areas

Organization and Access Control

TablePurpose
organizationRoot tenant record with name, code, default currency, and timezone.
departmentDepartment hierarchy within one organization.
locationPhysical site or sub-location hierarchy for receiving, storage, and assignment.
app_userSystem user tied to an organization and optionally a department.
teamNamed team inside an organization.
team_memberMembership bridge between users and teams.
roleOrganization-scoped role definition.
user_roleUser-to-role assignment bridge.
permissionGlobal permission catalog by module and action.
role_permissionRole-to-permission grant bridge.

Parties, Vendors, and Asset Classification

TablePurpose
vendorSupplier, service provider, or manufacturer reference.
partyReusable assignment/handoff participant abstraction over user, team, department, or vendor.
asset_categoryCategory hierarchy with default useful life and required field rules.
asset_modelNormalized equipment model linked to category and optional manufacturer vendor.
documentFile metadata store for uploaded evidence and attachments.

Receiving and Inspection

TablePurpose
goods_receiptReceiving header for a delivery or purchase arrival.
goods_receipt_lineExpected, delivered, accepted, and rejected quantities per line item.
receiving_inspectionInspection results for delivered units.
replacement_requestFollow-up request when delivered items fail or need vendor replacement.
goods_receipt_documentReceipt-to-document attachment bridge.

Receiving is designed for operational traceability:

  • goods_receipt.status tracks the business stage from draft through approval and closure.
  • goods_receipt_line separates expected, delivered, accepted, and rejected quantities.
  • Inspection and replacement are modeled separately so mismatches do not get flattened into one status field.

Onboarding and Asset Creation

TablePurpose
asset_onboarding_batchImport or manual creation batch for turning received items into assets.
asset_onboarding_itemRow-level onboarding decision, validation, and created asset/tag linkage.
assetCurrent state projection for an asset.
financial_profileOne-to-one financial view for acquisition and depreciation data.

Important design detail:

  • asset is the current read model.
  • asset_event and audit_event preserve history.
  • asset_onboarding_item connects the source row to the eventual asset and optional asset_tag.

Tag Inventory and Scanning

TablePurpose
tag_batchProcurement or generation batch for asset tags.
asset_tagIndividual tag record that may be in storage, attached, replaced, or retired.
tag_scanImmutable scan log for onboarding, handoff, maintenance, and other field operations.

The schema supports a staged tag lifecycle:

  • Tags can exist before attachment.
  • Tags can be stored at a location.
  • Replacements preserve linkage through replaced_tag_id.
  • Scan history is preserved separately from current tag state.

Assignment and Handoff

TablePurpose
asset_assignmentAssignment of an asset to a person, team, or location.
handoff_transactionTransfer workflow between parties or locations.
handoff_lineAsset-level release and receipt evidence within a handoff.
discrepancyMismatch or exception raised during receipt, handoff, or asset verification.

This part of the model separates steady-state custody from transfer workflow:

  • asset_assignment represents who or where the asset is assigned.
  • handoff_transaction represents the act of moving custody.
  • handoff_line captures release and acceptance evidence per asset.
  • asset.current_location_id and asset.current_custodian_party_id are read-optimized projections, not the only source of truth.

Maintenance and Service

TablePurpose
service_requestUser-submitted repair or support request for an asset.
maintenance_scheduleRecurring preventive maintenance definition.
work_orderExecutable maintenance or repair job.
maintenance_inspectionInspection findings during maintenance work.
stock_itemSpare part or consumable inventory.
work_order_materialMaterial requirement and issuance for a work order.
work_order_documentWork-order attachment bridge.

This lets AIS track both reactive and planned work:

  • Service requests can be triaged into work orders.
  • Maintenance schedules can generate recurring work.
  • Work orders can be in-house or vendor-managed.
  • Material issuance is normalized instead of being embedded in the work order payload.

Compliance, Review, and Disposal

TablePurpose
compliance_itemWarranty, certificate, lease, inspection, license, or other due item.
asset_reviewReview decision tied to an asset and optionally a compliance item.
disposal_caseControlled disposal workflow with finance and execution fields.
asset_documentAsset-to-document attachment bridge.
disposal_documentDisposal-case attachment bridge.

This area supports end-of-life and obligation tracking:

  • Compliance items can recur and escalate through due dates.
  • Reviews capture management decisions such as retain, renew, or dispose.
  • Disposal is not a terminal flag on asset; it has its own governed case.

Approvals, Notifications, and Decisions

TablePurpose
approval_requestWorkflow header for approval of receipts, onboarding, work orders, or disposal.
approval_stepIndividual approval routing steps by user or role.
notificationUser notification queue with optional linkage to operational entities.
management_decisionCaptures higher-level decisions derived from reports or operational findings.

Notable pattern:

  • approval_request uses multiple optional foreign keys but requires exactly one subject entity.
  • approval_step supports assignment to either a specific user or a role.
  • notification is a delivery log, not just a template catalog.

Events and Forensic Audit

TablePurpose
asset_eventBusiness-facing asset timeline.
audit_eventAppend-only forensic audit envelope for reads, writes, workflow actions, failures, and denied actions.
audit_changeField-level before/after diff per audit event.
audit_event_assetBridge for relating one audit event to one or more assets.

The model deliberately keeps two history layers:

History LayerPurpose
asset_eventEasy-to-read lifecycle narrative for asset operations
audit_event + audit_changeCompliance-grade evidence with actor, trigger, request, and diff details

Key Lifecycle Flow

flowchart LR
    A[goods_receipt] --> B[goods_receipt_line]
    B --> C[receiving_inspection]
    B --> D[asset_onboarding_batch]
    D --> E[asset_onboarding_item]
    E --> F[asset]
    E --> G[asset_tag]
    F --> H[asset_assignment]
    H --> I[handoff_transaction]
    F --> J[service_request]
    J --> K[work_order]
    F --> L[compliance_item]
    L --> M[asset_review]
    M --> N[disposal_case]
    F --> O[asset_event]
    O -. linked evidence .-> P[audit_event]

Important Enums

Asset and Tag Status

EnumValues
asset_statuspending_receipt, pending_registration, pending_tagging, in_storage, ready_for_use, assigned, in_use, in_transit, under_inspection, under_repair, on_hold, lost, retired, disposed
ownership_typeowned, leased, rented, borrowed, byod, vendor
tag_kindpermanent, temporary, alternate
tag_technologyqr, rfid, barcode, nfc, manual, other
asset_tag_statusordered, received, generated, printed, stored, attached, verified, unreadable, damaged, replaced, removed, retired

Receiving and Onboarding

EnumValues
receipt_statusdraft, expected, received, inspecting, partially_accepted, accepted, rejected, pending_approval, approved, replacement_pending, closed
receipt_line_statuspending, matched, mismatched, partially_accepted, accepted, rejected
inspection_resultpending, passed, failed, conditional
onboarding_statusdraft, validating, validation_failed, ready_for_review, confirmed, processing, completed, cancelled
onboarding_item_statuspending, invalid, valid, selected, tag_confirmed, created, skipped
onboarding_sourcemanual, file_import, gan, receipt, api

Assignment, Maintenance, and Compliance

EnumValues
assignment_typepersonal, team, location
assignment_statuspending_collection, in_transit, pending_acceptance, active, overdue, returned, cancelled
handoff_statusdraft, scheduled, open, in_transit, overdue, closed, cancelled
service_request_statussubmitted, triaged, converted, rejected, cancelled, closed
work_order_statusdraft, pending_approval, approved, assigned, in_progress, waiting_for_parts, with_vendor, completed, closed, cancelled
compliance_statusupcoming, due, overdue, completed, waived, cancelled
compliance_typewarranty, certificate, maintenance, lease, inspection, license, other
review_decisionrenew, retain, dispose, reinstate, investigate
disposal_statusdraft, pending_financial_review, pending_approval, approved, executed, cancelled

Audit and Notification

EnumValues
approval_statuspending, in_review, approved, rejected, cancelled
approval_step_statuspending, approved, rejected, skipped
notification_statusqueued, sent, delivered, read, failed, cancelled
asset_event_typecreated, updated, received, inspected, assigned, transferred, returned, tagged, retagged, scanned, repair_requested, repair_started, repaired, moved, lost, found, retained, reinstated, disposed, status_changed, discrepancy_reported
audit_actor_typeuser, service_account, scheduled_job, integration, anonymous
audit_action_typecreate, read, update, delete, restore, approve, reject, assign, transition, import, export, login, logout, system_action
audit_trigger_typeuser_action, api, import, workflow, schedule, integration, migration
audit_outcomesuccess, failure, denied, partial
audit_change_typeadd, replace, remove

Critical Integrity Rules

The DBML notes several invariants that should be enforced with database constraints, partial indexes, triggers, or application safeguards.

AreaRule
partyExactly one of user_id, team_id, department_id, or vendor_id should be set, and it must match party_type.
goods_receipt_lineQuantities must be non-negative, and accepted plus rejected cannot exceed delivered.
asset_tagA tag can remain unattached in inventory, but attached or verified states require a valid asset relationship.
asset_assignmentLocation assignments require assignee_location_id; personal or team assignments require assignee_party_id.
asset_assignmentOnly one active assignment per asset should exist at a time, using a partial unique index on open assignments.
approval_requestExactly one subject foreign key should be populated.
approval_stepExactly one approver target should be set: approver_user_id or approver_role_id.
audit_eventTreat as append-only; application roles should not update or delete it.

Indexing and Query Shape

The schema already reflects the main operational query patterns:

  • Per-organization unique business references such as receipt_no, batch_no, reference_no, sku, and asset_code
  • Dashboard and worklist filters by (organization_id, status, timestamp)
  • Timeline queries by (asset_id, occurred_at) for asset_event
  • Assignment, due, and notification queues filtered by due date or scheduled date
  • Search and reconciliation helpers such as serial numbers, vendor batch numbers, and scanned codes
  • Keep public_id as the external identifier in APIs and UI routes.
  • Enforce tenant isolation consistently in queries, foreign-key checks, and row-level security if enabled.
  • Use version for optimistic locking on mutable workflow records.
  • Treat asset.current_location_id and asset.current_custodian_party_id as projections that must stay transactionally aligned with assignment and handoff writes.
  • Partition audit_event by occurred_at if audit volume is expected to grow quickly.
  • Use immutable external storage for audit exports if regulatory retention matters.

Source of Truth

Use data-model.updated.dbml as the schema source of truth for detailed fields, indexes, and foreign keys. This document is the human-readable companion for architecture, implementation planning, and review.

Complete Field Catalog

This catalog lists every field declared in the DBML. Attributes are reproduced from the schema; a dash means the field has no explicit DBML attribute. Foreign-key targets and indexes remain defined in the source DBML.

organization

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
nameTEXT[not null]
codeTEXT[not null, unique]
default_currencyCHAR(3)[not null, default: ‘BDT’]
timezoneTEXT[not null, default: ‘Asia/Dhaka’]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

department

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
parent_department_idBIGINT-
nameTEXT[not null]
codeTEXT[not null]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

location

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
parent_location_idBIGINT-
nameTEXT[not null]
codeTEXT[not null]
location_typeTEXT-
addressTEXT-
incharge_user_idBIGINT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

app_user

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
department_idBIGINT-
employee_noTEXT-
nameTEXT[not null]
emailCITEXT[not null]
statususer_status[not null, default: ‘active’]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

team

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
department_idBIGINT-
nameTEXT[not null]
codeTEXT[not null]
lead_user_idBIGINT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

team_member

FieldPostgreSQL typeDeclared attributes
team_idBIGINT[not null]
user_idBIGINT[not null]
joined_atTIMESTAMPTZ[not null, default: now()]
left_atTIMESTAMPTZ-

role

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
nameTEXT[not null]
descriptionTEXT-
is_system_roleBOOLEAN[not null, default: false]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

user_role

FieldPostgreSQL typeDeclared attributes
user_idBIGINT[not null]
role_idBIGINT[not null]
assigned_atTIMESTAMPTZ[not null, default: now()]
assigned_byBIGINT-

permission

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
moduleTEXT[not null]
actionTEXT[not null]
descriptionTEXT-
created_atTIMESTAMPTZ[not null, default: now()]

role_permission

FieldPostgreSQL typeDeclared attributes
role_idBIGINT[not null]
permission_idBIGINT[not null]
assigned_atTIMESTAMPTZ[not null, default: now()]
assigned_byBIGINT-

vendor

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
vendor_codeTEXT[not null]
nameTEXT[not null]
contact_nameTEXT-
emailCITEXT-
phoneTEXT-
activeBOOLEAN[not null, default: true]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

party

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
party_typeparty_type[not null]
user_idBIGINT-
team_idBIGINT-
department_idBIGINT-
vendor_idBIGINT-
created_atTIMESTAMPTZ[not null, default: now()]

asset_category

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
parent_category_idBIGINT-
nameTEXT[not null]
codeTEXT[not null]
default_useful_life_monthsINT-
required_fieldsJSONB[not null, default: ’{}‘]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

asset_model

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
category_idBIGINT[not null]
manufacturer_vendor_idBIGINT-
model_nameTEXT[not null]
model_numberTEXT-
default_attributesJSONB[not null, default: ’{}‘]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

document

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
file_nameTEXT[not null]
storage_keyTEXT[not null, unique]
mime_typeTEXT-
file_size_bytesBIGINT-
checksum_sha256TEXT[not null]
sourceTEXT-
ocr_statusTEXT-
extracted_dataJSONB-
uploaded_byBIGINT-
uploaded_atTIMESTAMPTZ[not null, default: now()]
retention_untilDATE-
legal_holdBOOLEAN[not null, default: false]
metadataJSONB[not null, default: ’{}‘]

goods_receipt

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
receipt_noTEXT[not null]
delivery_note_noTEXT-
purchase_order_noTEXT-
vendor_idBIGINT-
receiving_location_idBIGINT[not null]
finance_owner_idBIGINT-
receiving_officer_idBIGINT-
statusreceipt_status[not null, default: ‘draft’]
source_methodonboarding_source[not null, default: ‘manual’]
expected_atTIMESTAMPTZ-
arrived_atTIMESTAMPTZ-
received_atTIMESTAMPTZ-
approved_atTIMESTAMPTZ-
rejection_reasonTEXT-
notesTEXT-
idempotency_keyTEXT-
versionINT[not null, default: 1]
created_byBIGINT[not null]
updated_byBIGINT[not null]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

goods_receipt_line

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
goods_receipt_idBIGINT[not null]
line_noINT[not null]
asset_model_idBIGINT-
item_descriptionTEXT[not null]
vendor_item_referenceTEXT-
expected_quantityINT[not null]
delivered_quantityINT[not null, default: 0]
accepted_quantityINT[not null, default: 0]
rejected_quantityINT[not null, default: 0]
statusreceipt_line_status[not null, default: ‘pending’]
mismatch_reasonTEXT-
condition_notesTEXT-
unit_costNUMERIC(14,2)-
currencyCHAR(3)-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

receiving_inspection

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
goods_receipt_line_idBIGINT[not null]
inspected_byBIGINT[not null]
inspected_atTIMESTAMPTZ[not null, default: now()]
resultinspection_result[not null, default: ‘pending’]
inspected_quantityINT[not null]
passed_quantityINT[not null, default: 0]
failed_quantityINT[not null, default: 0]
checklistJSONB[not null, default: ’{}‘]
condition_notesTEXT-
failure_reasonTEXT-

replacement_request

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
goods_receipt_line_idBIGINT[not null]
vendor_idBIGINT-
requested_quantityINT[not null]
reasonTEXT[not null]
statusTEXT[not null, default: ‘open’]
vendor_referenceTEXT-
requested_byBIGINT[not null]
requested_atTIMESTAMPTZ[not null, default: now()]
resolved_atTIMESTAMPTZ-

goods_receipt_document

FieldPostgreSQL typeDeclared attributes
goods_receipt_idBIGINT[not null]
document_idBIGINT[not null]
document_typeTEXT[not null, note: ‘Examples: delivery_note, acceptance_letter, inspection_evidence’]
created_atTIMESTAMPTZ[not null, default: now()]

asset_onboarding_batch

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
batch_noTEXT[not null]
sourceonboarding_source[not null]
modecreation_mode[not null]
goods_receipt_idBIGINT-
source_document_idBIGINT-
source_systemTEXT-
statusonboarding_status[not null, default: ‘draft’]
total_rowsINT[not null, default: 0]
valid_rowsINT[not null, default: 0]
invalid_rowsINT[not null, default: 0]
validation_summaryJSONB[not null, default: ’{}‘]
idempotency_keyTEXT-
confirmed_byBIGINT-
confirmed_atTIMESTAMPTZ-
created_byBIGINT[not null]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

asset_onboarding_item

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
onboarding_batch_idBIGINT[not null]
row_noINT[not null]
goods_receipt_line_idBIGINT-
statusonboarding_item_status[not null, default: ‘pending’]
raw_dataJSONB[not null, default: ’{}‘]
normalized_dataJSONB[not null, default: ’{}‘]
validation_errorsJSONB[not null, default: ’[]‘]
selectedBOOLEAN[not null, default: true]
asset_tag_idBIGINT-
asset_idBIGINT-
confirmed_byBIGINT-
confirmed_atTIMESTAMPTZ-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

asset

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_codeTEXT[not null]
nameTEXT[not null]
descriptionTEXT-
asset_model_idBIGINT-
category_idBIGINT[not null]
serial_numberTEXT-
manufacturer_serial_normalizedTEXT-
vendor_batch_noTEXT-
statusasset_status[not null, default: ‘pending_registration’]
ownership_typeownership_type[not null]
department_idBIGINT-
current_location_idBIGINT-
current_custodian_party_idBIGINT-
goods_receipt_line_idBIGINT-
acquisition_dateDATE-
commissioned_atTIMESTAMPTZ-
retired_atTIMESTAMPTZ-
disposed_atTIMESTAMPTZ-
condition_codeTEXT-
attributesJSONB[not null, default: ’{}‘]
search_textTEXT[note: ‘Maintained by trigger or generated column for full-text search’]
versionINT[not null, default: 1, note: ‘Optimistic locking token’]
created_byBIGINT[not null]
updated_byBIGINT[not null]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]
deleted_atTIMESTAMPTZ-

financial_profile

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
asset_idBIGINT[not null, unique]
acquisition_costNUMERIC(14,2)-
accumulated_depreciationNUMERIC(14,2)[not null, default: 0]
book_valueNUMERIC(14,2)-
depreciation_methodTEXT-
useful_life_monthsINT-
residual_valueNUMERIC(14,2)-
capitalization_dateDATE-
last_depreciation_dateDATE-
currencyCHAR(3)[not null, default: ‘BDT’]
updated_byBIGINT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

tag_batch

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
batch_noTEXT[not null]
sourcetag_source[not null]
technologytag_technology[not null]
vendor_idBIGINT-
purchase_order_referenceTEXT-
ordered_quantityINT-
received_quantityINT-
ordered_atTIMESTAMPTZ-
received_atTIMESTAMPTZ-
created_byBIGINT[not null]
created_atTIMESTAMPTZ[not null, default: now()]

asset_tag

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_idBIGINT-
tag_batch_idBIGINT-
tag_codeTEXT[not null]
kindtag_kind[not null, default: ‘permanent’]
technologytag_technology[not null]
sourcetag_source[not null]
statusasset_tag_status[not null, default: ‘generated’]
stored_location_idBIGINT-
binding_proofJSONB[not null, default: ’{}‘]
generated_atTIMESTAMPTZ-
printed_atTIMESTAMPTZ-
attached_atTIMESTAMPTZ-
attached_byBIGINT-
verified_atTIMESTAMPTZ-
verified_byBIGINT-
readability_checked_atTIMESTAMPTZ-
is_readableBOOLEAN-
replaced_tag_idBIGINT-
removal_reasonTEXT-
removed_atTIMESTAMPTZ-
created_byBIGINT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

tag_scan

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_tag_idBIGINT-
scanned_codeTEXT[not null]
scanned_byBIGINT-
scanned_atTIMESTAMPTZ[not null, default: now()]
contextTEXT[not null, note: ‘Examples: onboarding, handoff_release, handoff_acceptance, maintenance’]
device_idTEXT-
location_idBIGINT-
successfulBOOLEAN[not null]
failure_codeTEXT-
duplicate_of_scan_idBIGINT-
confirmed_atTIMESTAMPTZ-

asset_assignment

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_idBIGINT[not null]
assignment_typeassignment_type[not null]
assignee_party_idBIGINT-
assignee_location_idBIGINT-
responsible_party_idBIGINT-
intermediary_party_idBIGINT-
statusassignment_status[not null, default: ‘pending_collection’]
purposeTEXT-
assigned_byBIGINT[not null]
assigned_atTIMESTAMPTZ[not null, default: now()]
collection_due_atTIMESTAMPTZ-
collected_atTIMESTAMPTZ-
acceptance_due_atTIMESTAMPTZ-
accepted_byBIGINT-
accepted_atTIMESTAMPTZ-
effective_fromTIMESTAMPTZ-
effective_toTIMESTAMPTZ-
ended_reasonTEXT-
versionINT[not null, default: 1]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

handoff_transaction

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
reference_noTEXT[not null]
assignment_idBIGINT-
work_order_idBIGINT-
purposeTEXT[not null]
from_party_idBIGINT-
to_party_idBIGINT-
from_location_idBIGINT-
to_location_idBIGINT-
intermediary_party_idBIGINT-
statushandoff_status[not null, default: ‘draft’]
initiated_byBIGINT[not null]
initiated_atTIMESTAMPTZ[not null, default: now()]
scheduled_atTIMESTAMPTZ-
due_atTIMESTAMPTZ-
closed_atTIMESTAMPTZ-
notesTEXT-
idempotency_keyTEXT-
versionINT[not null, default: 1]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

handoff_line

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
handoff_transaction_idBIGINT[not null]
asset_idBIGINT[not null]
condition_at_releaseTEXT-
released_scan_idBIGINT-
released_byBIGINT-
released_atTIMESTAMPTZ-
condition_at_receiptTEXT-
received_scan_idBIGINT-
received_byBIGINT-
received_atTIMESTAMPTZ-
acknowledgement_notesTEXT-

discrepancy

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_idBIGINT-
goods_receipt_line_idBIGINT-
handoff_transaction_idBIGINT-
reported_byBIGINT[not null]
assigned_toBIGINT-
statusdiscrepancy_status[not null, default: ‘open’]
discrepancy_typeTEXT[not null]
descriptionTEXT[not null]
expected_valueJSONB-
actual_valueJSONB-
resolutionTEXT-
resolved_byBIGINT-
resolved_atTIMESTAMPTZ-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

service_request

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
reference_noTEXT[not null]
asset_idBIGINT[not null]
requested_byBIGINT[not null]
on_behalf_of_party_idBIGINT-
reported_location_idBIGINT-
titleTEXT[not null]
descriptionTEXT[not null]
priorityTEXT[not null, default: ‘normal’]
is_emergencyBOOLEAN[not null, default: false]
statusservice_request_status[not null, default: ‘submitted’]
submitted_atTIMESTAMPTZ[not null, default: now()]
triaged_byBIGINT-
triaged_atTIMESTAMPTZ-
rejection_reasonTEXT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

maintenance_schedule

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_idBIGINT[not null]
titleTEXT[not null]
schedule_ruleTEXT[not null, note: ‘RFC 5545 recurrence rule or approved scheduler expression’]
next_due_atTIMESTAMPTZ[not null]
reminder_lead_minutesINT[not null, default: 10080]
owner_user_idBIGINT-
activeBOOLEAN[not null, default: true]
last_generated_atTIMESTAMPTZ-
created_byBIGINT[not null]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

work_order

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
reference_noTEXT[not null]
asset_idBIGINT[not null]
service_request_idBIGINT-
maintenance_schedule_idBIGINT-
titleTEXT[not null]
descriptionTEXT-
statuswork_order_status[not null, default: ‘draft’]
priorityTEXT[not null, default: ‘normal’]
is_emergencyBOOLEAN[not null, default: false]
assigned_toBIGINT-
requested_byBIGINT[not null]
vendor_idBIGINT-
repairableBOOLEAN-
inhouse_repairableBOOLEAN-
hold_reasonTEXT-
scheduled_atTIMESTAMPTZ-
started_atTIMESTAMPTZ-
sent_to_vendor_atTIMESTAMPTZ-
vendor_completed_atTIMESTAMPTZ-
completed_atTIMESTAMPTZ-
closed_atTIMESTAMPTZ-
downtime_started_atTIMESTAMPTZ-
downtime_ended_atTIMESTAMPTZ-
downtime_minutesBIGINT-
estimated_costNUMERIC(14,2)-
actual_costNUMERIC(14,2)-
resolution_summaryTEXT-
versionINT[not null, default: 1]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

maintenance_inspection

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
work_order_idBIGINT[not null]
inspected_byBIGINT[not null]
inspected_atTIMESTAMPTZ[not null, default: now()]
issue_foundBOOLEAN[not null]
resultinspection_result[not null]
checklistJSONB[not null, default: ’{}‘]
findingsTEXT-
recommendationTEXT-

stock_item

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
skuTEXT[not null]
nameTEXT[not null]
item_typestock_item_type[not null]
storage_location_idBIGINT-
unit_of_measureTEXT[not null]
quantity_on_handNUMERIC(14,3)[not null, default: 0]
reorder_levelNUMERIC(14,3)-
unit_costNUMERIC(14,2)-
activeBOOLEAN[not null, default: true]
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

work_order_material

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
work_order_idBIGINT[not null]
stock_item_idBIGINT[not null]
quantity_requiredNUMERIC(14,3)[not null]
quantity_issuedNUMERIC(14,3)[not null, default: 0]
unit_costNUMERIC(14,2)-
issued_byBIGINT-
issued_atTIMESTAMPTZ-
returned_quantityNUMERIC(14,3)[not null, default: 0]

compliance_item

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_idBIGINT[not null]
item_typecompliance_type[not null]
titleTEXT[not null]
reference_noTEXT-
owner_user_idBIGINT-
provider_vendor_idBIGINT-
start_dateDATE-
due_atTIMESTAMPTZ-
reminder_lead_minutesINT[not null, default: 10080]
recurrence_ruleTEXT-
statuscompliance_status[not null, default: ‘upcoming’]
completed_byBIGINT-
completed_atTIMESTAMPTZ-
completion_notesTEXT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

asset_review

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_idBIGINT[not null]
compliance_item_idBIGINT-
reviewed_byBIGINT[not null]
reviewed_atTIMESTAMPTZ[not null, default: now()]
decisionreview_decision[not null]
asset_foundBOOLEAN-
condition_codeTEXT-
findingsTEXT-
action_due_atTIMESTAMPTZ-

disposal_case

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
reference_noTEXT[not null]
asset_idBIGINT[not null]
asset_review_idBIGINT-
statusdisposal_status[not null, default: ‘draft’]
reasonTEXT[not null]
methodTEXT-
proposed_byBIGINT[not null]
proposed_atTIMESTAMPTZ[not null, default: now()]
financial_reviewer_idBIGINT-
financial_reviewed_atTIMESTAMPTZ-
book_value_at_reviewNUMERIC(14,2)-
expected_proceedsNUMERIC(14,2)-
actual_proceedsNUMERIC(14,2)-
currencyCHAR(3)[not null, default: ‘BDT’]
executed_byBIGINT-
executed_atTIMESTAMPTZ-
disposal_referenceTEXT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

asset_document

FieldPostgreSQL typeDeclared attributes
asset_idBIGINT[not null]
document_idBIGINT[not null]
document_typeTEXT[not null]
created_atTIMESTAMPTZ[not null, default: now()]

work_order_document

FieldPostgreSQL typeDeclared attributes
work_order_idBIGINT[not null]
document_idBIGINT[not null]
document_typeTEXT[not null]
created_atTIMESTAMPTZ[not null, default: now()]

disposal_document

FieldPostgreSQL typeDeclared attributes
disposal_case_idBIGINT[not null]
document_idBIGINT[not null]
document_typeTEXT[not null]
created_atTIMESTAMPTZ[not null, default: now()]

approval_request

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
workflow_codeTEXT[not null]
subject_labelTEXT[not null, note: ‘Human-readable snapshot shown in approval queues’]
goods_receipt_idBIGINT-
onboarding_batch_idBIGINT-
work_order_idBIGINT-
disposal_case_idBIGINT-
statusapproval_status[not null, default: ‘pending’]
requested_byBIGINT[not null]
requested_atTIMESTAMPTZ[not null, default: now()]
decided_atTIMESTAMPTZ-
cancelled_atTIMESTAMPTZ-
versionINT[not null, default: 1]

approval_step

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
approval_request_idBIGINT[not null]
step_noINT[not null]
approver_user_idBIGINT-
approver_role_idBIGINT-
statusapproval_step_status[not null, default: ‘pending’]
due_atTIMESTAMPTZ-
decided_byBIGINT-
decided_atTIMESTAMPTZ-
commentsTEXT-

notification

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
recipient_user_idBIGINT[not null]
channelTEXT[not null]
template_codeTEXT[not null]
subjectTEXT-
payloadJSONB[not null, default: ’{}‘]
statusnotification_status[not null, default: ‘queued’]
goods_receipt_idBIGINT-
assignment_idBIGINT-
handoff_transaction_idBIGINT-
work_order_idBIGINT-
compliance_item_idBIGINT-
approval_request_idBIGINT-
escalation_levelINT[not null, default: 0]
scheduled_atTIMESTAMPTZ-
sent_atTIMESTAMPTZ-
delivered_atTIMESTAMPTZ-
read_atTIMESTAMPTZ-
failure_reasonTEXT-
created_atTIMESTAMPTZ[not null, default: now()]

management_decision

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
titleTEXT[not null]
decision_typeTEXT[not null, note: ‘Examples: faulty_batch, bottleneck, at_risk_asset, portfolio’]
decision_textTEXT[not null]
rationaleTEXT-
source_report_typeTEXT-
source_filtersJSONB[not null, default: ’{}‘]
asset_idBIGINT-
asset_category_idBIGINT-
vendor_idBIGINT-
tag_batch_idBIGINT-
decided_byBIGINT[not null]
decided_atTIMESTAMPTZ[not null, default: now()]
follow_up_owner_idBIGINT-
follow_up_due_atTIMESTAMPTZ-
follow_up_statusTEXT-
created_atTIMESTAMPTZ[not null, default: now()]
updated_atTIMESTAMPTZ[not null, default: now()]

asset_event

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
asset_idBIGINT[not null]
event_typeasset_event_type[not null]
actor_user_idBIGINT-
occurred_atTIMESTAMPTZ[not null, default: now()]
reasonTEXT-
source_entity_typeTEXT-
source_entity_public_idUUID-
idempotency_keyTEXT-
payloadJSONB[not null, default: ’{}‘]
audit_event_idBIGINT-

audit_event

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
public_idUUID[not null, unique, default: gen_random_uuid()]
organization_idBIGINT[not null]
occurred_atTIMESTAMPTZ[not null, default: clock_timestamp()]
recorded_atTIMESTAMPTZ[not null, default: clock_timestamp()]
actor_typeaudit_actor_type[not null]
actor_user_idBIGINT-
actor_identifierTEXT[note: ‘Immutable snapshot: username, service account, job, or integration identifier’]
actor_display_nameTEXT-
impersonator_user_idBIGINT-
actionaudit_action_type[not null]
outcomeaudit_outcome[not null]
entity_typeTEXT[not null]
entity_idBIGINT-
entity_public_idUUID-
entity_labelTEXT-
reason_codeTEXT-
reason_textTEXT-
trigger_typeaudit_trigger_type[not null]
source_channelTEXT[not null, note: ‘Examples: web, mobile, scanner, API, worker, import’]
client_ipINET-
forwarded_forTEXT-
user_agentTEXT-
device_idTEXT-
session_idTEXT-
request_idTEXT-
correlation_idUUID-
trace_idTEXT-
transaction_idUUID-
service_nameTEXT-
service_versionTEXT-
http_methodTEXT-
request_pathTEXT-
error_codeTEXT-
error_messageTEXT-
metadataJSONB[not null, default: ’{}‘]
previous_event_hashTEXT-
event_hashTEXT[not null]
retention_untilDATE-

audit_change

FieldPostgreSQL typeDeclared attributes
idBIGSERIAL[pk, not null]
audit_event_idBIGINT[not null]
sequence_noINT[not null]
change_typeaudit_change_type[not null]
field_pathTEXT[not null, note: ‘JSON Pointer or stable dotted path’]
before_valueJSONB-
after_valueJSONB-
before_value_hashTEXT-
after_value_hashTEXT-
is_sensitiveBOOLEAN[not null, default: false]
is_redactedBOOLEAN[not null, default: false]

audit_event_asset

FieldPostgreSQL typeDeclared attributes
audit_event_idBIGINT[not null]
asset_idBIGINT[not null]
relationshipTEXT[not null, default: ‘subject’]