WFDASH-WEBAPP/docs/audit/unused-pb-fields.md
SJCoetz 7a68cafe35 chore: add logos, opencode config and build assets
This commit includes the temporary Next.js build cache files, public brand
logos, and project configuration added in this change.
2026-07-27 08:21:20 +02:00

75 KiB

PB Schema Audit — Unused / Legacy Fields

Generated by scripts/audit-pb-fields.py. For every non-system field in every business collection, counts references in the Next.js app source (src/, scripts/ — pb-exports/ is a schema dump and is excluded). A file is considered to "touch" a collection if it contains the collection name as a string literal (e.g. pb.collection("orders")) or the collection's PB id (pbc_3527180448).

Summary

  • Total fields audited: 347
  • Unused fields (0 references): 49
  • Single-reference fields: 1
  • Dead collections (never referenced by app): 3
    • driver_locations (base) — 8 fields all dead
    • masterdrilling_consignment (base) — 8 fields all dead
    • pos (base) — 16 fields all dead

categories (base)

field type required refs used where
match_brands text no ✅ 4 scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
match_keywords text no ✅ 5 scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
match_supplier_tags text no ✅ 5 scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
display_order number no ✅ 7 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
is_active bool no ✅ 7 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
color text no ✅ 9 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
slug text yes ✅ 12 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
name text yes ✅ 26 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts

companies (base)

field type required refs used where
company_email email no ✅ 16 src/app/(app)/companies/page.tsx
src/app/(app)/companies/[id]/page.tsx
src/components/company-form.tsx
src/lib/pb-helpers.ts
company_tel number no ✅ 16 src/app/(app)/companies/page.tsx
src/app/(app)/companies/[id]/page.tsx
src/components/company-form.tsx
src/lib/pb-helpers.ts
vendor text no ✅ 41 src/app/(app)/companies/page.tsx
src/app/(app)/companies/[id]/page.tsx
src/app/api/v1/companies/route.ts
src/app/api/v1/companies/[id]/route.ts
src/app/api/mcp/route.ts
... +9 more
address text no ✅ 52 src/app/(app)/companies/page.tsx
src/app/(app)/companies/[id]/page.tsx
src/app/api/v1/companies/route.ts
src/app/api/v1/companies/[id]/route.ts
src/app/api/mcp/route.ts
... +8 more
coordinates geoPoint no ✅ 109 src/app/(app)/companies/[id]/page.tsx
src/app/api/v1/companies/route.ts
src/app/api/v1/companies/[id]/route.ts
src/app/api/mcp/route.ts
src/components/company-form.tsx
... +8 more
company text no ✅ 403 src/app/(app)/companies/page.tsx
src/app/(app)/companies/[id]/page.tsx
src/app/api/v1/companies/route.ts
src/app/api/v1/companies/[id]/route.ts
src/app/api/mcp/route.ts
... +13 more

customers (base)

field type required refs used where
lastvisiteddate date no ✅ 12 src/components/customer-form.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.test.ts
src/lib/server/management-service.ts
scripts/setup-pocketbase.ts
... +4 more
dateadded date no ✅ 16 src/app/(app)/customers/[id]/page.tsx
src/components/customer-form.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
... +6 more
buyer_email text no ✅ 33 src/app/(app)/customers/[id]/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/customer-form.tsx
... +8 more
alternative_email text no ✅ 34 src/app/(app)/customers/[id]/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/customer-form.tsx
... +8 more
coordinates geoPoint no ✅ 100 src/app/(app)/customers/[id]/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/customer-form.tsx
... +10 more
rep relation no ✅ 121 src/app/(app)/customers/page.tsx
src/app/(app)/customers/[id]/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
src/app/api/mcp/route.ts
... +11 more
description text no ✅ 158 src/app/(app)/customers/page.tsx
src/app/(app)/customers/[id]/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
src/app/api/v1/quotes/[id]/pdf/route.ts
... +16 more
number text no ✅ 228 src/app/(app)/customers/page.tsx
src/app/(app)/customers/[id]/page.tsx
src/app/(app)/dashboard/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
... +19 more
company relation no ✅ 396 src/app/(app)/customers/page.tsx
src/app/(app)/customers/[id]/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
src/app/api/v1/delivery-notes/route.ts
... +17 more
customer text no ✅ 542 src/app/(app)/customers/page.tsx
src/app/(app)/customers/[id]/page.tsx
src/app/(app)/dashboard/page.tsx
src/app/api/v1/customers/route.ts
src/app/api/v1/customers/[id]/route.ts
... +20 more

delivery_notes (base)

field type required refs used where
delivery_date date no ✅ 6 src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-19-create-delivery-notes.ts
created_by relation no ✅ 10 src/app/api/invoicing/delivery-note/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-19-create-delivery-notes.ts
customer_po text no ✅ 12 src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-19-create-delivery-notes.ts
signed_copy file no ✅ 23 src/app/api/v1/delivery-notes/[id]/signed-copy/route.ts
src/lib/server/delivery-notes-service.ts
scripts/migrations/2026-07-19-delivery-notes-signed-copy.ts
delivery_note_number text yes ✅ 57 src/app/api/invoicing/delivery-note/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-19-create-delivery-notes.ts
notes text no ✅ 69 src/app/api/v1/delivery-notes/[id]/signed-copy/route.ts
src/app/api/invoicing/delivery-note/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
... +2 more
company relation no ✅ 88 src/app/api/invoicing/delivery-note/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-19-create-delivery-notes.ts
order relation no ✅ 132 src/app/api/invoicing/delivery-note/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-19-create-delivery-notes.ts
customer relation no ✅ 138 src/app/api/invoicing/delivery-note/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-19-delivery-notes-signed-copy.ts
... +1 more
status select yes ✅ 168 src/app/api/v1/delivery-notes/[id]/signed-copy/route.ts
src/app/api/invoicing/delivery-note/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
... +1 more

