ForgeERP — Data model

Entity-relationship diagram · drag or two-finger scroll to pan · pinch or ⌘/Ctrl-scroll to zoom · double-click to zoom in.

100%

has

in

has

in

owns

employs

manages

linked to

groups

measured_in

groups

measured_in

spare face

documents (product target)

documents (material target)

review thread

uploaded

stocked_as

holds

moves

at

stocked_as

holds

moves

at

catalogs

listed by

fulfills

contains

ordered_as

received_via

into

contains

received against

received_as

default TDS

released as

lists

component_in

component source

produced_in (product target)

produced_in (material target)

uses

receives into (destination)

issues (per-component source)

consumed_in

component source

routes

runs

output logged by

checked_by

serviced_by

requests

contains

quoted_as

places

fulfilled from

accepted into

contains

sold_as

billed in

shipped_via

contains

shipped against

shipped_as

make-to-order (manual link)

contains

posts_to

reverses

contains

billed_as (AR)

billed_as (AP)

taxed_at

owes (AR)

issues (AP)

billed_by

bills

auto-posted for

allocates

settled by

receives (IN)

paid (OUT)

bank/cash

withheld under

auto-posted for

pays advance

against

advance for

bank/cash

taxed_at

auto-posted for

effective-dated rate

accrues

per FY

USERS

bigint

id

PK

string

username

string

email

string

password_hash

boolean

enabled

ROLES

bigint

id

PK

string

name

PERMISSIONS

bigint

id

PK

string

name

USER_ROLES

bigint

user_id

PK

FK -> users

bigint

role_id

PK

FK -> roles

ROLE_PERMISSIONS

bigint

role_id

PK

FK -> roles

bigint

permission_id

PK

FK -> permissions

REFRESH_TOKEN

bigint

id

PK

bigint

user_id

FK

string

token_hash

timestamptz

expires_at

timestamptz

revoked_at

DEPARTMENT

bigint

id

PK

string

name

string

code

string

description

bigint

manager_id

FK

-> employee

boolean

active

EMPLOYEE

bigint

id

PK

string

employee_code

string

first_name

string

last_name

string

email

string

phone

string

job_title

date

hire_date

bigint

department_id

FK

bigint

user_id

FK

-> users (unique)

boolean

active

PRODUCT_CATEGORY

bigint

id

PK

string

name

UOM

bigint

id

PK

string

code

string

name

MATERIAL

bigint

id

PK

string

sku

string

name

string

type

RAW_MATERIAL / WIP

bigint

category_id

FK

bigint

uom_id

FK

PRODUCT

bigint

id

PK

string

sku

string

name

string

type

RAW_MATERIAL / WIP / FINISHED_GOOD

bigint

category_id

FK

bigint

uom_id

FK

bigint

material_id

FK

-> material (optional spare face, create-only)

WAREHOUSE

bigint

id

PK

string

name

string

location

DESIGN_DOCUMENT

bigint

id

PK

bigint

product_id

FK

-> product (target: product XOR material)

bigint

material_id

FK

-> material (target: product XOR material)

string

revision

string

title

string

status

DRAFT / IN_REVIEW / CHANGES_REQUESTED / RELEASED

bigint

submitted_by

FK

timestamptz

submitted_at

bigint

approved_by

FK

timestamptz

approved_at

DESIGN_DOCUMENT_REMARK

bigint

id

PK

bigint

design_document_id

FK

text

body

ATTACHMENT

bigint

id

PK

string

owner_type

bigint

owner_id

string

file_name

string

content_type

bigint

size_bytes

string

checksum

string

storage_key

bigint

uploaded_by

FK

MATERIAL_STOCK_LEVEL

bigint

id

PK

bigint

material_id

FK

bigint

warehouse_id

FK

numeric

quantity_on_hand

numeric

reserved

numeric

quantity_qc_hold

MATERIAL_STOCK_MOVEMENT

bigint

id

PK

bigint

material_id

FK

bigint

warehouse_id

FK

string

movement_type

RECEIPT / ISSUE / ADJUSTMENT / PRODUCTION_ISSUE / PRODUCTION_OUTPUT / QC_RELEASE / QC_REJECT / SALES_SHIPMENT

numeric

quantity

string

ref_type

bigint

ref_id

string

lot_number

string

note

PRODUCT_STOCK_LEVEL

bigint

id

PK

bigint

product_id

FK

bigint

warehouse_id

FK

numeric

quantity_on_hand

numeric

reserved

numeric

