Data dictionary

online-shop · engine: PostgreSQL · generated on 2026-10-12 14:39 with Schevo

62 tables105 relationships391 columns0 errors · 4 validation warnings

cat_attribute public.cat_attribute

Attributes that tell variants apart (size, color, capacity...).

ColumnTypeNullableDefaultKeyComment
attribute_idBIGINTNOT NULLPK
nameVARCHAR(40)NOT NULL
unitVARCHAR(10)yes

Keys and indexes

Referenced by

cat_brand public.cat_brand

Product brands.

ColumnTypeNullableDefaultKeyComment
brand_idBIGINTNOT NULLPK
nameVARCHAR(80)NOT NULL
websiteVARCHAR(200)yes
logoBYTEAyes

Keys and indexes

Referenced by

cat_category public.cat_category

Category tree of the catalog.

ColumnTypeNullableDefaultKeyComment
category_idBIGINTNOT NULLPK
parent_idBIGINTyesFKParent category; null for root categories.
slugVARCHAR(80)NOT NULLURL fragment of the category.
nameVARCHAR(80)NOT NULL
sort_orderSMALLINTNOT NULL0
visibleBOOLEANNOT NULLtrue

Keys and indexes

References

Referenced by

cat_image public.cat_image

Images of the product or of a specific variant.

ColumnTypeNullableDefaultKeyComment
image_idBIGINTNOT NULLPK
product_idBIGINTNOT NULLFK
variant_idBIGINTyesFK
urlVARCHAR(400)NOT NULL
alt_textVARCHAR(200)yes
sort_orderSMALLINTNOT NULL0

Keys and indexes

References

cat_price_history public.cat_price_history

Price history of each variant.

ColumnTypeNullableDefaultKeyComment
variant_idBIGINTNOT NULLPKFK
valid_fromTIMESTAMP WITH TIME ZONENOT NULLPK
valid_untilTIMESTAMP WITH TIME ZONEyes
priceNUMERIC(12,2)NOT NULL
changed_byBIGINTyesFK

Keys and indexes

References

cat_product public.cat_product

Product sheet; price and stock are per variant.

ColumnTypeNullableDefaultKeyComment
product_idBIGINTNOT NULLPK
brand_idBIGINTyesFK
skuVARCHAR(30)NOT NULL
nameVARCHAR(150)NOT NULL
descriptionTEXTyes
specificationsJSONByesFree-form specifications in JSON.
weight_gramsINTEGERyesWeight including packaging, to compute the shipping rate.
tax_codeVARCHAR(10)NOT NULL'standard'FK
activeBOOLEANNOT NULLtrue
created_atTIMESTAMP WITH TIME ZONENOT NULLnow()
updated_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

Referenced by

cat_product_category public.cat_product_category

Categories each product appears in.

ColumnTypeNullableDefaultKeyComment
product_idBIGINTNOT NULLPKFK
category_idBIGINTNOT NULLPKFK
is_primaryBOOLEANNOT NULLfalse

Keys and indexes

References

cat_product_supplier public.cat_product_supplier

Suppliers of each product and their purchase cost.

ColumnTypeNullableDefaultKeyComment
product_idBIGINTNOT NULLPKFK
supplier_idBIGINTNOT NULLPKFK
supplier_referenceVARCHAR(40)yes
costNUMERIC(12,2)NOT NULL
preferredBOOLEANNOT NULLfalse

Keys and indexes

References

cat_supplier public.cat_supplier

Suppliers the goods are bought from.

ColumnTypeNullableDefaultKeyComment
supplier_idBIGINTNOT NULLPK
legal_nameVARCHAR(150)NOT NULL
tax_idVARCHAR(9)NOT NULL
emailEMAILyes
country_codeCHAR(2)NOT NULLFK
lead_time_daysSMALLINTNOT NULL7

Keys and indexes

References

Referenced by

cat_variant public.cat_variant

Sellable combination of a product (size, color...), with its SKU and price.