driver_locations (base) ⚰️ DEAD COLLECTION

field type required refs used where
accuracy number no ❌ unused —
geoPoint geoPoint no ❌ unused —
heading number no ❌ unused —
latitude number no ❌ unused —
longitude number no ❌ unused —
relation relation no ❌ unused —
speed number no ❌ unused —
timestamp date no ❌ unused —

dupicate_custmers (view) ⚰️ DEAD COLLECTION

field type required refs used where
customer text no ❌ unused —
total_count number no ❌ unused —

letterhead_settings (base)

field type required refs used where
address text no ✅ 4 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
bank_branch_code text no ✅ 4 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
bank_name text no ✅ 4 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
default_markup_percent number no ✅ 4 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
footer_text text no ✅ 4 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
is_active bool no ✅ 4 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
phone text no ✅ 4 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
bank_account_number text no ✅ 5 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
registration_number text no ✅ 5 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
vat_number text no ✅ 5 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
terms text no ✅ 7 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
accent_color text no ✅ 9 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
display_name text no ✅ 9 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
company text no ✅ 14 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts
logo file no ✅ 16 src/lib/letterhead.ts
src/lib/pdf/render.test.ts
scripts/dev/debug-image-test.tsx
scripts/dev/generate-sample-pdf.ts

masterdrilling_consignment (base) ⚰️ DEAD COLLECTION

field type required refs used where
category select no ❌ unused —
cost_price text no ❌ unused —
description text no ❌ unused —
markup text no ❌ unused —
product_code number no ❌ unused —
product_code_descrip text no ❌ unused —
selling_price text no ❌ unused —
supplier relation no ❌ unused —

order_counters (base)

field type required refs used where
last_seq number no ✅ 13 src/lib/server/orders-service.ts
src/lib/server/orders-service.test.ts
scripts/migrations/2026-07-10-restore-counters.ts
year number yes ✅ 61 src/lib/server/orders-service.ts
src/lib/server/orders-service.test.ts
scripts/migrations/2026-07-10-restore-counters.ts
month number yes ✅ 77 src/lib/server/orders-service.ts
src/lib/server/orders-service.test.ts
scripts/migrations/2026-07-10-restore-counters.ts

order_items (base)

field type required refs used where
delivered_at date no ❌ unused —
delivery_status select no ❌ unused —
drv_assigned_at date no ❌ unused —
invoice_status select no ❌ unused —
qb_invoice_pdf_ text no ❌ unused —
qty_assigned number no ❌ unused —
qty_delivered number no ❌ unused —
qty_processed number no ❌ unused —
legacy_order_item_id text no ⚠️ 1 ref scripts/migrations/2026-07-20-delivery-tracking.ts
markup_percent number no ✅ 3 src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
src/lib/server/orders-service.test.ts
driver_status select no ✅ 4 src/app/api/v1/order-items/[id]/status/route.test.ts
src/app/api/mcp/route.test.ts
src/lib/pb-helpers.ts
drv_collected_at date no ✅ 4 src/app/(app)/collection-confirm/page.tsx
scripts/migrations/2026-07-07-order-items-collection-photo.ts
qb_invoice_pdf file no ✅ 9 src/app/(app)/invoicing/page.tsx
src/app/api/invoicing/print-bundle/route.ts
order_item_attachements file no ✅ 16 src/app/(app)/collection-confirm/page.tsx
src/app/api/invoicing/delivery-note-print/route.ts
src/app/api/invoicing/delivery-note/route.ts
src/app/api/invoicing/delivery-note-pdf/route.ts
markup number no ✅ 19 src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
src/lib/server/order-completion.test.ts
src/lib/server/orders-service.test.ts
scripts/setup-pocketbase.ts
problem_notes text no ✅ 19 src/app/(app)/collection-confirm/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
src/lib/server/driver-stops.ts
quote_item relation no ✅ 19 src/app/(app)/orders/[id]/process/page.tsx
src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
src/lib/server/delivery-notes-service.ts
src/lib/server/orders-service.test.ts
... +1 more
matched_price_list_id text no ✅ 21 src/app/(app)/orders/[id]/process/page.tsx
scripts/migrations/2026-07-06-order-items-pricing-fields.ts
pricing_notes text no ✅ 23 src/app/(app)/orders/[id]/process/page.tsx
src/app/api/mcp/route.test.ts
scripts/migrations/2026-07-06-order-items-pricing-fields.ts
drv_status select no ✅ 25 src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/app/api/v1/order-items/[id]/status/route.test.ts
src/app/api/mcp/route.test.ts
... +5 more
order_item_details json no ✅ 28 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/invoicing/page.tsx
src/app/api/invoicing/delivery-note-print/route.ts
src/app/api/invoicing/delivery-note-print-tracking/route.ts
src/app/api/invoicing/delivery-note/route.ts
... +2 more
problem_flag bool no ✅ 28 src/app/(app)/collection-confirm/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
src/lib/pb-helpers.ts
src/lib/server/driver-stops.ts
problem_type select no ✅ 28 src/app/(app)/collection-confirm/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
src/lib/pb-helpers.ts
src/lib/server/driver-stops.ts
stock_booked_from relation no ✅ 31 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/api/v1/stock/fulfill/route.test.ts
src/app/api/v1/stock/fulfill/route.ts
src/app/api/v1/stock/surplus-book/route.test.ts
... +2 more
pricing_source text no ✅ 33 src/app/(app)/orders/[id]/process/page.tsx
src/lib/server/delivery-notes-service.ts
src/lib/server/delivery-notes-service.test.ts
scripts/migrations/2026-07-06-order-items-pricing-fields.ts
ready_for_collection bool no ✅ 41 src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/lib/server/purchase-orders-service.ts
... +3 more
po_description text no ✅ 46 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
... +9 more
assigned_at date no ✅ 63 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
... +6 more
delivery_note_number text no ✅ 70 src/app/(app)/invoicing/page.tsx
src/app/api/invoicing/delivery-note-print/route.ts
src/app/api/invoicing/delivery-note-print-tracking/route.ts
src/app/api/invoicing/delivery-note/route.ts
src/app/api/invoicing/delivery-note-pdf/route.ts
... +5 more
surplus_qty number no ✅ 70 src/app/(app)/collection-confirm/page.tsx
src/app/api/v1/stock/surplus-book/route.test.ts
src/app/api/v1/stock/surplus-book/route.ts
src/lib/server/stock-surplus.test.ts
src/lib/server/stock-surplus.ts
... +1 more
purchase_order relation no ✅ 71 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/[id]/page.tsx
... +16 more
drv_id relation no ✅ 72 src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/api/v1/driver/stops/route.test.ts
... +9 more
qty_collected number no ✅ 76 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/invoicing/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
src/app/api/v1/stock/surplus-book/route.test.ts
... +7 more
order_qty number no ✅ 87 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/(app)/invoicing/page.tsx
src/app/api/v1/driver/stops/route.test.ts
... +17 more
sku text no ✅ 87 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
... +11 more
driver relation no ✅ 105 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
... +11 more
cost_price number no ✅ 109 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
... +14 more
selling_price number no ✅ 132 src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/(app)/invoicing/page.tsx
... +12 more
quantity number no ✅ 215 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
... +24 more
item_status select yes ✅ 227 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/page.tsx
... +38 more
notes text no ✅ 232 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
... +21 more
description text yes ✅ 296 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/page.tsx
... +26 more
supplier relation no ✅ 467 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/new/page.tsx
... +33 more
order relation no ✅ 628 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/orders/page.tsx
... +40 more