quantity_qc_hold

PRODUCT_STOCK_MOVEMENT

bigint

id

PK

bigint

product_id

FK

bigint

warehouse_id

FK

string

movement_type

RECEIPT / ISSUE / ADJUSTMENT / PRODUCTION_ISSUE / PRODUCTION_OUTPUT / QC_RELEASE / QC_REJECT / SALES_SHIPMENT

numeric

quantity

string

ref_type

bigint

ref_id

string

lot_number

string

note

SUPPLIER

bigint

id

PK

string

name

string

email

string

phone

boolean

active

string

state_code

string

pan

boolean

is_individual

bigint

default_tds_section_id

FK

SUPPLIER_PRODUCT

bigint

id

PK

bigint

supplier_id

FK

bigint

material_id

FK

-> material (we buy materials)

string

supplier_sku

numeric

unit_price

int

lead_time_days

PURCHASE_ORDER

bigint

id

PK

bigint

supplier_id

FK

string

status

DRAFT / SUBMITTED / APPROVED / PARTIALLY_RECEIVED / CLOSED / CANCELLED

date

order_date

bigint

submitted_by

FK

timestamptz

submitted_at

bigint

approved_by

FK

timestamptz

approved_at

PURCHASE_ORDER_LINE

bigint

id

PK

bigint

po_id

FK

bigint

material_id

FK

-> material

numeric

ordered_quantity

numeric

unit_price

numeric

received_quantity

GOODS_RECEIPT

bigint

id

PK

bigint

po_id

FK

bigint

warehouse_id

FK

date

received_date

GOODS_RECEIPT_LINE

bigint

id

PK

bigint

goods_receipt_id

FK

bigint

po_line_id

FK

bigint

material_id

FK

-> material (derived from PO line)

numeric

received_quantity

TDS_SECTION

bigint

id

PK

string

internal_code

string

description

numeric

rate_pct

numeric

rate_pct_individual

numeric

threshold_single

numeric

threshold_annual

string

threshold_mode

FULL / EXCESS

string

section_393_code

numeric

penal_rate_no_pan

boolean

active

BOM

bigint

id

PK

bigint

design_document_id

FK

string

version

boolean

active

BOM_LINE

bigint

id

PK

bigint

bom_id

FK

bigint

component_material_id

FK

-> material (components are materials)

bigint

source_warehouse_id

FK

