Database Package
Package: @hereby/database | TypeORM + PostgreSQL
Database layer for the platform with exported data-source helpers, entity definitions, migrations, seed scripts, and provisioning scripts.
Exports
The package root exports:
AppDataSourceinitializeDatabase()closeDatabase()- all entities
- metadata types
Scale
Current counts in the repository:
- 113 entity files (
packages/database/src/entities/*.entity.ts) - 105 migration files
- 27 seed files
Domain Coverage
The entity set now extends beyond the older payroll-only summary. It includes:
- core org and employee entities
- payroll and compensation entities
- attendance and leave entities
- nurse scheduling entities
- messaging and document entities
- device token and notification entities
- payroll configuration entities (tax brackets, treatment categories)
- incentive management entities (fixed incentives, presets, categories)
- general affairs notice, training, checklist, and recurring-task entities
- inventory management entities
- certificate and leave-of-absence tracking entities
- payroll workbook (sheet view/row/cell/template) entities
- drive shared-storage entities (folder, file, access grant, share link)
- AI entities (conversation, message, document embedding)
- e-sign entities (record, provider webhook inbox)
- annual-leave-promotion workflow entities
- account layer, offsite-work, org-parameter, and work-time-closing entities
Notable newer entities include:
TaxBracketConfigFixedIncentive,IncentivePreset,IncentivePresetCategoryTreatmentCategory,TreatmentItemPayrollCellMemoEmployeeCertification,CertificateIssuanceLeaveOfAbsenceRecordInventoryCategory,InventoryItemDeviceToken,SecomEventGeneralAffairsNotice,NoticeAcknowledgmentRecurringTask,RecurringTaskExecutionTaskChecklistItem,ChecklistCompletionMandatoryTraining,TrainingCompletionWardDailyRecord,LeaveEntitlementRule
Commands
bash
pnpm --filter @hereby/database build
pnpm --filter @hereby/database migration:create --name=Name
pnpm --filter @hereby/database migration:generate --name=Name
pnpm --filter @hereby/database migration:run
pnpm --filter @hereby/database migration:revert
pnpm --filter @hereby/database migration:show
pnpm --filter @hereby/database seed
pnpm --filter @hereby/database provision:super-admin