orders (base)

field type required refs used where
order_attachements file no ❌ unused —
quote_match_confidence number no ✅ 3 src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
scripts/setup-pocketbase.ts
is_repair_order bool no ✅ 4 src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
src/lib/server/orders-service.test.ts
scripts/setup-pocketbase.ts
potential_quote_confidence number no ✅ 12 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
scripts/setup-pocketbase.ts
... +1 more
quote_match_method text no ✅ 12 src/app/(app)/orders/[id]/page.tsx
src/lib/pb-helpers.ts
scripts/migrations/2026-06-27-add-order-quote-match-fields.ts
quote_matching_attempted bool no ✅ 12 src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
src/lib/server/orders-service.test.ts
... +1 more
invoiced bool no ✅ 22 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/lib/pb-helpers.ts
src/lib/server/orders-service.ts
... +4 more
quote_reference_text text no ✅ 22 src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/lib/pb-helpers.ts
scripts/migrations/2026-06-27-add-order-quote-match-fields.ts
scripts/dev/seed-and-test-matcher.ts
potential_quote relation no ✅ 30 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/app/api/v1/orders/[id]/matched-attachments/route.ts
src/lib/pb-helpers.ts
... +3 more
order_number text yes ✅ 79 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
... +9 more
notes text no ✅ 111 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
src/app/api/v1/orders/[id]/matched-attachments/route.ts
src/app/api/mcp/route.ts
... +7 more
company relation yes ✅ 244 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
... +11 more
customer relation no ✅ 327 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/dashboard/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
... +12 more
quote relation no ✅ 510 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/dashboard/page.tsx
src/app/(app)/orders/page.tsx
src/app/(app)/orders/new/page.tsx
src/app/(app)/orders/[id]/page.tsx
... +13 more

pos (base) ⚰️ DEAD COLLECTION

field type required refs used where
brand text no ❌ unused —
category text no ❌ unused —
cost_price number no ❌ unused —
description text no ❌ unused —
markup number no ❌ unused —
search_text text no ❌ unused —
selling_price number no ❌ unused —
sku text no ❌ unused —
sku_normalised text no ❌ unused —
source_file text no ❌ unused —
source_file_id relation no ❌ unused —
specifications json no ❌ unused —
stock_qty number no ❌ unused —
subcategory text no ❌ unused —
supplier text no ❌ unused —
unit text no ❌ unused —

price_list (base)

field type required refs used where
source_file_id relation no ❌ unused —
stock_qty number no ❌ unused —
source_file text no ✅ 16 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
scripts/migrations/2026-06-30-backfill-price-list-search-text.ts
scripts/migrations/2026-06-30-add-price-list-source-file.ts
markup number no ✅ 21 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
scripts/dev/seed-test-grinders.ts
specifications json no ✅ 21 src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-06-30-backfill-price-list-search-text.ts
scripts/migrations/2026-06-30-add-price-list-search-text.ts
scripts/dev/seed-test-grinders.ts
subcategory text no ✅ 21 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-06-30-add-price-list-search-text.ts
scripts/utils/resolve-price-list-ids.ts
... +1 more
sku_normalised text no ✅ 26 src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-06-30-add-price-list-sku-normalised.ts
scripts/utils/resolve-price-list-ids.ts
scripts/dev/seed-test-grinders.ts
cost_price number no ✅ 29 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/utils/resolve-price-list-ids.ts
scripts/dev/seed-test-grinders.ts
unit text no ✅ 31 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/utils/resolve-price-list-ids.ts
scripts/dev/seed-test-grinders.ts
selling_price number no ✅ 33 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/utils/resolve-price-list-ids.ts
scripts/dev/seed-test-grinders.ts
search_text text no ✅ 39 src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-06-30-backfill-price-list-search-text.ts
scripts/migrations/2026-06-30-add-price-list-search-text.ts
scripts/dev/seed-test-grinders.ts
category text no ✅ 59 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
scripts/migrations/2026-06-30-add-price-list-search-text.ts
... +2 more
sku text no ✅ 64 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-06-30-add-price-list-sku-normalised.ts
scripts/migrations/2026-06-30-add-price-list-search-text.ts
... +2 more
description text no ✅ 65 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
scripts/migrations/2026-06-30-add-price-list-search-text.ts
... +2 more
brand text no ✅ 67 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
scripts/migrations/2026-06-30-add-price-list-search-text.ts
... +2 more
supplier text no ✅ 77 src/components/pricelist-catalogue.tsx
src/lib/pb-helpers.ts
src/lib/server/price-list-match.ts
scripts/migrations/2026-06-30-backfill-price-list-search-text.ts
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
... +3 more