ColumnTypeNullableDefaultKeyComment
variant_idBIGINTNOT NULLPK
product_idBIGINTNOT NULLFK
skuVARCHAR(40)NOT NULL
barcodeVARCHAR(14)yesEAN-13 or GTIN-14.
priceNUMERIC(12,2)NOT NULL
compare_at_priceNUMERIC(12,2)yesPrevious price shown struck through in offers.
currency_codeCHAR(3)NOT NULL'EUR'FK
activeBOOLEANNOT NULLtrue

Keys and indexes

References

Referenced by

cat_variant_attribute public.cat_variant_attribute

Value of each attribute in each variant.

ColumnTypeNullableDefaultKeyComment
variant_idBIGINTNOT NULLPKFK
attribute_idBIGINTNOT NULLPKFK
valueVARCHAR(80)NOT NULL

Keys and indexes

References

cus_address public.cus_address

Address book of each customer.

ColumnTypeNullableDefaultKeyComment
address_idBIGINTNOT NULLPK
customer_idBIGINTNOT NULLFK
aliasVARCHAR(40)yes
recipientVARCHAR(120)NOT NULL
linea1VARCHAR(150)NOT NULL
linea2VARCHAR(150)yes
postal_codeVARCHAR(10)NOT NULL
cityVARCHAR(80)NOT NULL
regionVARCHAR(80)yes
country_codeCHAR(2)NOT NULLFK
phoneVARCHAR(20)yes
is_defaultBOOLEANNOT NULLfalseAddress proposed by default at checkout.

Keys and indexes

References

Referenced by

cus_customer public.cus_customer

Registered customers of the shop.

ColumnTypeNullableDefaultKeyComment
customer_idBIGINTNOT NULLPK
loyalty_pointsINTEGERNOT NULL0
public_uuidUUIDNOT NULLgen_random_uuid()Identifier exposed in URLs and in the API instead of customer_id.
emailEMAILNOT NULL
nameVARCHAR(60)NOT NULL
last_nameVARCHAR(100)yes
phoneVARCHAR(20)yes
birth_dateDATEyes
languageCHAR(2)NOT NULL'en'
currency_codeCHAR(3)NOT NULL'EUR'FK
account_manager_idBIGINTyesFKAssigned sales rep (wholesale customers only).
password_hashBYTEAyesbcrypt hash of the password.
tagsTEXT[]yesFree-form tags set by customer service.
registered_atTIMESTAMP WITH TIME ZONENOT NULLnow()
deregistered_atTIMESTAMP WITH TIME ZONEyes

Keys and indexes

References

Referenced by

cus_customer_segment public.cus_customer_segment

Customer membership in segments.

ColumnTypeNullableDefaultKeyComment
customer_idBIGINTNOT NULLPKFK
segment_idBIGINTNOT NULLPKFK
start_dateDATENOT NULLCURRENT_DATE

Keys and indexes

References

cus_internal_note public.cus_internal_note

Customer service notes, visible to staff only.

ColumnTypeNullableDefaultKeyComment
note_idBIGINTNOT NULLPK
customer_idBIGINTNOT NULLFK
employee_idBIGINTNOT NULLFK
bodyTEXTNOT NULL
created_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

cus_segment public.cus_segment

Customer segments for campaigns (VIP, wholesale, inactive...).

ColumnTypeNullableDefaultKeyComment
segment_idBIGINTNOT NULLPK
nameVARCHAR(40)NOT NULL
descriptionTEXTyes

Keys and indexes

Referenced by

emp_absence public.emp_absence

Vacations, sick leave and other leave.

ColumnTypeNullableDefaultKeyComment
absence_idBIGINTNOT NULLPK
employee_idBIGINTNOT NULLFK
typeVARCHAR(20)NOT NULL
start_dateDATENOT NULL
end_dateDATENOT NULL
approved_byBIGINTyesFKEmployee who approved the absence.

Keys and indexes

References

emp_department public.emp_department

Company departments.

ColumnTypeNullableDefaultKeyComment
department_idBIGINTNOT NULLPK
nameVARCHAR(80)NOT NULL
cost_centerVARCHAR(20)yes

