PortlinePortlineDocs

Data model

The tables behind Portline and who can read and write each one.

All tables live in the public schema with a pl_ prefix, and every row carries a workspace_id. Row-level security goes through two helpers: pl.role_in(workspace) returns your role, and pl.can(workspace, area, level) answers "may this user do this here", checking membership, plan features and subscription status.

"View", "edit" and "approve" below mean the level in that table's area. "+ fleet" means the plan must include that feature too.

Workspace and people

TableHoldsReadWrite
pl_workspacesName, slug, timezoneMembersOwner (name and timezone only)
pl_subscriptionsPlan, status, seats, period endMembersService role only
pl_membersRole, display name, title, emailMembersOwner and admin, guarded by a trigger
pl_notificationsTitle, body, link, read timeYour ownread_at only
pl_auditWho did what, whenApproveInsert as yourself only; never updated

Shipments and containers

TableHoldsReadWrite
pl_customersCustomer name and countryViewEdit
pl_portsUN/LOCODE, name, country, positionEveryone signed inService role
pl_shipmentsCode, customer, route, mode, status, cargo, weight, container, driver, incoterm, ETD/ETAViewEdit
pl_shipment_stopsRoute checkpoints in order, planned and actual timesViewEdit
pl_shipment_eventsThe "latest updates" timelineViewEdit
pl_documentsBill of lading, customs declaration, invoices, with review statusViewEdit to upload; approve to review
pl_containersISO 6346 number, type, reefer set point, status, positionViewEdit
pl_telemetryReefer temperature readingsView + telemetryService role (sensor feed)

Fleet, warehouses and docks

TableHoldsReadWrite
pl_assetsTrucks, vessels, drones with status and positionView + fleetEdit
pl_driversName, phone, carrier, truck, trailer, plateView + fleetEdit
pl_warehousesSite, city, capacity and used m²View + warehousesEdit
pl_zonesZones per site with utilisationView + warehousesEdit
pl_stockSKU, product, location, on hand, reorder point, ETAView + warehousesEdit
pl_dock_doorsDoors per warehouse and their typeView + docksApprove
pl_dock_appointmentsTruck, carrier, direction, times, status, check-in and check-outView + docksEdit; check-out needs check-in

Messages

TableHoldsReadWrite
pl_threadsSubject, linked shipment or driverViewEdit
pl_messagesAuthor, body, timeViewEdit, authored as yourself
pl_thread_readsWhere each member last read a threadYour ownYour own

Plan features

pl.plan_features mirrors the plan catalogue in @portline/pricing, so the database and the app agree on which plan includes which feature.

Demo ids

The demo generator creates UUID-shaped ids from stable keys. The local seed uses the same generator, so a shipment has the same id and code in demo mode and in local mode.

On this page