-> warehouse (default component source; seeds the PO component's warehouse; nullable)

numeric

quantity_per_unit

WORK_CENTER

bigint

id

PK

string

name

numeric

capacity_per_hour

string

status

PRODUCTION_ORDER

bigint

id

PK

bigint

product_id

FK

-> product (target: product XOR material)

bigint

material_id

FK

-> material (target: product XOR material)

bigint

bom_id

FK

bigint

sales_order_id

FK

bigint

destination_warehouse_id

FK

-> warehouse (finished goods land here in QC-hold)

numeric

ordered_quantity

numeric

produced_quantity

string

status

DRAFT / SUBMITTED / APPROVED / IN_PROGRESS / PARTIALLY_COMPLETED / COMPLETED / CANCELLED

date

planned_start

string

job_number

bigint

submitted_by

FK

timestamptz

submitted_at

bigint

approved_by

FK

timestamptz

approved_at

bigint

started_by

FK

timestamptz

started_at

PRODUCTION_ORDER_COMPONENT

bigint

id

PK

bigint

production_order_id

FK

bigint

material_id

FK

-> material (component to consume)

bigint

source_warehouse_id

FK

-> warehouse (drawn from here at start; per-line)

numeric

quantity

issued at start; same material may repeat with a different warehouse (split draw)

PRODUCTION_ORDER_OPERATION

bigint

id

PK

bigint

production_order_id

FK

bigint

work_center_id

FK

int

sequence_no

string

status

PRODUCTION_COMPLETION

bigint

id

PK

bigint

production_order_id

FK

numeric

quantity

string

lot_number

QUALITY_INSPECTION

bigint

id

PK

bigint

production_order_id

FK

numeric

quantity

string

result

PASS / FAIL

string

notes

MAINTENANCE_ORDER

bigint

id

PK

bigint

work_center_id

FK

string

type

PREVENTIVE / CORRECTIVE

string

status

date

scheduled_for

CUSTOMER

bigint

id

PK

string

name

string

email

string

phone

boolean

active

string

state_code

QUOTATION

bigint

id

PK

bigint

customer_id

FK

string

status

date

valid_until

QUOTATION_LINE

bigint

id

PK

bigint

quotation_id

FK

bigint

product_id

FK

numeric

quantity

numeric

unit_price

SALES_ORDER

bigint

id

PK

bigint

customer_id

FK

bigint

warehouse_id

FK

bigint

quotation_id

FK

string

status

DRAFT / CONFIRMED / PARTIALLY_SHIPPED / SHIPPED / CLOSED / CANCELLED

date

order_date

SALES_ORDER_LINE

bigint

id

PK

bigint

so_id

FK

bigint

product_id

FK

numeric

ordered_quantity

numeric

unit_price

numeric

reserved_quantity

numeric

shipped_quantity

SALES_ORDER_MILESTONE

bigint

id

PK

bigint

so_id

FK

int

sequence

string

name

numeric

percentage

string

status

PENDING / INVOICED

bigint

invoice_id

FK

DELIVERY

bigint

id

PK

bigint

so_id

FK

date

dispatched_date

DELIVERY_LINE

bigint

id

PK

bigint

delivery_id

FK

bigint

so_line_id

FK

bigint

product_id

FK

numeric

shipped_quantity

ACCOUNT

bigint

id

PK

string

code

string

name

string

type

ASSET / LIABILITY / EQUITY / INCOME / EXPENSE

boolean

active

JOURNAL_ENTRY

bigint

id

PK

date

entry_date

string

description

string

status

DRAFT / POSTED

string

ref_type

bigint

ref_id

bigint

reversal_of_id

FK

-> journal_entry (self)

timestamptz

posted_at

JOURNAL_ENTRY_LINE

bigint

id

PK

bigint

journal_entry_id

FK

bigint

account_id

FK

numeric

debit

numeric

credit

string

line_description

INVOICE

bigint

id

PK

string

type

AR / AP

string

invoice_number

date

invoice_date

bigint

customer_id

FK

bigint

supplier_id

FK

string

place_of_supply

string

supply_type

INTRA / INTER

string

status

DRAFT / POSTED / CANCELLED

numeric

subtotal

numeric

total_cgst

numeric

total_sgst

numeric

total_igst

numeric

rounding_adjustment

numeric

total_amount

boolean

settled

bigint

journal_entry_id

FK

bigint

sales_order_id

FK

bigint

milestone_id

FK

INVOICE_LINE

bigint

id

PK

bigint

invoice_id

FK

bigint

product_id

FK

-> product (AR line; product XOR material)

bigint

material_id

FK

-> material (AP line; product XOR material)

bigint

tax_code_id

FK

numeric

quantity

numeric

unit_price

numeric

taxable_amount

numeric

rate_pct

numeric

cgst_amt

numeric

sgst_amt

numeric

igst_amt

numeric

line_total

PAYMENT

bigint

id

PK

string

type

IN / OUT

string

payment_number

date

payment_date

bigint

customer_id

FK

bigint

supplier_id

FK

bigint

bank_account_id

FK

-> account

bigint

tds_section_id

FK

numeric

gross_amount

numeric

tds_amount

numeric

tds_base_amount

numeric

net_amount

string

status

DRAFT / POSTED / CANCELLED

bigint

journal_entry_id

FK

PAYMENT_ALLOCATION

bigint

id

PK

bigint

payment_id

FK

bigint

invoice_id

FK

numeric

allocated_amount

ADVANCE_RECEIPT

bigint

id

PK

string

advance_number

date

advance_date

bigint

customer_id

FK

bigint

sales_order_id

FK

bigint

milestone_id

FK

bigint

bank_account_id

FK

-> account

numeric

amount

boolean

gst_on_advance

bigint

tax_code_id

FK

string

place_of_supply

numeric

cgst_amt

numeric

sgst_amt

numeric

igst_amt

numeric

gross_amount

string

status

DRAFT / POSTED / CANCELLED

boolean

adjusted

bigint

journal_entry_id

FK

TAX_CODE

bigint

id

PK

string

code

string

name

boolean

active

TAX_RATE

bigint

id

PK

bigint

tax_code_id

FK

numeric

total_rate_pct

date

valid_from

date

valid_to

TDS_LEDGER

bigint

id

PK

bigint

supplier_id

FK

bigint

tds_section_id

FK

int

financial_year

numeric

cumulative_base

numeric

cumulative_tds

COMPANY_CONFIG

bigint

id

PK

singleton (id = 1)

string

state_code

boolean

tds_194q_applicable

boolean

gst_registered