Keys and indexes

Referenced by

emp_employee public.emp_employee

Office and warehouse staff.

ColumnTypeNullableDefaultKeyComment
employee_idBIGINTNOT NULLPK
department_idBIGINTNOT NULLFK
manager_idBIGINTyesFKDirect manager of the employee.
warehouse_idBIGINTyesFKWarehouse they work at; null for office staff.
national_idVARCHAR(9)NOT NULL
nameVARCHAR(60)NOT NULL
last_nameVARCHAR(100)NOT NULL
emailEMAILNOT NULL
hire_dateDATENOT NULLCURRENT_DATE
leave_dateDATEyes
activeBOOLEANNOT NULLtrue

Keys and indexes

References

Referenced by

emp_employee_shift public.emp_employee_shift

Rota: which employee works which shift each day.

ColumnTypeNullableDefaultKeyComment
employee_idBIGINTNOT NULLPKFK
shift_idBIGINTNOT NULLPKFK
dateDATENOT NULLPK

Keys and indexes

References

emp_shift public.emp_shift

Warehouse work shifts.

ColumnTypeNullableDefaultKeyComment
shift_idBIGINTNOT NULLPK
nameVARCHAR(40)NOT NULL
start_timeTIMENOT NULL
end_timeTIMENOT NULL

Keys and indexes

Referenced by

mkt_campaign public.mkt_campaign

Marketing campaigns.

ColumnTypeNullableDefaultKeyComment
campaign_idBIGINTNOT NULLPK
nameVARCHAR(100)NOT NULL
start_dateDATENOT NULL
end_dateDATEyes
budgetNUMERIC(12,2)yes
channelsTEXT[]yes
manager_idBIGINTyesFK

Keys and indexes

References

Referenced by

mkt_coupon public.mkt_coupon

Discount codes.

ColumnTypeNullableDefaultKeyComment
coupon_idBIGINTNOT NULLPK
codeVARCHAR(30)NOT NULL
campaign_idBIGINTyesFK
typeVARCHAR(12)NOT NULL
valueNUMERIC(12,2)NOT NULL0Percentage or amount depending on the type; ignored for free_shipping.
minimum_purchaseNUMERIC(12,2)yes
max_usesINTEGERyes
uses_per_customerSMALLINTNOT NULL1
valid_fromTIMESTAMP WITH TIME ZONENOT NULL
valid_untilTIMESTAMP WITH TIME ZONEyes

Keys and indexes

References

Referenced by

mkt_coupon_use public.mkt_coupon_use

Orders each coupon has been used in.

ColumnTypeNullableDefaultKeyComment
coupon_idBIGINTNOT NULLPKFK
order_idBIGINTNOT NULLPKFK
customer_idBIGINTNOT NULLFK
used_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

mkt_newsletter_send public.mkt_newsletter_send

Newsletter sends imported from the mailing tool.

ColumnTypeNullableDefaultKeyComment
newsletter_send_idBIGINTNOT NULLPK
campaign_idBIGINTNOT NULLFK
customer_idINTEGERNOT NULLINTEGER inherited from the mailing tool (intentional validator warning).
emailEMAILNOT NULL
sent_atTIMESTAMP WITH TIME ZONENOT NULL
opened_atTIMESTAMP WITH TIME ZONEyes
clicked_atTIMESTAMP WITH TIME ZONEyes

Keys and indexes

References

mkt_review public.mkt_review

Product reviews written by customers.

ColumnTypeNullableDefaultKeyComment
review_idBIGINTNOT NULLPK
product_idBIGINTNOT NULLFK
customer_idBIGINTNOT NULLFK
order_idBIGINTyesFK
ratingSMALLINTNOT NULL
titleVARCHAR(120)yes
bodyTEXTyes
verifiedBOOLEANNOT NULLfalseThe customer bought the product (there is a linked order).
publishedBOOLEANNOT NULLfalse
created_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

Referenced by