purchase_orders (base)

field type required refs used where
last_reply_at date no ✅ 5 scripts/setup-pocketbase.ts
scripts/migrations/2026-07-06-purchase-orders-send-fields.ts
email_message_id text no ✅ 7 src/lib/server/purchase-orders-service.ts
scripts/migrations/2026-07-06-purchase-orders-send-fields.ts
total_amount number no ✅ 8 src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/api/v1/purchase-orders/[id]/pdf/route.ts
scripts/setup-pocketbase.ts
scripts/migrations/2026-06-28-add-purchase-order-pdfs.ts
email_error text no ✅ 14 src/app/(app)/orders/[id]/page.tsx
src/app/api/v1/purchase-orders/[id]/send-email/route.ts
src/lib/server/purchase-orders-service.ts
scripts/migrations/2026-07-06-purchase-orders-send-fields.ts
email_payload json no ✅ 24 src/app/(app)/orders/[id]/page.tsx
src/app/api/v1/purchase-orders/[id]/send-email/route.ts
src/lib/server/purchase-orders-service.ts
scripts/migrations/2026-07-06-purchase-orders-send-fields.ts
order_item relation no ✅ 24 src/app/(app)/orders/[id]/process/page.tsx
src/lib/pb-helpers.ts
src/lib/server/purchase-orders-service.ts
scripts/backfill-po-items.mjs
po_number text yes ✅ 27 src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/api/v1/purchase-orders/[id]/pdf/route.ts
src/app/api/v1/purchase-orders/[id]/send-email/route.ts
src/lib/pb-helpers.ts
... +3 more
documents_history json no ✅ 41 src/app/(app)/orders/[id]/page.tsx
src/app/api/v1/purchase-orders/[id]/pdf/route.ts
src/app/api/v1/purchase-orders/[id]/send-email/route.ts
scripts/migrations/2026-07-06-purchase-orders-documents-field.ts
scripts/migrations/2026-07-09-po-additional-attachments.ts
... +1 more
documents file no ✅ 75 src/app/(app)/orders/[id]/page.tsx
src/app/api/v1/purchase-orders/[id]/pdf/route.ts
src/app/api/v1/purchase-orders/[id]/send-email/route.ts
src/app/api/v1/purchase-orders/[id]/attachments/upload/route.ts
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
... +3 more
order relation yes ✅ 211 src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/api/v1/purchase-orders/[id]/pdf/route.ts
src/app/api/v1/purchase-orders/[id]/send-email/outcome/route.ts
src/app/api/mcp/route.ts
... +4 more
supplier relation yes ✅ 230 src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/api/v1/purchase-orders/[id]/pdf/route.ts
src/app/api/v1/purchase-orders/[id]/send-email/route.ts
src/app/api/v1/purchase-orders/[id]/attachments/upload/route.ts
... +7 more
status select no ✅ 234 src/app/(app)/orders/[id]/page.tsx
src/app/(app)/orders/[id]/process/page.tsx
src/app/api/v1/purchase-orders/[id]/pdf/route.ts
src/app/api/v1/purchase-orders/[id]/send-email/route.ts
src/app/api/v1/purchase-orders/[id]/send-email/outcome/route.ts
... +11 more

quote_attachments (base)

field type required refs used where
uploaded_at autodate no ✅ 22 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/attachments/route.ts
src/app/api/v1/orders/[id]/matched-attachments/route.ts
src/components/delivery-notes/preview-dialog.tsx
src/lib/pb-helpers.ts
... +2 more
size_bytes number no ✅ 25 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/attachments/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/app/api/v1/orders/[id]/matched-attachments/route.ts
... +3 more
quote_item relation no ✅ 26 src/app/api/v1/orders/[id]/matched-attachments/route.ts
src/lib/pb-helpers.ts
src/lib/server/delivery-notes-service.ts
scripts/migrations/2026-07-06-quote-attachments-quote-item-and-kind.ts
content_type text no ✅ 29 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/attachments/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/app/api/v1/orders/[id]/matched-attachments/route.ts
... +3 more
email_message_id text no ✅ 31 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
... +2 more
direction select no ✅ 55 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/attachments/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/app/api/v1/orders/[id]/matched-attachments/route.ts
src/lib/pb-helpers.ts
... +3 more
filename text yes ✅ 81 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/attachments/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
... +6 more
kind select no ✅ 95 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/app/api/v1/orders/[id]/matched-attachments/route.ts
src/components/delivery-notes/preview-dialog.tsx
... +6 more
file file yes ✅ 110 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/attachments/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
... +8 more
quote relation no ✅ 675 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/attachments/route.ts
src/app/api/v1/quotes/[id]/attachments/upload/route.ts
src/app/api/v1/orders/[id]/matched-attachments/route.ts
... +10 more

quote_counters (base)

field type required refs used where
last_seq number no ✅ 11 src/lib/server/quotes-service.ts
scripts/migrations/2026-07-10-restore-counters.ts
year number yes ✅ 46 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/create-quote-attachments-and-replies.ts
scripts/migrations/2026-07-10-restore-counters.ts
month number yes ✅ 51 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/create-quote-attachments-and-replies.ts
scripts/migrations/2026-07-10-restore-counters.ts

quote_item_attachments (base)

