Skip to main content

Model Domains

Core Entity

EntityTableRole
Usersusersaccount + role
Projectsprojectsmain project
SPBspbsletter of request for goods
Itemsitemsitems from SPB
PreOrder (PO)pre_orderspurchase orders
POItemspo_itemspivot item to PO + PO item status
Supplierssuppliersvendors/suppliers
PaymentpaymentsPO payment data
PaymentTermpayment_termspayment terms
Taxestaxestax data related to payment
PaymentSplitpayment_splitsDP/repayment scheme
PriceChangeRequestprice_change_requestsproposed total change to PO
SPKspksemployment contract
SPKPaymentspk_paymentsSPK payments
SPKRevisionspk_revisionsrevised SPK
SPKPaymentAccountingspk_payment_accountingsaccounting SPK payments
PO/SPK Payment Receiptpo_payment_receipts, spk_payment_receiptsproof of payment

Relationships Matter

Business Invariants (indicative)

  • SPB approved can proceed to PO.
  • PO received prompts the payment process.
  • Payment status moves waiting → approved → verified.
  • SPK payment & accounting are separate but connected to spk_payment_id.

Critical Field

ModelsFieldsNotes
PreOrderstatus, received_at, approved_by, received_byPO lifecycle
Paymentsubtotal, total, new_total, is_split, statusnominal final
SPBstatus, delivery_dateSPB lifecycle
SPKstatus, contract_nominalcontract lifecycle

Verification Notes

  • Status: Partial
  • Scope: Actual FK constraints in production have not been verified directly to the running DB instance.
  • Action: Take a constraint snapshot from the live DB and match it to the model/migration.