mkt_review_vote public.mkt_review_vote

"Helpful" votes on reviews.

ColumnTypeNullableDefaultKeyComment
review_idBIGINTNOT NULLPKFK
customer_idBIGINTNOT NULLPKFK
helpfulBOOLEANNOT NULL

Keys and indexes

References

mkt_wishlist public.mkt_wishlist

Customer wishlists.

ColumnTypeNullableDefaultKeyComment
wishlist_idBIGINTNOT NULLPK
customer_idBIGINTNOT NULLFK
nameVARCHAR(60)NOT NULL'Favorites'
is_publicBOOLEANNOT NULLfalse
created_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

Referenced by

mkt_wishlist_product public.mkt_wishlist_product

Products saved in each wishlist.

ColumnTypeNullableDefaultKeyComment
wishlist_idBIGINTNOT NULLPKFK
product_idBIGINTNOT NULLPKFK
added_atTIMESTAMP WITH TIME ZONENOT NULLnow()
price_drop_alertBOOLEANNOT NULLfalse

Keys and indexes

References

ord_cart public.ord_cart

Open carts, from registered customers or guests.

ColumnTypeNullableDefaultKeyComment
cart_idBIGINTNOT NULLPK
customer_idBIGINTyesFK
session_idUUIDNOT NULLBrowser session, for guest carts.
coupon_idBIGINTyesFK
created_atTIMESTAMP WITH TIME ZONENOT NULLnow()
updated_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

Referenced by

ord_cart_line public.ord_cart_line

Variants added to each cart.

ColumnTypeNullableDefaultKeyComment
cart_idBIGINTNOT NULLPKFK
variant_idBIGINTNOT NULLPKFK
quantitySMALLINTNOT NULL
added_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

ord_order public.ord_order

Confirmed orders.

ColumnTypeNullableDefaultKeyComment
order_idBIGINTNOT NULLPK
numberVARCHAR(20)NOT NULLNumber shown to the customer, e.g. NM-2026-000123.
customer_idBIGINTNOT NULLFK
shipping_address_idBIGINTNOT NULLFKAddress the order is shipped to.
billing_address_idBIGINTNOT NULLFKAddress shown on the invoice.
coupon_idBIGINTyesFK
statusORDER_STATUSNOT NULL'pending'::order_status
channelVARCHAR(20)NOT NULL'web'web, app, marketplace or phone.
currency_codeCHAR(3)NOT NULL'EUR'FK
subtotalNUMERIC(12,2)NOT NULL
discountNUMERIC(12,2)NOT NULL0
shipping_costNUMERIC(12,2)NOT NULL0
taxesNUMERIC(12,2)NOT NULL
totalNUMERIC(12,2)NOT NULL
notesTEXTyes
order_dateTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

Referenced by

ord_order_line public.ord_order_line

Order lines; they keep the price and tax at the time of purchase.

ColumnTypeNullableDefaultKeyComment
order_idBIGINTNOT NULLPKFK
line_noSMALLINTNOT NULLPK
variant_idBIGINTNOT NULLFK
descriptionVARCHAR(200)NOT NULLProduct name at the time of purchase.
quantitySMALLINTNOT NULL
unit_priceNUMERIC(12,2)NOT NULL
discountNUMERIC(12,2)NOT NULL0
tax_codeVARCHAR(10)NOT NULLFK
amountNUMERIC(12,2)NOT NULL

Keys and indexes

References

Referenced by

ord_return public.ord_return

Return requests.

ColumnTypeNullableDefaultKeyComment
return_idBIGINTNOT NULLPK
order_idBIGINTNOT NULLFK
statusVARCHAR(15)NOT NULL'requested'
requested_atTIMESTAMP WITH TIME ZONENOT NULLnow()
reviewed_byBIGINTyesFK
shipment_idBIGINTyesFK

Keys and indexes

References

Referenced by

ord_return_line public.ord_return_line

Order lines included in a return.