field type required refs used where
uploaded_at autodate no ✅ 4 src/app/api/v1/sprint/items/[id]/attachments/route.ts
content_type text no ✅ 9 src/app/api/v1/quotes/items/[id]/attachments/upload/route.ts
src/app/api/v1/sprint/items/[id]/attachments/route.ts
src/app/api/v1/sprint/items/[id]/attachments/upload/route.ts
size_bytes number no ✅ 9 src/app/api/v1/quotes/items/[id]/attachments/upload/route.ts
src/app/api/v1/sprint/items/[id]/attachments/route.ts
src/app/api/v1/sprint/items/[id]/attachments/upload/route.ts
notes text no ✅ 10 src/app/api/v1/quotes/items/[id]/attachments/upload/route.ts
src/app/api/v1/sprint/items/[id]/attachments/route.ts
src/app/api/v1/sprint/items/[id]/attachments/upload/route.ts
quote_item relation yes ✅ 10 src/app/api/v1/quotes/items/[id]/attachments/upload/route.ts
src/app/api/v1/sprint/attachment-counts/route.ts
src/app/api/v1/sprint/items/[id]/attachments/route.ts
src/app/api/v1/sprint/items/[id]/attachments/upload/route.ts
filename text yes ✅ 17 src/app/api/v1/quotes/items/[id]/attachments/upload/route.ts
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
src/app/api/v1/sprint/items/[id]/attachments/route.ts
src/app/api/v1/sprint/items/[id]/attachments/upload/route.ts
source select yes ✅ 23 src/app/api/v1/quotes/items/[id]/attachments/upload/route.ts
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
src/app/api/v1/sprint/items/[id]/attachments/route.ts
src/app/api/v1/sprint/items/[id]/attachments/upload/route.ts
file file yes ✅ 37 src/app/api/v1/quotes/items/[id]/attachments/upload/route.ts
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
src/app/api/v1/sprint/items/[id]/attachments/route.ts
src/app/api/v1/sprint/items/[id]/attachments/upload/route.ts

quote_items (base)

field type required refs used where
supplier_reply_count number no ✅ 3 scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
outbound_sent_at date no ✅ 4 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
supplier_replied_at date no ✅ 4 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
outbound_message_id text no ✅ 5 src/app/(app)/sprint/page.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
quote_pdf_id text no ✅ 5 src/lib/pdf/render.test.ts
scripts/setup-pocketbase.ts
scripts/dev/debug-logo.ts
scripts/dev/generate-sample-pdf.ts
quote_description text no ✅ 7 src/app/(app)/sprint/page.tsx
src/components/sprint-item-pricing-modal.tsx
claimed_at date no ✅ 15 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/sprint/items/[id]/claim/route.ts
src/components/sprint-item-pricing-modal.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
claim_expires_at date no ✅ 22 src/app/(app)/sprint/page.tsx
src/app/api/v1/sprint/items/[id]/claim/route.ts
src/components/sprint-item-pricing-modal.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
quote_reference text no ✅ 23 src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pb-helpers.ts
... +5 more
matched_price_list_id text no ✅ 28 src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/[id]/re-price/route.ts
src/app/api/v1/quotes/[id]/items/[itemId]/lookup/route.ts
src/app/api/mcp/route.ts
src/lib/pdf/render.test.ts
... +3 more
claim_status select no ✅ 32 src/app/(app)/sprint/page.tsx
src/app/api/v1/sprint/items/[id]/claim/route.ts
src/components/sprint-item-pricing-modal.tsx
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
claimed_by text no ✅ 40 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/sprint/items/[id]/claim/route.ts
src/components/sprint-item-pricing-modal.tsx
src/lib/pdf/render.test.ts
... +4 more
pricing_notes text no ✅ 40 src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/[id]/re-price/route.ts
src/app/api/v1/quotes/[id]/items/[itemId]/lookup/route.ts
src/app/api/mcp/route.ts
src/lib/pdf/render.test.ts
... +2 more
user_edited bool no ✅ 42 src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/items/rewrite/route.ts
src/app/api/mcp/route.ts
src/components/rewrite-quote-modal.tsx
... +8 more
is_processed bool no ✅ 43 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/pdf/route.ts
... +9 more
pricing_source text no ✅ 50 src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/re-price/route.ts
src/app/api/v1/quotes/[id]/items/[itemId]/lookup/route.ts
src/app/api/mcp/route.ts
... +7 more
category relation no ✅ 51 src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/items/[itemId]/lookup/route.ts
src/lib/pb-helpers.ts
scripts/migrations/2026-07-02-add-sprint-categories-and-claims.ts
... +1 more
quantity number no ✅ 92 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
... +17 more
quote_number text no ✅ 107 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
... +15 more
markup number no ✅ 118 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
... +14 more
sku text no ✅ 118 src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/re-price/route.ts
src/app/api/v1/quotes/[id]/items/[itemId]/lookup/route.ts
src/app/api/mcp/route.ts
... +7 more
notes text no ✅ 151 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/items/rewrite/route.ts
src/app/api/v1/quotes/[id]/create-from-template/route.ts
... +21 more
cost_price number no ✅ 170 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
... +22 more
selling_price number no ✅ 178 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
... +22 more
supplier relation no ✅ 216 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
... +24 more
description text no ✅ 341 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/items/rewrite/route.ts
src/app/api/v1/quotes/[id]/create-from-template/route.ts
... +29 more
quote relation yes ✅ 901 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/sprint/page.tsx
src/app/api/v1/quotes/items/rewrite/route.ts
src/app/api/v1/quotes/[id]/create-from-template/route.ts
... +28 more

quote_replies (base)

field type required refs used where
quoted_text text no ✅ 5 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
body_html text no ✅ 6 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
from_name text no ✅ 9 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
in_reply_to text no ✅ 12 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
received_at date yes ✅ 15 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
body_plain text no ✅ 19 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
email_message_id text no ✅ 23 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/create-quote-attachments-and-replies.ts
from_email email yes ✅ 37 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
subject text yes ✅ 74 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
quote relation yes ✅ 197 src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/create-quote-attachments-and-replies.ts

quotes (base)

