Skip to main content

Restaurant Module — QA Test Data Reset

Use these SQL commands to clear restaurant data in the local dev database before a test run.

DB connection: postgresql://localhost:5435 (local dev)


Option A — Clear orders and kitchen activity only

Keeps your stations, dining areas, tables, and devices intact. Use this between test runs.

TRUNCATE TABLE
kitchen_ticket,
kds_device,
print_job,
order_bill_payment,
order_bill_mapping,
order_bill,
order_payment,
order_item,
"order",
restaurant_shift_drop,
restaurant_shift
CASCADE;

Clears everything in Option A plus document print jobs, reservations, and waitlist entries — all transactional data. Keeps station/area/table configuration intact.

TRUNCATE TABLE
document_print_job,
kitchen_ticket,
kds_device,
print_job,
order_bill_payment,
order_bill_mapping,
order_bill,
order_payment,
order_item,
"order",
restaurant_shift_drop,
restaurant_shift,
reservation,
waitlist_entry
CASCADE;

Option B — Full restaurant reset

Wipes everything including stations, tables, areas, devices, reservations, and price rules. Use this for a clean-slate setup.

TRUNCATE TABLE
kitchen_ticket,
kds_device,
print_job,
order_bill_payment,
order_bill_mapping,
order_bill,
order_payment,
order_item,
"order",
restaurant_shift_drop,
restaurant_shift,
product_station_assignment,
price_rule,
reservation,
waitlist_entry,
dining_table,
dining_area,
kitchen_station
CASCADE;

Also clear Redis pairing codes

After deregistering KDS devices, clear any active pairing codes from Redis:

redis-cli -p 6379 KEYS "kds:pair:station:*" | xargs redis-cli -p 6379 DEL

Table reference

TableWhat it holds
dining_areaFloor plan areas (e.g. "Main Hall", "Terrace")
dining_tableIndividual tables within an area
kitchen_stationKDS / printer stations
product_station_assignmentWhich products route to which station
kds_deviceRegistered KDS tablets
price_ruleTime/day-based price rules
reservationTable reservations
waitlist_entryWalk-in waitlist entries
orderRestaurant orders
order_itemLine items on an order
order_billBills generated from an order (split or full)
order_bill_mappingWhich items belong to which bill
order_bill_paymentPayments recorded against a bill
order_paymentOrder-level payments (legacy)
document_print_jobPrint jobs for order bill receipts (PDF delivery)
print_jobPrinter jobs for kitchen tickets
kitchen_ticketKDS ticket lifecycle per station
restaurant_shiftOpen/closed kitchen shifts
restaurant_shift_dropCash drops recorded during a shift

KDS pairing flow (for reference)

  1. Admin opens Kitchen Stations (/forms/restaurantKitchenStations)
  2. Click "Pair KDS device" on the target station → a 6-digit code appears with a countdown
  3. On the KDS screen (/forms/restaurantKds), enter the 6-digit code
  4. The device registers and connects to that station

To re-pair after a reset: delete the device row from kds_device (or use Option B above), then repeat the pairing flow.