ColumnTypeNullableDefaultKeyComment
return_idBIGINTNOT NULLPKFK
order_idBIGINTNOT NULLPKFK
line_noSMALLINTNOT NULLPKFK
quantitySMALLINTNOT NULL
reason_idBIGINTNOT NULLFK
remarksTEXTyes

Keys and indexes

References

ord_return_reason public.ord_return_reason

Catalog of return reasons.

ColumnTypeNullableDefaultKeyComment
reason_idBIGINTNOT NULLPK
codeVARCHAR(20)NOT NULL
descriptionVARCHAR(150)NOT NULL
needs_reviewBOOLEANNOT NULLfalse

Keys and indexes

Referenced by

ord_status_history public.ord_status_history

Status changes of each order.

ColumnTypeNullableDefaultKeyComment
order_idBIGINTNOT NULLPKFK
changed_atTIMESTAMP WITH TIME ZONENOT NULLPK
previous_statusORDER_STATUSyes
new_statusORDER_STATUSNOT NULL
employee_idBIGINTyesFK
commentTEXTyes

Keys and indexes

References

pay_invoice public.pay_invoice

Issued invoices, including corrective ones.

ColumnTypeNullableDefaultKeyComment
invoice_idBIGINTNOT NULLPK
numberVARCHAR(20)NOT NULL('F' || nextval('pay_invoice_number_seq'))
order_idBIGINTNOT NULLFK
customer_idBIGINTNOT NULLFK
corrected_invoice_idBIGINTyesFKIn corrective invoices, the invoice they correct.
issued_atDATENOT NULLCURRENT_DATE
taxable_baseNUMERIC(12,2)NOT NULL
tax_amountNUMERIC(12,2)NOT NULL
totalNUMERIC(12,2)NOT NULL
pdfBYTEAyes

Keys and indexes

References

Referenced by

pay_invoice_line public.pay_invoice_line

Items of each invoice.

ColumnTypeNullableDefaultKeyComment
invoice_idBIGINTNOT NULLPKFK
line_noSMALLINTNOT NULLPK
item_nameVARCHAR(200)NOT NULL
quantitySMALLINTNOT NULL
unit_priceNUMERIC(12,2)NOT NULL
tax_codeVARCHAR(10)NOT NULLFK
amountNUMERIC(12,2)NOT NULL

Keys and indexes

References

pay_payment public.pay_payment

Payment attempts for an order.

ColumnTypeNullableDefaultKeyComment
payment_idBIGINTNOT NULLPK
order_idBIGINTNOT NULLFK
methodPAYMENT_METHODNOT NULL
saved_method_idBIGINTyesFK
amountNUMERIC(12,2)NOT NULL
currency_codeCHAR(3)NOT NULLFK
statusVARCHAR(12)NOT NULL'pending'
external_transactionVARCHAR(100)yes
gateway_responseJSONByesFull response of the payment gateway, for support.
dateTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

Referenced by

pay_refund public.pay_refund

Money returned against a payment.

ColumnTypeNullableDefaultKeyComment
refund_idBIGINTNOT NULLPK
payment_idBIGINTNOT NULLFK
return_idBIGINTyesFK
amountNUMERIC(12,2)NOT NULL
reasonTEXTyes
dateTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

pay_saved_method public.pay_saved_method

Payment methods tokenized by the gateway; the card is never stored.

ColumnTypeNullableDefaultKeyComment
saved_method_idBIGINTNOT NULLPK
customer_idBIGINTNOT NULLFK
typePAYMENT_METHODNOT NULL
tokenVARCHAR(100)NOT NULL
last_digitsCHAR(4)yes
expires_onDATEyes
is_defaultBOOLEANNOT NULLfalse

Keys and indexes

References

Referenced by

pay_tax public.pay_tax

Applicable VAT rates (standard, reduced, super-reduced, exempt).

ColumnTypeNullableDefaultKeyComment
codeVARCHAR(10)NOT NULLPK
percentageNUMERIC(5,2)NOT NULL
descriptionVARCHAR(100)yes

Keys and indexes

Referenced by

shp_carrier public.shp_carrier

