app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

0008_orders_and_pack_day.sql (573B)


      1 CREATE TABLE order_lines (
      2     id TEXT PRIMARY KEY NOT NULL,
      3     order_id TEXT NOT NULL REFERENCES orders(id) ON DELETE CASCADE,
      4     title TEXT NOT NULL,
      5     quantity_value INTEGER NOT NULL CHECK (quantity_value >= 0),
      6     quantity_unit_label TEXT NOT NULL DEFAULT '',
      7     quantity_display TEXT NOT NULL,
      8     sort_index INTEGER NOT NULL DEFAULT 0
      9 );
     10 
     11 CREATE INDEX idx_order_lines_order_sort
     12     ON order_lines(order_id, sort_index, id);
     13 
     14 CREATE INDEX idx_orders_farm_window_status_updated_at
     15     ON orders(farm_id, fulfillment_window_id, status, updated_at DESC, id DESC);