field type required refs used where
email_tracking_id text no ✅ 4 src/lib/pdf/render.test.ts
scripts/setup-pocketbase.ts
scripts/dev/debug-logo.ts
scripts/dev/generate-sample-pdf.ts
email_opened_at date no ✅ 5 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
scripts/setup-pocketbase.ts
scripts/dev/debug-logo.ts
scripts/dev/generate-sample-pdf.ts
email_bcc text no ✅ 6 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
scripts/migrations/2026-06-23-add-quote-email-composition-fields.ts
email_message text no ✅ 6 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
scripts/migrations/2026-06-23-add-quote-email-composition-fields.ts
attach_auth_letters bool no ✅ 7 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/2026-06-23-add-quote-email-composition-fields.ts
email_body text no ✅ 7 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/setup-pocketbase.ts
... +2 more
email_cc text no ✅ 7 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/2026-06-23-add-quote-email-composition-fields.ts
email_delivered_at date no ✅ 7 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/setup-pocketbase.ts
... +2 more
email_subject_outbound text no ✅ 7 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/2026-06-23-add-quote-email-composition-fields.ts
has_new_reply bool no ✅ 7 src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/setup-pocketbase.ts
scripts/dev/debug-logo.ts
... +1 more
email_outbound_attachment_ids text no ✅ 8 src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/2026-06-23-add-quote-outbound-email-fields.ts
approved_by text no ✅ 9 src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
scripts/setup-pocketbase.ts
scripts/dev/debug-logo.ts
... +1 more
email_opened bool no ✅ 9 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pdf/render.test.ts
scripts/setup-pocketbase.ts
... +2 more
email_outbound_message_id text no ✅ 9 src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/2026-06-23-add-quote-outbound-email-fields.ts
template_source_id relation no ✅ 9 src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pb-helpers.ts
src/lib/pdf/render.test.ts
scripts/migrations/2026-06-23-add-quote-template-fields.ts
... +1 more
generated_from_template_id relation no ✅ 10 src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pb-helpers.ts
src/lib/pdf/render.test.ts
... +2 more
email_delivered bool no ✅ 11 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
... +4 more
email_sender email no ✅ 12 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/setup-pocketbase.ts
... +2 more
last_reply_at date no ✅ 13 src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
... +3 more
pdf_generated_at date no ✅ 13 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/pdf/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
... +4 more
email_subject text no ✅ 15 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/setup-pocketbase.ts
... +3 more
has_attachments bool no ✅ 15 src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/setup-pocketbase.ts
scripts/smoke/upload-attachment.ts
... +2 more
email_failed_at date no ✅ 16 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/setup-pocketbase.ts
... +2 more
external_number text no ✅ 18 src/app/api/v1/quotes/lookup/route.ts
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pb-helpers.ts
... +5 more
company_letterhead select no ✅ 19 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
... +8 more
sending_started_at date no ✅ 22 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/2026-06-23-add-quote-outbound-email-fields.ts
email_error text no ✅ 23 src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
scripts/migrations/2026-06-23-add-quote-outbound-email-fields.ts
quote_date date no ✅ 25 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pb-helpers.ts
... +4 more
validity_days number no ✅ 26 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
src/lib/pb-helpers.ts
... +5 more
email_message_id text no ✅ 28 src/app/(app)/quotes/[id]/page.tsx
src/app/api/v1/quotes/[id]/pdf/route.ts
src/lib/pdf/render.test.ts
src/lib/server/quotes-service.ts
src/lib/server/quotes-service.test.ts
... +3 more
quote_reference text no ✅ 28 src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/lookup/route.ts
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
... +6 more
claimed_by text no ✅ 32 src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/lib/pdf/render.test.ts
scripts/setup-pocketbase.ts
scripts/dev/debug-logo.ts
... +1 more
follow_up_due date no ✅ 32 src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/dashboard/page.tsx
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/clone/route.ts
... +4 more
rfq_number text no ✅ 39 src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/lookup/route.ts
src/app/api/v1/quotes/[id]/create-from-template/route.ts
... +11 more
is_template bool no ✅ 46 src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/dashboard/page.tsx
src/app/api/v1/quotes/lookup/route.ts
src/app/api/v1/quotes/[id]/create-from-template/route.ts
... +6 more
delivery_note relation no ✅ 81 src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/lib/pb-helpers.ts
src/lib/server/quotes-service.ts
src/lib/server/delivery-notes-service.ts
... +2 more
markup number no ✅ 97 src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
src/app/api/v1/quotes/[id]/save-as-template/route.ts
src/app/api/v1/quotes/[id]/re-price/route.ts
... +10 more
quote_number text no ✅ 132 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
... +23 more
notes text no ✅ 149 src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/api/v1/quotes/[id]/create-from-template/route.ts
... +19 more
description text no ✅ 230 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
... +21 more
company relation no ✅ 289 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
... +19 more
status select no ✅ 474 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
... +27 more
customer relation yes ✅ 519 src/app/(app)/customers/[id]/page.tsx
src/app/(app)/quotes/page.tsx
src/app/(app)/quotes/approvals/page.tsx
src/app/(app)/quotes/[id]/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
... +24 more

raw_price_list (base)

field type required refs used where
log_summary text no ✅ 8 src/app/(app)/pricelist/page.tsx
src/lib/pb-helpers.ts
file_name text no ✅ 9 src/app/(app)/pricelist/page.tsx
scripts/migrations/2026-06-30-add-pricelist-notes.ts
supplier_file file no ✅ 10 src/app/(app)/pricelist/page.tsx
src/lib/pb-helpers.ts
scripts/migrations/2026-06-30-add-raw-price-list.ts
supplier_name relation no ✅ 16 src/app/(app)/pricelist/page.tsx
src/lib/pb-helpers.ts
scripts/migrations/2026-06-30-backfill-price-list-search-text.ts
scripts/migrations/2026-06-30-add-raw-price-list.ts
notes text no ✅ 41 src/app/(app)/pricelist/page.tsx
src/lib/pb-helpers.ts
scripts/migrations/2026-06-30-add-pricelist-notes.ts
status select no ✅ 79 src/app/(app)/pricelist/page.tsx
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
src/lib/pb-helpers.ts