Courier companies.

ColumnTypeNullableDefaultKeyComment
carrier_idBIGINTNOT NULLPK
nameVARCHAR(80)NOT NULL
tracking_urlVARCHAR(300)yes
api_configJSONByes
activeBOOLEANNOT NULLtrue

Keys and indexes

Referenced by

shp_parcel public.shp_parcel

Boxes that make up a shipment.

ColumnTypeNullableDefaultKeyComment
parcel_idBIGINTNOT NULLPK
shipment_idBIGINTNOT NULLFK
numberSMALLINTNOT NULL
weight_gramsINTEGERyes
dimensions_cmVARCHAR(20)yes
labelBYTEAyes

Keys and indexes

References

Referenced by

shp_parcel_line public.shp_parcel_line

Which order lines go in each parcel.

ColumnTypeNullableDefaultKeyComment
parcel_idBIGINTNOT NULLPKFK
order_idBIGINTNOT NULLPKFK
line_noSMALLINTNOT NULLPKFK
quantitySMALLINTNOT NULL

Keys and indexes

References

shp_pickup_point public.shp_pickup_point

Pickup points (stores, lockers) of each carrier.

ColumnTypeNullableDefaultKeyComment
pickup_point_idBIGINTNOT NULLPK
carrier_idBIGINTNOT NULLFK
codeVARCHAR(20)NOT NULL
nameVARCHAR(120)NOT NULL
addressVARCHAR(200)NOT NULL
postal_codeVARCHAR(10)NOT NULL
country_codeCHAR(2)NOT NULLFK
latitudeNUMERIC(9,6)yes
longitudeNUMERIC(9,6)yes

Keys and indexes

References

Referenced by

shp_rate public.shp_rate

Rates by carrier, country and weight band.

ColumnTypeNullableDefaultKeyComment
rate_idBIGINTNOT NULLPK
carrier_idBIGINTNOT NULLFK
country_codeCHAR(2)NOT NULLFK
max_weight_gramsINTEGERNOT NULL
priceNUMERIC(12,2)NOT NULL
term_daysSMALLINTyes

Keys and indexes

References

shp_shipment public.shp_shipment

Shipments of an order, outbound or return.

ColumnTypeNullableDefaultKeyComment
shipment_idBIGINTNOT NULLPK
order_idBIGINTNOT NULLFK
carrier_idBIGINTNOT NULLFK
warehouse_idBIGINTNOT NULLFK
pickup_point_idBIGINTyesFK
directionVARCHAR(10)NOT NULL'outbound'outbound = to the customer; return = back to the warehouse.
tracking_codeVARCHAR(40)yes
costNUMERIC(12,2)yes
sent_atTIMESTAMP WITH TIME ZONEyes
delivered_atTIMESTAMP WITH TIME ZONEyes

Keys and indexes

References

Referenced by

shp_tracking_event public.shp_tracking_event

Tracking events received from the carrier.

ColumnTypeNullableDefaultKeyComment
shipment_idBIGINTNOT NULLPKFK
dateTIMESTAMP WITH TIME ZONENOT NULLPK
statusVARCHAR(30)NOT NULL
locationVARCHAR(120)yes
detailJSONByes

Keys and indexes

References

sys_audit_log public.sys_audit_log

Change log written by triggers; it has no FKs so it never blocks deletes.

ColumnTypeNullableDefaultKeyComment
audit_idBIGINTNOT NULLnextval('sys_audit_log_seq')PK
table_nameVARCHAR(63)NOT NULL
record_idVARCHAR(100)NOT NULLPrimary key of the affected record, as text.
operationCHAR(1)NOT NULLI = insert, U = update, D = delete.
data_beforeJSONByes
data_afterJSONByes
usernameVARCHAR(100)NOT NULL
ipINETyes
dateTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

sys_country public.sys_country

ISO 3166-1 alpha-2 countries the shop sells to or buys from.