repairs (base)

field type required refs used where
fault_description text yes ✅ 4 src/lib/pb-helpers.ts
item_description text yes ✅ 4 src/lib/pb-helpers.ts
repair_number text yes ✅ 5 src/lib/pb-helpers.ts
notes text no ✅ 12 src/lib/pb-helpers.ts
company relation no ✅ 53 src/lib/pb-helpers.ts
status select yes ✅ 56 src/lib/pb-helpers.ts
customer relation no ✅ 64 src/lib/pb-helpers.ts
order relation no ✅ 81 src/lib/pb-helpers.ts

rfq_outbound (base)

field type required refs used where
email_body text no ✅ 2 scripts/migrations/2026-06-30-create-rfq-outbound.ts
email_subject text yes ✅ 2 scripts/migrations/2026-06-30-create-rfq-outbound.ts
raw_email_id text no ✅ 2 scripts/migrations/2026-06-30-create-rfq-outbound.ts
sent_at date no ✅ 2 scripts/migrations/2026-06-30-create-rfq-outbound.ts
email_message_id text no ✅ 3 scripts/migrations/2026-06-30-create-rfq-outbound.ts
quote_item relation yes ✅ 4 scripts/migrations/2026-06-30-create-rfq-outbound.ts
status text no ✅ 4 scripts/migrations/2026-06-30-create-rfq-outbound.ts
supplier relation no ✅ 5 scripts/migrations/2026-06-30-create-rfq-outbound.ts

stock_items (base)

field type required refs used where
location text no ✅ 33 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock/page.test.tsx
src/app/(app)/stock/page.tsx
src/app/(app)/stock/[id]/page.tsx
... +5 more
target_qty number no ✅ 40 src/app/(app)/stock-orders/reorder/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock/page.tsx
src/app/(app)/stock/[id]/page.tsx
scripts/migrations/2026-07-15-add-stock-items-target-qty.ts
is_active bool no ✅ 50 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/reorder/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock/page.test.tsx
src/app/(app)/stock/page.tsx
... +16 more
unit text no ✅ 50 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/reorder/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/page.test.tsx
... +14 more
min_qty number no ✅ 56 src/app/(app)/stock-orders/reorder/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock/page.test.tsx
src/app/(app)/stock/page.tsx
src/app/(app)/stock/[id]/page.tsx
... +8 more
sku text no ✅ 101 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock/page.test.tsx
src/app/(app)/stock/page.tsx
... +12 more
notes text no ✅ 179 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/page.test.tsx
... +18 more
current_qty number no ✅ 184 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/reorder/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
... +20 more
description text no ✅ 201 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/page.test.tsx
... +21 more
supplier relation no ✅ 293 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/reorder/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
... +22 more
name text yes ✅ 447 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/reorder/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock/page.test.tsx
... +21 more

stock_ledger (base)

field type required refs used where
reference_id text no ✅ 25 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/[id]/page.tsx
src/app/api/v1/stock/fulfill/route.test.ts
src/app/api/v1/stock/fulfill/route.ts
... +9 more
reference_type text no ✅ 27 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/[id]/page.tsx
src/app/api/v1/stock/fulfill/route.test.ts
src/app/api/v1/stock/fulfill/route.ts
... +9 more
created_by relation no ✅ 28 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/[id]/page.tsx
src/app/api/v1/stock/fulfill/route.ts
src/app/api/v1/stock/surplus-book/route.test.ts
... +8 more
change_qty number yes ✅ 39 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/[id]/page.tsx
src/app/api/v1/stock/fulfill/route.test.ts
src/app/api/v1/stock/fulfill/route.ts
... +9 more
stock_item relation yes ✅ 105 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/page.tsx
src/app/(app)/stock/[id]/page.tsx
... +12 more
notes text no ✅ 107 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/page.tsx
src/app/(app)/stock/[id]/page.tsx
... +10 more
reason select no ✅ 158 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/[id]/page.tsx
src/app/api/v1/stock/fulfill/route.test.ts
src/app/api/v1/stock/fulfill/route.ts
... +9 more

stock_purchase_items (base)

field type required refs used where
problem_notes text no ✅ 22 src/app/(app)/collection-confirm/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
src/lib/server/driver-stops.ts
scripts/migrations/2026-07-17-add-stock-purchase-problem-fields.ts
problem_type text no ✅ 32 src/app/(app)/collection-confirm/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
src/lib/server/driver-stops.ts
scripts/migrations/2026-07-17-add-stock-purchase-problem-fields.ts
problem_flag bool no ✅ 33 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
src/lib/server/driver-stops.ts
... +1 more
cost_price number no ✅ 35 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/[id]/page.tsx
... +5 more
assigned_at date no ✅ 57 src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/api/v1/driver/stops/route.test.ts
... +3 more
drv_id relation no ✅ 67 src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/api/v1/driver/stops/route.test.ts
src/app/api/v1/driver/stops/[id]/status/route.test.ts
... +3 more
quantity_received number no ✅ 73 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/(app)/stock/[id]/page.tsx
... +7 more
quantity number yes ✅ 108 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/stock-orders/new/page.tsx
... +10 more
notes text no ✅ 109 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
... +8 more
stock_item relation yes ✅ 117 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/stock-orders/new/page.tsx
... +10 more
description text yes ✅ 123 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.test.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
... +10 more
purchase relation yes ✅ 241 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/stock-orders/page.tsx
... +13 more
status select no ✅ 281 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/collection-pool/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/stock-orders/page.tsx
... +12 more

stock_purchases (base)