ColumnTypeNullableDefaultKeyComment
codeCHAR(2)NOT NULLPK
nameVARCHAR(80)NOT NULL
phone_prefixVARCHAR(5)yes
in_euBOOLEANNOT NULLfalse

Keys and indexes

Referenced by

sys_currency public.sys_currency

ISO 4217 currencies accepted in prices and payments.

ColumnTypeNullableDefaultKeyComment
codeCHAR(3)NOT NULLPK
nameVARCHAR(40)NOT NULL
symbolVARCHAR(5)NOT NULL
decimalsSMALLINTNOT NULL2

Keys and indexes

Referenced by

sys_setting public.sys_setting

Shop settings as JSON key/value pairs.

ColumnTypeNullableDefaultKeyComment
keyVARCHAR(100)NOT NULLPK
valueJSONBNOT NULL
descriptionTEXTyes
updated_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

wh_location public.wh_location

Slots in a warehouse (aisle, shelf, level).

ColumnTypeNullableDefaultKeyComment
location_idBIGINTNOT NULLPK
warehouse_idBIGINTNOT NULLFK
aisleVARCHAR(5)NOT NULL
shelfVARCHAR(5)NOT NULL
levelSMALLINTNOT NULL
typeVARCHAR(15)NOT NULL'picking'

Keys and indexes

References

Referenced by

wh_movement public.wh_movement

Stock receipts, issues, transfers and adjustments.

ColumnTypeNullableDefaultKeyComment
movement_idBIGINTNOT NULLPK
variant_idBIGINTNOT NULLFK
source_location_idBIGINTyesFKNull for goods receipts.
target_location_idBIGINTyesFKNull for goods issues.
quantityINTEGERNOT NULL
typeVARCHAR(15)NOT NULL
employee_idBIGINTyesFK
order_idBIGINTyesFK
dateTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

wh_reservation public.wh_reservation

Stock set aside for an order line until it is picked.

ColumnTypeNullableDefaultKeyComment
reservation_idBIGINTNOT NULLPK
order_idBIGINTNOT NULLFK
line_noSMALLINTNOT NULLFK
variant_idBIGINTNOT NULLFK
location_idBIGINTNOT NULLFK
quantityINTEGERNOT NULL
expires_atTIMESTAMP WITH TIME ZONENOT NULL

Keys and indexes

References

wh_stock public.wh_stock

Units of each variant in each location.

ColumnTypeNullableDefaultKeyComment
variant_idBIGINTNOT NULLPKFK
location_idBIGINTNOT NULLPKFK
quantityINTEGERNOT NULL0
reservedINTEGERNOT NULL0Units set aside for orders not yet picked.
minimumINTEGERyesBelow this quantity a restock is proposed.
updated_atTIMESTAMP WITH TIME ZONENOT NULLnow()

Keys and indexes

References

Referenced by

wh_stocktake public.wh_stocktake

Physical stock counts of a warehouse.

ColumnTypeNullableDefaultKeyComment
stocktake_idBIGINTNOT NULLPK
warehouse_idBIGINTNOT NULLFK
dateDATENOT NULL
statusVARCHAR(12)NOT NULL'open'
manager_idBIGINTyesFK

Keys and indexes

References

Referenced by

wh_stocktake_line public.wh_stocktake_line

Count result per variant and location.

ColumnTypeNullableDefaultKeyComment
stocktake_idBIGINTNOT NULLPKFK
variant_idBIGINTNOT NULLPKFK
location_idBIGINTNOT NULLPKFK
system_quantityINTEGERNOT NULL
counted_quantityINTEGERyes

Keys and indexes

References

wh_warehouse public.wh_warehouse

Own warehouses orders are shipped from.

ColumnTypeNullableDefaultKeyComment
warehouse_idBIGINTNOT NULLPK
codeVARCHAR(10)NOT NULL
nameVARCHAR(80)NOT NULL
addressVARCHAR(200)NOT NULL
country_codeCHAR(2)NOT NULLFK
manager_idBIGINTyesFK
activeBOOLEANNOT NULLtrue

Keys and indexes

References

Referenced by