field type required refs used where
email_message_id text no ✅ 10 src/lib/server/stock-purchases-migration.test.ts
src/lib/server/stock-purchases-service.ts
scripts/migrations/2026-07-14-create-stock-purchases.ts
documents_history json no ✅ 14 src/app/api/v1/stock-purchases/[id]/pdf/route.ts
src/app/api/v1/stock-purchases/[id]/send-email/route.ts
scripts/migrations/2026-07-16-add-stock-purchase-documents-history.ts
email_error text no ✅ 17 src/app/api/v1/stock-purchases/[id]/send-email/route.ts
src/lib/server/stock-purchases-migration.test.ts
src/lib/server/stock-purchases-service.ts
scripts/migrations/2026-07-14-create-stock-purchases.ts
email_payload json no ✅ 20 src/app/api/v1/stock-purchases/[id]/send-email/route.ts
src/lib/server/stock-purchases-migration.test.ts
src/lib/server/stock-purchases-service.ts
scripts/migrations/2026-07-14-create-stock-purchases.ts
documents file no ✅ 30 src/app/api/v1/stock-purchases/[id]/pdf/route.ts
src/app/api/v1/stock-purchases/[id]/send-email/route.ts
src/app/api/v1/files/[collection]/[recordId]/[filename]/route.ts
src/lib/server/stock-purchases-service.ts
scripts/migrations/2026-07-15-stock-purchase-line-state.ts
... +1 more
purchase_number text yes ✅ 63 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
... +6 more
notes text no ✅ 71 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
src/app/api/v1/stock-purchases/[id]/pdf/route.ts
... +4 more
supplier relation yes ✅ 171 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
... +8 more
status select yes ✅ 248 src/app/(app)/collection-confirm/page.test.tsx
src/app/(app)/collection-confirm/page.tsx
src/app/(app)/stock-orders/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock-orders/[id]/page.tsx
... +11 more

suppliers (base)

field type required refs used where
geoPoint geoPoint no ✅ 13 src/app/api/v1/suppliers/route.ts
src/app/api/mcp/route.ts
src/lib/server/management-service.ts
scripts/setup-pocketbase.ts
scripts/smoke/management-flow.ts
closingtime text no ✅ 19 src/app/api/v1/suppliers/route.ts
src/app/api/v1/suppliers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/supplier-form.tsx
src/lib/pb-helpers.ts
... +3 more
supplieraddress text no ✅ 27 src/app/(app)/suppliers/page.tsx
src/app/api/v1/suppliers/route.ts
src/app/api/v1/suppliers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/supplier-map.tsx
... +5 more
suppliernumber text no ✅ 33 src/app/(app)/suppliers/page.tsx
src/app/api/v1/suppliers/route.ts
src/app/api/v1/suppliers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/supplier-map.tsx
... +5 more
supply_tags text no ✅ 34 src/app/(app)/suppliers/page.tsx
src/app/api/v1/suppliers/route.ts
src/app/api/v1/suppliers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/supplier-map.tsx
... +5 more
suppliername text no ✅ 87 src/app/(app)/suppliers/page.tsx
src/app/(app)/quotes/[id]/process/page.tsx
src/app/(app)/collection-map/page.tsx
src/app/(app)/stock-orders/new/page.tsx
src/app/(app)/stock/page.tsx
... +19 more
coordinates text no ✅ 96 src/app/(app)/collection-map/page.tsx
src/app/api/v1/suppliers/route.ts
src/app/api/v1/suppliers/[id]/route.ts
src/app/api/mcp/route.ts
src/components/supplier-map.tsx
... +5 more

users (auth)

field type required refs used where
accont_status bool no ❌ unused —
avatar file no ❌ unused —
permissions select no ❌ unused —
user_type select no ❌ unused —
name text no ✅ 309 src/app/api/v1/users/lookup/route.ts
src/components/auth-provider.tsx
src/components/ui/user-search.tsx
src/lib/server/management-service.ts
scripts/setup-pocketbase.ts
... +7 more

Unused fields only (candidates for removal)

collection field type required
driver_locations accuracy number no
driver_locations geoPoint geoPoint no
driver_locations heading number no
driver_locations latitude number no
driver_locations longitude number no
driver_locations relation relation no
driver_locations speed number no
driver_locations timestamp date no
dupicate_custmers customer text no
dupicate_custmers total_count number no
masterdrilling_consignment category select no
masterdrilling_consignment cost_price text no
masterdrilling_consignment description text no
masterdrilling_consignment markup text no
masterdrilling_consignment product_code number no
masterdrilling_consignment product_code_descrip text no
masterdrilling_consignment selling_price text no
masterdrilling_consignment supplier relation no
order_items delivered_at date no
order_items delivery_status select no
order_items drv_assigned_at date no
order_items invoice_status select no
order_items qb_invoice_pdf_ text no
order_items qty_assigned number no
order_items qty_delivered number no
order_items qty_processed number no
orders order_attachements file no
pos brand text no
pos category text no
pos cost_price number no
pos description text no
pos markup number no
pos search_text text no
pos selling_price number no
pos sku text no
pos sku_normalised text no
pos source_file text no
pos source_file_id relation no
pos specifications json no
pos stock_qty number no
pos subcategory text no
pos supplier text no
pos unit text no
price_list source_file_id relation no
price_list stock_qty number no
users accont_status bool no
users avatar file no
users permissions select no
users user_type select no

Single-reference fields (likely legacy / dead-code)

collection field type file
order_items legacy_order_item_id text scripts/migrations/2026-07-20-delivery-tracking.ts

Dead collections (never referenced anywhere in the app)

These collections exist in PB but no app file touches them. Every non-system field on them is unused. Safe to inspect for deletion once you confirm the data is not needed by anything external (n8n flows, MCP, manual admin, etc).

  • driver_locations (base, 8 user fields)
  • masterdrilling_consignment (base, 8 user fields)
  • pos (base, 16 user fields)