|
@@ -0,0 +1,1279 @@
|
|
|
|
+--
|
|
|
|
+-- PostgreSQL database dump
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+-- Dumped from database version 11.13 (Raspbian 11.13-0+deb10u1)
|
|
|
|
+-- Dumped by pg_dump version 11.13 (Debian 11.13-0+deb10u1)
|
|
|
|
+
|
|
|
|
+-- Started on 2021-12-06 18:15:54 NZDT
|
|
|
|
+
|
|
|
|
+SET statement_timeout = 0;
|
|
|
|
+SET lock_timeout = 0;
|
|
|
|
+SET idle_in_transaction_session_timeout = 0;
|
|
|
|
+SET client_encoding = 'UTF8';
|
|
|
|
+SET standard_conforming_strings = on;
|
|
|
|
+SELECT pg_catalog.set_config('search_path', '', false);
|
|
|
|
+SET check_function_bodies = false;
|
|
|
|
+SET xmloption = content;
|
|
|
|
+SET client_min_messages = warning;
|
|
|
|
+SET row_security = off;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 218 (class 1255 OID 16574)
|
|
|
|
+-- Name: insert_category(text, text); Type: PROCEDURE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE PROCEDURE public.insert_category(p_name text, "group" text)
|
|
|
|
+ LANGUAGE sql
|
|
|
|
+ AS $$
|
|
|
|
+INSERT INTO groups(name) VALUES (CASE WHEN "group" IS NULL THEN (SELECT g.name FROM categories AS c JOIN groups AS g ON (group_id = g.id) WHERE c.name = p_name) ELSE "group" END) ON CONFLICT DO NOTHING;
|
|
|
|
+INSERT INTO categories(name, group_id) VALUES(p_name, CASE WHEN "group" IS NULL THEN (SELECT group_id FROM categories WHERE name = p_name) ELSE (SELECT id FROM groups WHERE name = "group") END) ON CONFLICT DO NOTHING;
|
|
|
|
+$$;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER PROCEDURE public.insert_category(p_name text, "group" text) OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 220 (class 1255 OID 16575)
|
|
|
|
+-- Name: insert_product(text, text, text); Type: PROCEDURE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE PROCEDURE public.insert_product(name text, category text, "group" text DEFAULT NULL::text)
|
|
|
|
+ LANGUAGE sql
|
|
|
|
+ AS $$
|
|
|
|
+CALL insert_category(category, "group");
|
|
|
|
+INSERT INTO products(name, category_id) VALUES(name, (SELECT id FROM categories WHERE name = category)) ON CONFLICT DO NOTHING;
|
|
|
|
+$$;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER PROCEDURE public.insert_product(name text, category text, "group" text) OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 219 (class 1255 OID 16755)
|
|
|
|
+-- Name: insert_store(text, text); Type: PROCEDURE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE PROCEDURE public.insert_store(p_name text, p_code text)
|
|
|
|
+ LANGUAGE sql
|
|
|
|
+ AS $$INSERT INTO stores(name, code) VALUES (p_name, p_code);$$;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER PROCEDURE public.insert_store(p_name text, p_code text) OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 233 (class 1255 OID 16576)
|
|
|
|
+-- Name: insert_transaction(timestamp with time zone, text, text, numeric, text, numeric, text, boolean); Type: PROCEDURE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE PROCEDURE public.insert_transaction(ts timestamp with time zone, store text, description text, quantity numeric, unit text, price numeric, product text, organic boolean DEFAULT false)
|
|
|
|
+ LANGUAGE sql
|
|
|
|
+ AS $$
|
|
|
|
+INSERT INTO transactions (ts, store_id, description, quantity, unit_id, price, product_id, organic) VALUES (ts at time zone 'utc', (SELECT id FROM stores WHERE name = store), description, quantity, (SELECT id FROM units WHERE name = unit), price, (SELECT id FROM products WHERE name = product), organic);
|
|
|
|
+$$;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER PROCEDURE public.insert_transaction(ts timestamp with time zone, store text, description text, quantity numeric, unit text, price numeric, product text, organic boolean) OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 234 (class 1255 OID 16577)
|
|
|
|
+-- Name: transaction_price_per_unit(text); Type: FUNCTION; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE FUNCTION public.transaction_price_per_unit(p_unit text) RETURNS TABLE(ts timestamp without time zone, store text, description text, price_per_unit numeric, unit text, product text, category text, "group" text, organic boolean)
|
|
|
|
+ LANGUAGE sql
|
|
|
|
+ AS $$
|
|
|
|
+SELECT ts, store, description, min(CASE WHEN p_unit = "to" AND "from" = unit THEN price /(quantity*factor) WHEN p_unit = "from" AND "to" = unit THEN price*factor/quantity WHEN p_unit = unit THEN price/quantity ELSE NULL END) AS price_per_unit, p_unit AS unit, product, category, "group", organic FROM transaction_view JOIN conversion_view ON ("from" = unit OR "to" = unit) WHERE "to" = p_unit OR "from" = p_unit GROUP BY ts, description, product, category, "group", store, organic;
|
|
|
|
+$$;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER FUNCTION public.transaction_price_per_unit(p_unit text) OWNER TO das;
|
|
|
|
+
|
|
|
|
+SET default_tablespace = '';
|
|
|
|
+
|
|
|
|
+SET default_with_oids = false;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 196 (class 1259 OID 16578)
|
|
|
|
+-- Name: categories; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.categories (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ name text NOT NULL,
|
|
|
|
+ group_id integer NOT NULL
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.categories OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 197 (class 1259 OID 16584)
|
|
|
|
+-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE SEQUENCE public.categories_id_seq
|
|
|
|
+ AS integer
|
|
|
|
+ START WITH 1
|
|
|
|
+ INCREMENT BY 1
|
|
|
|
+ NO MINVALUE
|
|
|
|
+ NO MAXVALUE
|
|
|
|
+ CACHE 1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.categories_id_seq OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3042 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 197
|
|
|
|
+-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 198 (class 1259 OID 16586)
|
|
|
|
+-- Name: conversions; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.conversions (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ _from integer NOT NULL,
|
|
|
|
+ _to integer NOT NULL,
|
|
|
|
+ factor numeric NOT NULL,
|
|
|
|
+ CONSTRAINT conversions_check CHECK ((id = (_from * _to)))
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.conversions OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 199 (class 1259 OID 16593)
|
|
|
|
+-- Name: units; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.units (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ name text NOT NULL
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.units OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 200 (class 1259 OID 16599)
|
|
|
|
+-- Name: conversion_view; Type: VIEW; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE VIEW public.conversion_view AS
|
|
|
|
+ SELECT conversions.factor,
|
|
|
|
+ l.name AS "from",
|
|
|
|
+ r.name AS "to"
|
|
|
|
+ FROM ((public.conversions
|
|
|
|
+ JOIN public.units l ON ((conversions._from = l.id)))
|
|
|
|
+ JOIN public.units r ON ((conversions._to = r.id)));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.conversion_view OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 201 (class 1259 OID 16603)
|
|
|
|
+-- Name: conversions_complex; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.conversions_complex (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ _from integer NOT NULL,
|
|
|
|
+ _to integer NOT NULL,
|
|
|
|
+ product_id integer NOT NULL,
|
|
|
|
+ factor numeric NOT NULL
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.conversions_complex OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 202 (class 1259 OID 16609)
|
|
|
|
+-- Name: conversions_complex_id_seq; Type: SEQUENCE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE SEQUENCE public.conversions_complex_id_seq
|
|
|
|
+ AS integer
|
|
|
|
+ START WITH 1
|
|
|
|
+ INCREMENT BY 1
|
|
|
|
+ NO MINVALUE
|
|
|
|
+ NO MAXVALUE
|
|
|
|
+ CACHE 1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.conversions_complex_id_seq OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3043 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 202
|
|
|
|
+-- Name: conversions_complex_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER SEQUENCE public.conversions_complex_id_seq OWNED BY public.conversions_complex.id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 203 (class 1259 OID 16611)
|
|
|
|
+-- Name: groups; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.groups (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ name text NOT NULL
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.groups OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 204 (class 1259 OID 16617)
|
|
|
|
+-- Name: groups_id_seq; Type: SEQUENCE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE SEQUENCE public.groups_id_seq
|
|
|
|
+ AS integer
|
|
|
|
+ START WITH 1
|
|
|
|
+ INCREMENT BY 1
|
|
|
|
+ NO MINVALUE
|
|
|
|
+ NO MAXVALUE
|
|
|
|
+ CACHE 1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.groups_id_seq OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3044 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 204
|
|
|
|
+-- Name: groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER SEQUENCE public.groups_id_seq OWNED BY public.groups.id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 205 (class 1259 OID 16619)
|
|
|
|
+-- Name: products; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.products (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ name text NOT NULL,
|
|
|
|
+ category_id integer NOT NULL
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.products OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 206 (class 1259 OID 16625)
|
|
|
|
+-- Name: stores; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.stores (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ name text NOT NULL,
|
|
|
|
+ code character varying(5) NOT NULL
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.stores OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 207 (class 1259 OID 16631)
|
|
|
|
+-- Name: transactions; Type: TABLE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE TABLE public.transactions (
|
|
|
|
+ id integer NOT NULL,
|
|
|
|
+ ts timestamp without time zone DEFAULT now() NOT NULL,
|
|
|
|
+ description text NOT NULL,
|
|
|
|
+ organic boolean DEFAULT false NOT NULL,
|
|
|
|
+ quantity numeric NOT NULL,
|
|
|
|
+ price numeric NOT NULL,
|
|
|
|
+ unit_id integer NOT NULL,
|
|
|
|
+ product_id integer NOT NULL,
|
|
|
|
+ store_id integer NOT NULL
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.transactions OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 208 (class 1259 OID 16639)
|
|
|
|
+-- Name: transaction_view; Type: VIEW; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE VIEW public.transaction_view AS
|
|
|
|
+ SELECT (( SELECT timezone('utc'::text, t.ts) AS timezone))::timestamp without time zone AS ts,
|
|
|
|
+ s.name AS store,
|
|
|
|
+ t.description,
|
|
|
|
+ t.quantity,
|
|
|
|
+ u.name AS unit,
|
|
|
|
+ t.price,
|
|
|
|
+ p.name AS product,
|
|
|
|
+ c.name AS category,
|
|
|
|
+ g.name AS "group",
|
|
|
|
+ t.organic,
|
|
|
|
+ s.code
|
|
|
|
+ FROM (((((public.transactions t
|
|
|
|
+ JOIN public.stores s ON ((t.store_id = s.id)))
|
|
|
|
+ JOIN public.units u ON ((t.unit_id = u.id)))
|
|
|
|
+ JOIN public.products p ON ((t.product_id = p.id)))
|
|
|
|
+ JOIN public.categories c ON ((p.category_id = c.id)))
|
|
|
|
+ JOIN public.groups g ON ((c.group_id = g.id)));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.transaction_view OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 209 (class 1259 OID 16644)
|
|
|
|
+-- Name: legacy_transaction_view; Type: VIEW; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE VIEW public.legacy_transaction_view AS
|
|
|
|
+ SELECT (transaction_view.ts)::date AS ts,
|
|
|
|
+ transaction_view.store,
|
|
|
|
+ transaction_view.description,
|
|
|
|
+ transaction_view."group",
|
|
|
|
+ transaction_view.category,
|
|
|
|
+ CASE
|
|
|
|
+ WHEN transaction_view.organic THEN 'Org'::text
|
|
|
|
+ ELSE ''::text
|
|
|
|
+ END AS note,
|
|
|
|
+ trunc(min(
|
|
|
|
+ CASE
|
|
|
|
+ WHEN ((conversion_view."to" = ANY (ARRAY['kg'::text, 'L'::text])) AND (conversion_view."from" = transaction_view.unit)) THEN (transaction_view.quantity * conversion_view.factor)
|
|
|
|
+ WHEN ((conversion_view."from" = ANY (ARRAY['kg'::text, 'L'::text])) AND (conversion_view."to" = transaction_view.unit)) THEN (transaction_view.quantity / conversion_view.factor)
|
|
|
|
+ WHEN (transaction_view.unit = ANY (ARRAY['kg'::text, 'L'::text])) THEN transaction_view.quantity
|
|
|
|
+ WHEN (transaction_view.unit <> ALL (ARRAY['mL'::text, 'L'::text, 'g'::text, 'kg'::text])) THEN transaction_view.quantity
|
|
|
|
+ ELSE NULL::numeric
|
|
|
|
+ END), 3) AS quantity,
|
|
|
|
+ CASE
|
|
|
|
+ WHEN (transaction_view.unit = ANY (ARRAY['mL'::text, 'L'::text])) THEN 'L'::text
|
|
|
|
+ WHEN (transaction_view.unit = ANY (ARRAY['g'::text, 'kg'::text])) THEN 'kg'::text
|
|
|
|
+ ELSE transaction_view.unit
|
|
|
|
+ END AS unit,
|
|
|
|
+ trunc(transaction_view.price, 2) AS price,
|
|
|
|
+ transaction_view.product
|
|
|
|
+ FROM (public.transaction_view
|
|
|
|
+ LEFT JOIN public.conversion_view ON (((transaction_view.unit = conversion_view."from") OR (transaction_view.unit = conversion_view."to"))))
|
|
|
|
+ GROUP BY transaction_view.ts, transaction_view.store, transaction_view.description, transaction_view."group", transaction_view.category, transaction_view.price, transaction_view.product, transaction_view.organic, transaction_view.unit
|
|
|
|
+ ORDER BY transaction_view.ts, transaction_view.store, transaction_view.description, transaction_view."group", transaction_view.category, transaction_view.price, transaction_view.product, transaction_view.organic, transaction_view.unit;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.legacy_transaction_view OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 210 (class 1259 OID 16649)
|
|
|
|
+-- Name: legacy_transaction_with_period_view; Type: VIEW; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE VIEW public.legacy_transaction_with_period_view AS
|
|
|
|
+ SELECT (((((transaction_view.ts)::date - ((date_part('year'::text, transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) + 1) AS period,
|
|
|
|
+ (((((transaction_view.ts)::date - ((date_part('year'::text, transaction_view.ts) || '-04-01'::text))::date) / 7) % 4) + 1) AS period_week,
|
|
|
|
+ (transaction_view.ts)::date AS ts,
|
|
|
|
+ transaction_view.store,
|
|
|
|
+ transaction_view.description,
|
|
|
|
+ transaction_view.product,
|
|
|
|
+ transaction_view.category,
|
|
|
|
+ transaction_view."group",
|
|
|
|
+ CASE
|
|
|
|
+ WHEN transaction_view.organic THEN 'Org'::text
|
|
|
|
+ ELSE ''::text
|
|
|
|
+ END AS note,
|
|
|
|
+ trunc(min(
|
|
|
|
+ CASE
|
|
|
|
+ WHEN ((conversion_view."to" = ANY (ARRAY['kg'::text, 'L'::text])) AND (conversion_view."from" = transaction_view.unit)) THEN (transaction_view.quantity * conversion_view.factor)
|
|
|
|
+ WHEN ((conversion_view."from" = ANY (ARRAY['kg'::text, 'L'::text])) AND (conversion_view."to" = transaction_view.unit)) THEN (transaction_view.quantity / conversion_view.factor)
|
|
|
|
+ WHEN (transaction_view.unit = ANY (ARRAY['kg'::text, 'L'::text])) THEN transaction_view.quantity
|
|
|
|
+ WHEN (transaction_view.unit <> ALL (ARRAY['mL'::text, 'L'::text, 'g'::text, 'kg'::text])) THEN transaction_view.quantity
|
|
|
|
+ ELSE NULL::numeric
|
|
|
|
+ END), 3) AS quantity,
|
|
|
|
+ CASE
|
|
|
|
+ WHEN (transaction_view.unit = ANY (ARRAY['mL'::text, 'L'::text])) THEN 'L'::text
|
|
|
|
+ WHEN (transaction_view.unit = ANY (ARRAY['g'::text, 'kg'::text])) THEN 'kg'::text
|
|
|
|
+ ELSE transaction_view.unit
|
|
|
|
+ END AS unit,
|
|
|
|
+ trunc(transaction_view.price, 2) AS price,
|
|
|
|
+ sum(transaction_view.price) OVER (PARTITION BY (((((transaction_view.ts)::date - ((date_part('year'::text, transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) + 1) ORDER BY transaction_view.ts, transaction_view.description ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total
|
|
|
|
+ FROM (public.transaction_view
|
|
|
|
+ LEFT JOIN public.conversion_view ON (((transaction_view.unit = conversion_view."from") OR (transaction_view.unit = conversion_view."to"))))
|
|
|
|
+ GROUP BY (((((transaction_view.ts)::date - ((date_part('year'::text, transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) + 1), transaction_view.ts, transaction_view.store, transaction_view.description, transaction_view."group", transaction_view.category, transaction_view.price, transaction_view.product, transaction_view.organic, transaction_view.unit
|
|
|
|
+ ORDER BY (((((transaction_view.ts)::date - ((date_part('year'::text, transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) + 1), transaction_view.ts, transaction_view.store, transaction_view.description, transaction_view."group", transaction_view.category, transaction_view.price, transaction_view.product, transaction_view.organic, transaction_view.unit;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.legacy_transaction_with_period_view OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 211 (class 1259 OID 16654)
|
|
|
|
+-- Name: legacy_transaction_with_period_and_mode_view; Type: VIEW; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE VIEW public.legacy_transaction_with_period_and_mode_view AS
|
|
|
|
+ SELECT subq.mode,
|
|
|
|
+ legacy_transaction_with_period_view.period,
|
|
|
|
+ legacy_transaction_with_period_view.period_week,
|
|
|
|
+ legacy_transaction_with_period_view.ts,
|
|
|
|
+ legacy_transaction_with_period_view.store,
|
|
|
|
+ legacy_transaction_with_period_view.description,
|
|
|
|
+ legacy_transaction_with_period_view.product,
|
|
|
|
+ legacy_transaction_with_period_view.category,
|
|
|
|
+ legacy_transaction_with_period_view."group",
|
|
|
|
+ legacy_transaction_with_period_view.note,
|
|
|
|
+ legacy_transaction_with_period_view.quantity,
|
|
|
|
+ legacy_transaction_with_period_view.unit,
|
|
|
|
+ legacy_transaction_with_period_view.price,
|
|
|
|
+ legacy_transaction_with_period_view.running_total
|
|
|
|
+ FROM (public.legacy_transaction_with_period_view
|
|
|
|
+ JOIN ( SELECT legacy_transaction_with_period_view_1.period,
|
|
|
|
+ mode() WITHIN GROUP (ORDER BY (to_char((legacy_transaction_with_period_view_1.ts)::timestamp with time zone, 'month'::text))) AS mode
|
|
|
|
+ FROM public.legacy_transaction_with_period_view legacy_transaction_with_period_view_1
|
|
|
|
+ GROUP BY legacy_transaction_with_period_view_1.period) subq USING (period));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.legacy_transaction_with_period_and_mode_view OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 212 (class 1259 OID 16659)
|
|
|
|
+-- Name: product_group_view; Type: VIEW; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE VIEW public.product_group_view AS
|
|
|
|
+ SELECT g.name AS "group",
|
|
|
|
+ c.name AS category,
|
|
|
|
+ p.name AS product
|
|
|
|
+ FROM ((public.products p
|
|
|
|
+ JOIN public.categories c ON ((p.category_id = c.id)))
|
|
|
|
+ JOIN public.groups g ON ((c.group_id = g.id)))
|
|
|
|
+ ORDER BY g.name, c.name, p.name;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.product_group_view OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 213 (class 1259 OID 16663)
|
|
|
|
+-- Name: products_id_seq; Type: SEQUENCE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE SEQUENCE public.products_id_seq
|
|
|
|
+ AS integer
|
|
|
|
+ START WITH 1
|
|
|
|
+ INCREMENT BY 1
|
|
|
|
+ NO MINVALUE
|
|
|
|
+ NO MAXVALUE
|
|
|
|
+ CACHE 1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.products_id_seq OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3045 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 213
|
|
|
|
+-- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER SEQUENCE public.products_id_seq OWNED BY public.products.id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 214 (class 1259 OID 16665)
|
|
|
|
+-- Name: stores_id_seq; Type: SEQUENCE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE SEQUENCE public.stores_id_seq
|
|
|
|
+ AS integer
|
|
|
|
+ START WITH 1
|
|
|
|
+ INCREMENT BY 1
|
|
|
|
+ NO MINVALUE
|
|
|
|
+ NO MAXVALUE
|
|
|
|
+ CACHE 1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.stores_id_seq OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3046 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 214
|
|
|
|
+-- Name: stores_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER SEQUENCE public.stores_id_seq OWNED BY public.stores.id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 215 (class 1259 OID 16667)
|
|
|
|
+-- Name: transaction_rollup_view; Type: VIEW; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE VIEW public.transaction_rollup_view AS
|
|
|
|
+ SELECT ((((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) + 1) AS period,
|
|
|
|
+ ((((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) % 4) + 1) AS week,
|
|
|
|
+ (((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date + ((((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) * 28)) AS period_start,
|
|
|
|
+ ((((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date + ((((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) * 28)) + 27) AS period_end,
|
|
|
|
+ legacy_transaction_view."group",
|
|
|
|
+ sum(legacy_transaction_view.price) AS sum
|
|
|
|
+ FROM public.legacy_transaction_view
|
|
|
|
+ GROUP BY (((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) / 4), (((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) % 4), (((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date + ((((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) * 28)), legacy_transaction_view."group"
|
|
|
|
+ ORDER BY (((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date + ((((legacy_transaction_view.ts - ((date_part('year'::text, legacy_transaction_view.ts) || '-04-01'::text))::date) / 7) / 4) * 28)), legacy_transaction_view."group";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.transaction_rollup_view OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 216 (class 1259 OID 16672)
|
|
|
|
+-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE SEQUENCE public.transactions_id_seq
|
|
|
|
+ AS integer
|
|
|
|
+ START WITH 1
|
|
|
|
+ INCREMENT BY 1
|
|
|
|
+ NO MINVALUE
|
|
|
|
+ NO MAXVALUE
|
|
|
|
+ CACHE 1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.transactions_id_seq OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3047 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 216
|
|
|
|
+-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 217 (class 1259 OID 16674)
|
|
|
|
+-- Name: units_id_seq; Type: SEQUENCE; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+CREATE SEQUENCE public.units_id_seq
|
|
|
|
+ AS integer
|
|
|
|
+ START WITH 1
|
|
|
|
+ INCREMENT BY 1
|
|
|
|
+ NO MINVALUE
|
|
|
|
+ NO MAXVALUE
|
|
|
|
+ CACHE 1;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ALTER TABLE public.units_id_seq OWNER TO das;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3048 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 217
|
|
|
|
+-- Name: units_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER SEQUENCE public.units_id_seq OWNED BY public.units.id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2856 (class 2604 OID 16676)
|
|
|
|
+-- Name: categories id; Type: DEFAULT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.categories ALTER COLUMN id SET DEFAULT nextval('public.categories_id_seq'::regclass);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2859 (class 2604 OID 16677)
|
|
|
|
+-- Name: conversions_complex id; Type: DEFAULT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.conversions_complex ALTER COLUMN id SET DEFAULT nextval('public.conversions_complex_id_seq'::regclass);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2860 (class 2604 OID 16678)
|
|
|
|
+-- Name: groups id; Type: DEFAULT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.groups ALTER COLUMN id SET DEFAULT nextval('public.groups_id_seq'::regclass);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2861 (class 2604 OID 16679)
|
|
|
|
+-- Name: products id; Type: DEFAULT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.products ALTER COLUMN id SET DEFAULT nextval('public.products_id_seq'::regclass);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2862 (class 2604 OID 16680)
|
|
|
|
+-- Name: stores id; Type: DEFAULT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.stores ALTER COLUMN id SET DEFAULT nextval('public.stores_id_seq'::regclass);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2865 (class 2604 OID 16681)
|
|
|
|
+-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2858 (class 2604 OID 16682)
|
|
|
|
+-- Name: units id; Type: DEFAULT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.units ALTER COLUMN id SET DEFAULT nextval('public.units_id_seq'::regclass);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3022 (class 0 OID 16578)
|
|
|
|
+-- Dependencies: 196
|
|
|
|
+-- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.categories (id, name, group_id) FROM stdin;
|
|
|
|
+1 Aromatics 1
|
|
|
|
+2 Tubers 1
|
|
|
|
+4 Prepared 2
|
|
|
|
+5 Fruit 1
|
|
|
|
+6 Canned Goods 3
|
|
|
|
+7 Eggs 4
|
|
|
|
+8 Fish 4
|
|
|
|
+21 Misc 3
|
|
|
|
+25 Butter 26
|
|
|
|
+32 Veggies 1
|
|
|
|
+34 Coconut Milk 3
|
|
|
|
+35 Coffee 36
|
|
|
|
+36 Chocolate 37
|
|
|
|
+37 Beef 4
|
|
|
|
+315 Organic 144
|
|
|
|
+321 Ice Cream 37
|
|
|
|
+324 Chicken 4
|
|
|
|
+491 Milk 26
|
|
|
|
+498 Condiments 499
|
|
|
|
+143 Conventional 144
|
|
|
|
+144 Tea 36
|
|
|
|
+145 Cheese 26
|
|
|
|
+146 Flour 2
|
|
|
|
+147 Sugar 148
|
|
|
|
+546 Electrolytes 36
|
|
|
|
+548 Water 36
|
|
|
|
+549 Chips 2
|
|
|
|
+555 Supplemental 558
|
|
|
|
+556 Nuts 559
|
|
|
|
+557 Bulk 2
|
|
|
|
+559 Dried Fruit 559
|
|
|
|
+561 Seeds 559
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3024 (class 0 OID 16586)
|
|
|
|
+-- Dependencies: 198
|
|
|
|
+-- Data for Name: conversions; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.conversions (id, _from, _to, factor) FROM stdin;
|
|
|
|
+2 1 2 1000
|
|
|
|
+12 3 4 1000
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3026 (class 0 OID 16603)
|
|
|
|
+-- Dependencies: 201
|
|
|
|
+-- Data for Name: conversions_complex; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.conversions_complex (id, _from, _to, product_id, factor) FROM stdin;
|
|
|
|
+1 7 2 2 166
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3028 (class 0 OID 16611)
|
|
|
|
+-- Dependencies: 203
|
|
|
|
+-- Data for Name: groups; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.groups (id, name) FROM stdin;
|
|
|
|
+1 Produce
|
|
|
|
+2 Grains
|
|
|
|
+3 Staples
|
|
|
|
+4 Fish, Meat, Eggs
|
|
|
|
+13 bogus
|
|
|
|
+26 Dairy
|
|
|
|
+36 Drinks
|
|
|
|
+37 Treats
|
|
|
|
+144 Baking
|
|
|
|
+148 Fermenting
|
|
|
|
+149 Fish Meat Eggs
|
|
|
|
+499 Prepared
|
|
|
|
+558 Spices
|
|
|
|
+559 Dry Goods
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3030 (class 0 OID 16619)
|
|
|
|
+-- Dependencies: 205
|
|
|
|
+-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.products (id, name, category_id) FROM stdin;
|
|
|
|
+496 Saurkraut 498
|
|
|
|
+2 Onions 1
|
|
|
|
+3 Potatoes 2
|
|
|
|
+4 Crackers 4
|
|
|
|
+5 Bananas 5
|
|
|
|
+6 Tomato Paste 6
|
|
|
|
+7 Free Range Eggs 7
|
|
|
|
+8 Fish Fillets 8
|
|
|
|
+497 Parsnips 32
|
|
|
|
+19 Vinegar 21
|
|
|
|
+20 Apples 5
|
|
|
|
+21 Kumara 2
|
|
|
|
+22 Mushrooms 1
|
|
|
|
+23 Butter 25
|
|
|
|
+501 Canned Tomatoes 6
|
|
|
|
+502 Organic Cheese 145
|
|
|
|
+30 Squash 32
|
|
|
|
+31 Carrots 32
|
|
|
|
+32 Coconut Cream 34
|
|
|
|
+33 Coffee 35
|
|
|
|
+34 Whittakers Chocolate 36
|
|
|
|
+35 Beef Mince 37
|
|
|
|
+533 Fish Frames 8
|
|
|
|
+534 Organic Chicken 324
|
|
|
|
+141 Chocolate Chips 143
|
|
|
|
+142 Tulsi Tea 144
|
|
|
|
+143 Vintage Cheese 145
|
|
|
|
+144 Wholemeal Flour 146
|
|
|
|
+145 White Sugar 147
|
|
|
|
+148 Avocado 5
|
|
|
|
+312 Apple Cider Vinegar 21
|
|
|
|
+313 Vanilla 315
|
|
|
|
+314 Whole Fish 8
|
|
|
|
+315 Fish Heads 8
|
|
|
|
+317 Mango 5
|
|
|
|
+318 Beetroot 32
|
|
|
|
+319 Ice Cream 321
|
|
|
|
+320 Frozen Peas 32
|
|
|
|
+321 Tasty Cheese 145
|
|
|
|
+322 Whole Chicken 324
|
|
|
|
+489 Raw Milk 491
|
|
|
|
+490 Cream 491
|
|
|
|
+491 Bottle Fee 491
|
|
|
|
+535 Curry Paste 498
|
|
|
|
+536 Cucumber 32
|
|
|
|
+208 Butternut Squash 32
|
|
|
|
+149 Capsicum 32
|
|
|
|
+537 Ginger 1
|
|
|
|
+538 Chicken Drumsticks 324
|
|
|
|
+539 Garlic 1
|
|
|
|
+540 Jalapenos Canned 6
|
|
|
|
+541 Beef Chuck 37
|
|
|
|
+542 Blade Steak 37
|
|
|
|
+544 Coconut Water 546
|
|
|
|
+545 Chicken Thighs 324
|
|
|
|
+546 Water 548
|
|
|
|
+547 Corn Chips 549
|
|
|
|
+548 Canned Tuna 8
|
|
|
|
+549 FR Chicken Thighs 324
|
|
|
|
+551 Strawberries 5
|
|
|
|
+552 Cabbage 32
|
|
|
|
+553 Brewers Yeast 555
|
|
|
|
+554 Almonds 556
|
|
|
|
+555 Quinoa 557
|
|
|
|
+556 Nutritional Yeast 555
|
|
|
|
+557 Sultanas 559
|
|
|
|
+559 Hemp Seeds 561
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3031 (class 0 OID 16625)
|
|
|
|
+-- Dependencies: 206
|
|
|
|
+-- Data for Name: stores; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.stores (id, name, code) FROM stdin;
|
|
|
|
+1 Countdown CD
|
|
|
|
+3 Healthpost HP
|
|
|
|
+4 Bin Inn BI
|
|
|
|
+5 Dreamview DV
|
|
|
|
+6 Co-op CO
|
|
|
|
+9 Gordonton Farm Shop GFS
|
|
|
|
+11 TOFS TOFS
|
|
|
|
+12 Seafood Bazaar SB
|
|
|
|
+13 Whatawhata Berry Farm Farm
|
|
|
|
+2 PaknSave PnS
|
|
|
|
+14 Taupiri Dairy TD
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3032 (class 0 OID 16631)
|
|
|
|
+-- Dependencies: 207
|
|
|
|
+-- Data for Name: transactions; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.transactions (id, ts, description, organic, quantity, price, unit_id, product_id, store_id) FROM stdin;
|
|
|
|
+850 2021-06-21 00:00:00 Dreamview Raw Milk 1L f 2 6 3 489 5
|
|
|
|
+851 2021-06-28 00:00:00 Dreamview Raw Milk 1L f 2 6 3 489 5
|
|
|
|
+2 2021-06-17 04:41:00 Onions brown loose f 702 1.76 2 2 1
|
|
|
|
+3 2021-06-17 04:41:00 Potatoes washed loose f 2.117 6.33 1 3 1
|
|
|
|
+5 2021-06-17 04:41:00 Arnotts vita-weat cracked pepper f 250 3.5 2 4 1
|
|
|
|
+6 2021-06-17 04:41:00 Short date bananas on special f 2 3 6 5 1
|
|
|
|
+7 2021-06-17 04:41:00 Ceres Organics tomato paste t 1140 16.20 2 6 1
|
|
|
|
+852 2021-07-05 00:00:00 Dreamview Raw Milk 1L f 2 6 3 489 5
|
|
|
|
+853 2021-07-12 00:00:00 Dreamview Raw Milk 1L f 2 6 3 489 5
|
|
|
|
+12 2021-06-22 22:59:00 Pams White Vinegar 2L f 2 3.79 3 19 2
|
|
|
|
+13 2021-06-22 22:59:00 NZ Trevally Fillets f 590 14.04 2 8 2
|
|
|
|
+14 2021-06-22 22:59:00 Apples Pink Lady Large f 1.201 1.55 1 20 2
|
|
|
|
+15 2021-06-22 22:59:00 Kumara Orange f 851 2.54 2 21 2
|
|
|
|
+17 2021-06-22 22:59:00 Onions Brown loose f 196 0.29 2 2 2
|
|
|
|
+16 2021-06-22 22:59:00 Mushrooms white button f 157 1.73 2 22 2
|
|
|
|
+854 2021-07-19 00:00:00 Dreamview Raw Milk 1L f 2 6 3 489 5
|
|
|
|
+18 2021-06-22 22:59:00 Anchor butter 500g f 500 4.80 2 23 2
|
|
|
|
+855 2021-07-26 00:00:00 Dreamview Raw Milk 1L f 2 6 3 489 5
|
|
|
|
+856 2021-07-28 00:00:00 Dreamview Cream 500mL f 0.5 6 3 490 5
|
|
|
|
+857 2021-08-02 00:00:00 Dreamview Raw Milk 1L f 2 6 3 489 5
|
|
|
|
+864 2021-08-11 23:07:00 Local Spray Free Potatoes f 3 8 1 3 9
|
|
|
|
+865 2021-08-11 23:07:00 Local Spray Free Onions f 4 2 7 2 9
|
|
|
|
+866 2021-08-11 23:07:00 Good Bugs Ginger Ninja Kimchi f 500 16 2 496 9
|
|
|
|
+867 2021-08-11 23:07:00 Local Spray Free Parsnips f 460 3 2 497 9
|
|
|
|
+28 2021-06-22 23:31:00 Potato bag 2.5 kg Odd Bunch f 2.5 4 1 3 1
|
|
|
|
+29 2021-06-22 23:31:00 Pumpkin Butternut Whole Ea f 1 3 7 30 1
|
|
|
|
+30 2021-06-22 23:31:00 CD Eggs Sz7 6 pk Special x 2 f 744 5.3 2 7 1
|
|
|
|
+31 2021-06-22 23:31:00 Macro Organic Carrots 1 kg t 1 6 1 31 1
|
|
|
|
+32 2021-06-22 23:31:00 Essentials Coconut Cream 400 mL f 800 2.60 4 32 1
|
|
|
|
+33 2021-06-22 23:31:00 Essentials French Whole Bean 200g f 200 5 2 33 1
|
|
|
|
+34 2021-06-22 23:31:00 Arnotts Vita-weat Cracked Pepper 250g f 1 10 1 4 1
|
|
|
|
+35 2021-06-22 23:31:00 Whittakers Block Dark Ghana 250g f 250 4.7 2 34 1
|
|
|
|
+36 2021-06-22 23:31:00 Beef Value Mince 82% 1 kg f 1 10.90 1 35 1
|
|
|
|
+885 2021-08-12 01:33:00 Essentials Coconut Cream 400 mL f 1200 3.90 4 32 1
|
|
|
|
+533 2021-08-05 05:33:00 Ceres Organic Apple Cider Vinegar 750mL t 750 7.89 4 312 2
|
|
|
|
+534 2021-08-05 05:33:00 Coulston Hill Eggs Free Range Mixed 12pk x2 f 1164 10.98 2 7 2
|
|
|
|
+535 2021-08-05 05:33:00 Pams Flour Wholemeal 1.5 kg f 1.5 1.98 1 144 2
|
|
|
|
+536 2021-08-05 05:33:00 T/Colledge Vanilla Exract 100 mL FairTrade t 100 8.99 4 313 2
|
|
|
|
+537 2021-08-05 05:33:00 NZ Parore (Black Snapper) Whole f 1.076 9.46 1 314 2
|
|
|
|
+538 2021-08-05 05:33:00 NZ Snapper Heads f 0.652 4.56 1 315 2
|
|
|
|
+539 2021-08-05 05:33:00 Apples Cripps Pink Lady Medium f 1.136 1.12 1 20 2
|
|
|
|
+540 2021-08-05 05:33:00 Apples Fuji f 1.026 0.81 1 20 2
|
|
|
|
+541 2021-08-05 05:33:00 Bananas Conventional f 1.131 3.04 1 5 2
|
|
|
|
+542 2021-08-05 05:33:00 Beetroot Conventional f 0.276 0.96 1 318 2
|
|
|
|
+543 2021-08-05 05:33:00 Kumara Orange f 2.211 4.40 1 21 2
|
|
|
|
+544 2021-08-05 05:33:00 Mango Mexico Large f 1 1.89 7 317 2
|
|
|
|
+545 2021-08-05 05:33:00 Mushrooms White Button f 0.162 1.78 1 22 2
|
|
|
|
+228 2021-06-30 08:39:00 WW Chocolate Chips Dark 200g f 0.2 2.5 1 141 1
|
|
|
|
+229 2021-06-30 08:40:00 Mainland Cheese Vintage 500g f 0.5 10.5 1 143 1
|
|
|
|
+230 2021-06-30 08:41:00 Otaika Valley Size 7 12 pack f 744 7 2 7 1
|
|
|
|
+231 2021-06-30 08:40:00 Whittakers Blk Dark Almond 62% 250g f 250 4.70 2 34 1
|
|
|
|
+232 2021-06-30 23:20:00 Ceres Organic Tomato Paste 190g f 1140 14.94 2 6 2
|
|
|
|
+233 2021-06-30 23:20:00 Pams Flour Wholemeal 1.5 kg f 1.5 1.98 1 144 2
|
|
|
|
+234 2021-06-16 00:00:00 Tulsi Tumeric Ginger Tea f 25 0 7 142 3
|
|
|
|
+235 2021-06-16 00:00:00 Tulsi Orginal Loose Leaf Tea f 100 16.40 2 142 3
|
|
|
|
+236 2021-06-16 00:00:00 Tulsi Licorice Spice Tea f 25 9.50 7 142 3
|
|
|
|
+237 2021-06-30 23:20:00 Pams White Sugar 3 kg f 3 4.89 1 145 2
|
|
|
|
+238 2021-06-30 23:20:00 Hoki Fillets Fresh f 0.768 9.82 1 8 2
|
|
|
|
+239 2021-06-30 23:20:00 Apples Braeburn f 0.961 3.55 1 20 2
|
|
|
|
+240 2021-06-30 23:20:00 Avocado Small f 4 5 7 148 2
|
|
|
|
+241 2021-06-30 23:20:00 Capsicum Red NZ f 1 2.99 7 149 2
|
|
|
|
+242 2021-06-30 23:20:00 Carrots Loose f 1.261 2 1 149 2
|
|
|
|
+243 2021-06-30 23:20:00 Kumara Orange f 1.136 2.83 1 21 2
|
|
|
|
+244 2021-06-30 23:20:00 Mushrooms White Button Loose f 0.182 2 1 22 2
|
|
|
|
+245 2021-06-30 23:20:00 Onions Brown Loose f 0.786 1.01 1 2 2
|
|
|
|
+546 2021-08-05 05:33:00 Onions Brown f 0.901 1.16 1 2 2
|
|
|
|
+547 2021-08-05 05:33:00 Ben N Jerrys Choc Chip Cookie Dough Ice Cream 458mL f 458 5 4 319 2
|
|
|
|
+548 2021-08-05 05:33:00 Pams Frozen Peas, Garden 1kg f 1 2.69 1 320 2
|
|
|
|
+549 2021-08-05 05:33:00 Eclipse Cheese Tasty 1 kg f 1 11.99 1 321 2
|
|
|
|
+550 2021-08-05 05:33:00 Bird N Barrow Free Range Chicken Whole Short Date Special f 1.7 10.19 1 322 2
|
|
|
|
+551 2021-08-05 05:33:00 NZ Beef Mince Special f 0.865 8.65 1 35 2
|
|
|
|
+888 2021-08-12 01:33:00 Mainland Cheese Vintage 500g f 500 10.50 2 143 1
|
|
|
|
+1324 2021-11-29 20:45:00 Bananas Cavendish f 0.742 2.23 1 5 1
|
|
|
|
+886 2021-08-12 01:33:00 Macro Organic Tomatoes Diced NAS 400g t 2000 7.50 2 501 1
|
|
|
|
+262 2021-07-27 04:29:00 Onions Brown Loose f 0.762 1.52 1 2 1
|
|
|
|
+263 2021-07-27 04:29:00 Mushrooms Button Loose f 0.318 4.13 1 22 1
|
|
|
|
+264 2021-07-27 04:29:00 Heyden Farms Free Range Sz 7 18 pk f 1.116 10 1 7 1
|
|
|
|
+265 2021-07-27 04:29:00 Essentials Coconut Cream 400 mL f 1200 3.9 4 32 1
|
|
|
|
+266 2021-07-27 04:29:00 Whittakers Block Dark Almond 62% 250g f 250 4.3 2 34 1
|
|
|
|
+267 2021-07-27 04:29:00 Countdown Free Range Sz 6 6pk Short Date Sale x 2 f 636 5.84 2 7 1
|
|
|
|
+954 2021-08-19 01:56:00 Heyden Farms FR Organic Eggs Mixed Grade 10pk t 485 8.99 2 7 2
|
|
|
|
+357 2021-07-29 06:26:00 Mainland Cheese Vintage f 500 10.50 2 143 1
|
|
|
|
+358 2021-07-29 06:26:00 Whittakers Block Cocoa Dark 72% 250g f 750 12.90 2 34 1
|
|
|
|
+359 2021-07-29 06:26:00 Organic Jazz Apple 1 kg bag t 1 5.50 1 20 1
|
|
|
|
+360 2021-07-29 06:26:00 Pumpkin Butternut Whole Organic t 1 3.50 7 208 1
|
|
|
|
+955 2021-08-19 01:56:00 NZ Salmon Frames (t/p) x1 f 0.498 4.98 1 533 2
|
|
|
|
+956 2021-08-19 01:56:00 NZ Snapper Heads x2 f 0.430 3.01 1 315 2
|
|
|
|
+957 2021-08-19 01:56:00 Apples Cripps Pink Lady Medium f 1.736 1.72 1 20 2
|
|
|
|
+958 2021-08-19 01:56:00 Capsicum Yellow f 3 5 7 149 2
|
|
|
|
+959 2021-08-19 01:56:00 Carrots, Loose f 0.851 0.84 1 31 2
|
|
|
|
+960 2021-08-19 01:56:00 Mushrooms White Button f 0.192 2.40 1 22 2
|
|
|
|
+961 2021-08-19 01:56:00 Onions Brown f 0.556 0.55 1 2 2
|
|
|
|
+962 2021-08-19 01:56:00 Mainland Cheese Organic 500g t 500 10.39 2 502 2
|
|
|
|
+963 2021-08-19 01:56:00 NZ Organic Chicken Butterfly Bostocks Reduced t 1.19 12.48 1 534 2
|
|
|
|
+890 2021-08-12 01:33:00 CD Beef Mince 82% 1kg Price Reduced by $5.50 f 1 10.27 1 35 1
|
|
|
|
+891 2021-08-12 01:33:00 CD Free Range Eggs Size 8 6pk Reduced Price f 1632 10.84 2 7 1
|
|
|
|
+892 2021-08-12 01:33:00 Quick Sale Bananas Freetrade f 2 3 1 5 1
|
|
|
|
+966 2021-08-19 01:08:00 Bananas Cavendish f 0.922 2.58 1 5 1
|
|
|
|
+1325 2021-11-29 20:45:00 Mushrooms Button Loose f 0.223 2.90 1 22 1
|
|
|
|
+1326 2021-11-29 20:45:00 Garlic NZ f 0.047 1.17 1 539 1
|
|
|
|
+970 2021-08-19 01:08:00 Macro Organic Tomatoes Diced NAS 400g t 1600 6 2 501 1
|
|
|
|
+971 2021-08-19 01:08:00 Woodlands Free Range Size 6 10 pk f 530 4.90 2 7 1
|
|
|
|
+972 2021-08-19 01:08:00 Avocado Loose f 2 2.50 7 148 1
|
|
|
|
+887 2021-08-12 01:33:00 Macro Organic Fairtrade Medium Beans 200g f 200 6.50 2 33 1
|
|
|
|
+1054 2021-07-19 21:35:00 Onions Brown Loose f 0.577 1.44 1 2 1
|
|
|
|
+1055 2021-07-19 21:35:00 Apples 2kg Odd Bunch f 2 4.30 1 20 1
|
|
|
|
+1056 2021-07-19 21:35:00 Carrots, 1.5 kg Odd Bunch f 1.5 2 1 31 1
|
|
|
|
+1057 2021-07-19 21:35:00 Countdown Free Range Sz 7 6pk Reduced f 372 2.10 2 7 1
|
|
|
|
+1058 2021-07-19 21:35:00 Big Paddock Free Range Eggs Mixed 10pk f 485 5 2 7 1
|
|
|
|
+1059 2021-07-19 21:35:00 Macro Organic Tomatoes Diced NAS 400g t 1200 4.50 2 501 1
|
|
|
|
+1327 2021-11-29 20:45:00 Macro Free Range Chicken Thigh Fillet, Reduced f 0.49 6.49 1 549 1
|
|
|
|
+1328 2021-11-29 20:45:00 Macro Free Range Chicken Thigh Fillet, Reduced f 0.546 7.47 1 549 1
|
|
|
|
+1329 2021-11-29 20:45:00 Macro Free Range Chicken Thigh Fillet, Reduced f 0.474 6.36 1 549 1
|
|
|
|
+1330 2021-11-29 20:45:00 Essentials Coconut Cream 400 mL f 400 2.4 4 32 1
|
|
|
|
+1331 2021-11-29 20:45:00 Huntley & Palmers Rosemary Garlic Crackers f 200 3.40 2 4 1
|
|
|
|
+1332 2021-11-29 20:45:00 Anchor butter 500g f 500.00 5.8 2 23 1
|
|
|
|
+1333 2021-11-29 20:45:00 Mainland Cheese Organic 500g t 500 10.60 2 502 1
|
|
|
|
+1334 2021-11-29 20:45:00 Organic Potato t 2 6.99 1 3 1
|
|
|
|
+1074 2021-08-27 05:14:00 Apple Rose Medium f 0.257 1.16 1 20 1
|
|
|
|
+1075 2021-08-27 05:14:00 WW French Whole Beans 200g f 200.00 5 2 33 1
|
|
|
|
+1076 2021-08-27 05:14:00 Countdown Free Range Sz 7 6pk f 372.00 4.2 2 7 1
|
|
|
|
+1077 2021-08-27 05:14:00 Loose Avocado f 2 2.3 7 148 1
|
|
|
|
+1335 2021-11-29 20:45:00 Onion Odd Bunch bag 1.5 kg f 1.5 3.50 1 2 1
|
|
|
|
+1336 2021-11-29 20:45:00 Apples 2 kg Odd Bunch f 2 4.90 1 20 1
|
|
|
|
+1337 2021-11-29 20:45:00 Avocado Loose f 2 2.50 7 148 1
|
|
|
|
+1338 2021-11-29 20:45:00 Capsicum Odd Bunch 750g f 750 5 2 149 1
|
|
|
|
+1342 2021-11-22 23:00:00 Organic Beef Mince 90/10 t 0.4 11 1 35 11
|
|
|
|
+1343 2021-11-22 23:00:00 Organic Beef Blade Steak t 0.4 11 1 542 11
|
|
|
|
+1344 2021-11-22 23:00:00 Organic Beef Chuck t 0.40 11 1 541 11
|
|
|
|
+1254 2021-07-02 00:00:00 Organic Beef Mince 90/10 t 0.4 10 1 35 11
|
|
|
|
+1255 2021-07-02 00:00:00 Organic Beef Chuck t 0.4 10 1 541 11
|
|
|
|
+1256 2021-07-02 00:00:00 Organic Beef Blade Steak t 0.8 20 1 542 11
|
|
|
|
+1352 2021-11-15 23:00:00 Hoki Fillets Fresh f 0.548 10.38 1 8 12
|
|
|
|
+1353 2021-11-15 23:00:00 NZ Snapper Heads f 1.322 5.95 1 315 12
|
|
|
|
+1356 2021-11-10 23:00:00 Organic Beef Mince 90/10 t 0.4 11.40 1 35 11
|
|
|
|
+1357 2021-11-10 23:00:00 Organic Beef Chuck t 0.40 11.40 1 541 11
|
|
|
|
+1294 2021-11-23 00:42:00 Bananas Cavendish f 1.207 3.62 1 5 1
|
|
|
|
+1295 2021-11-23 00:42:00 Onions Brown Loose f 0.722 2.16 1 2 1
|
|
|
|
+1296 2021-11-23 00:42:00 Mushrooms Button Loose f 0.233 3.03 1 22 1
|
|
|
|
+1297 2021-11-23 00:42:00 Waitoa Free Range Chicken Thigh Fillet, Reduced f 0.532 8.78 1 549 1
|
|
|
|
+1298 2021-11-23 00:42:00 Waitoa Free Range Chicken Thigh Fillet, Reduced f 0.546 9.01 1 549 1
|
|
|
|
+1299 2021-11-23 00:42:00 Waitoa Free Range Chicken Thigh Fillet, Reduced f 0.542 8.94 1 549 1
|
|
|
|
+1110 2021-07-14 22:30:00 SweeTango loose apples f 1.442 7.93 1 20 1
|
|
|
|
+1111 2021-07-14 22:30:00 Onions Brown Loose f 0.317 0.48 1 2 1
|
|
|
|
+1112 2021-07-14 22:30:00 Otaika Valley Size 7 12 pack Reduced f 1488.00 13.60 2 7 1
|
|
|
|
+1113 2021-07-14 22:30:00 Exotic Food Panang Curry Paste f 200 3.95 2 535 1
|
|
|
|
+1114 2021-07-14 22:30:00 Essentials Coconut Cream 400 mL f 400 1.3 4 32 1
|
|
|
|
+1115 2021-07-14 22:30:00 Organic Potato t 2 6.99 1 3 1
|
|
|
|
+1116 2021-07-14 22:30:00 Arnotts Vita-weat Cracked Pepper 250g f 500.00 5 2 4 1
|
|
|
|
+1118 2021-08-25 23:34:00 Cucumber Green f 1 4.49 7 536 1
|
|
|
|
+969 2021-08-19 01:08:00 Whittakers Block Cocoa Dark 72% 250g f 750 12.90 2 34 1
|
|
|
|
+889 2021-08-12 01:33:00 Mainland Cheese Organic 500g t 1 21.00 1 502 1
|
|
|
|
+1347 2021-11-22 23:01:00 NZ Snapper Heads f 1.17 5.27 1 315 12
|
|
|
|
+1125 2021-07-20 00:18:00 NZ Hoki Fillets f 0.474 6.06 1 8 2
|
|
|
|
+1126 2021-07-20 00:18:00 Fresh Ginger f 0.251 3.76 1 537 2
|
|
|
|
+1127 2021-07-20 00:18:00 Mushrooms White Button Loose f 0.192 2.11 1 22 2
|
|
|
|
+1128 2021-07-20 00:18:00 Mainland Cheese Organic 500g t 500 10.39 2 502 2
|
|
|
|
+1362 2021-11-10 23:00:00 Snapper Frames f 0.684 3.08 1 533 12
|
|
|
|
+1363 2021-11-10 23:00:00 NZ Snapper Heads f 1 4.5 1 315 12
|
|
|
|
+1365 2021-11-04 23:00:00 Snapper Frames f 0.99 4.48 1 533 12
|
|
|
|
+1371 2021-10-30 23:00:00 Local Carrot Bunch f 1 2 6 31 9
|
|
|
|
+1372 2021-10-30 23:00:00 Local Spray Free Onions f 4 2 7 2 9
|
|
|
|
+1373 2021-10-30 23:00:00 Local Cabbage f 1 5 7 552 9
|
|
|
|
+1374 2021-10-30 23:00:00 Good Bugs Ginger Ninja Kimchi f 500.00 16.00 2 496 9
|
|
|
|
+1375 2021-10-30 23:00:00 Local Avocado f 1 1.5 7 148 9
|
|
|
|
+1379 2021-08-05 00:00:00 Organic Beef Mince 90/10 t 0.4 11 1 35 11
|
|
|
|
+1380 2021-08-05 00:00:00 Organic Beef Blade Steak t 0.4 11 1 542 11
|
|
|
|
+1381 2021-08-05 00:00:00 Organic Beef Chuck t 0.40 11 1 541 11
|
|
|
|
+1300 2021-11-23 00:42:00 Countdown Free Range Eggs, Mixed 20 pk f 970 9.50 2 7 1
|
|
|
|
+1301 2021-11-23 00:42:00 Macro Organic White Washed Potatoes 1.5 kg t 1.5 8.5 1 3 1
|
|
|
|
+1302 2021-11-23 00:42:00 Countdown Free Range Sz 7 12pk f 744 6.9 2 7 1
|
|
|
|
+1303 2021-11-23 00:42:00 Carrots, 1.5 kg Odd Bunch f 1.5 3 1 31 1
|
|
|
|
+1304 2021-11-23 00:42:00 Essentials Coconut Cream 400 mL f 2400.00 7.2 4 32 1
|
|
|
|
+1305 2021-11-23 00:42:00 Robert Harris Italian Roast Beans 200g f 200.00 5 2 33 1
|
|
|
|
+1306 2021-11-23 00:42:00 WW Tuna Lemon Pepper 95 g f 95 1.3 2 548 1
|
|
|
|
+1307 2021-11-23 00:42:00 WW Tuna in Springwater 95 g f 570.00 7.8 2 548 1
|
|
|
|
+1308 2021-11-23 00:42:00 Macro Organic Tomatoes Diced NAS 400g t 800.00 3 2 501 1
|
|
|
|
+1178 2021-11-15 19:44:00 Onions Brown Loose f 0.922 2.31 1 2 1
|
|
|
|
+1179 2021-11-15 19:44:00 Mushrooms Button Loose f 0.243 3.16 1 22 1
|
|
|
|
+1180 2021-11-15 19:44:00 Apples Royal Gala f 0.967 4.06 1 20 1
|
|
|
|
+1181 2021-11-15 19:44:00 Chicken Thighs, Conventional, Reduced f 0.889 7.46 1 545 1
|
|
|
|
+1182 2021-11-15 19:44:00 Macro Organic White Washed Potatoes 1.5kg Reduced Price t 1.5 5.95 1 3 1
|
|
|
|
+1183 2021-11-15 19:44:00 Woodland Free Range Eggs Sz6 18pk f 954 8.5 2 7 1
|
|
|
|
+1184 2021-11-15 19:44:00 Whittakers Block Cocoa Dark 72% 250g f 250 4.5 2 34 1
|
|
|
|
+1185 2021-11-15 19:44:00 Tongariro Natural Spring Water 5L f 5 3.90 3 546 1
|
|
|
|
+1186 2021-11-15 19:44:00 Capsicum Odd Bunch 750g f 750 5 2 149 1
|
|
|
|
+1187 2021-11-15 19:44:00 Banana Fairtrade Organic 850g t 850 4.5 2 5 1
|
|
|
|
+1188 2021-11-15 19:44:00 Mainland Cheese Organic 500g t 1000 21.20 2 502 1
|
|
|
|
+1189 2021-11-15 19:44:00 Mexicano Corn Chips Natural 300g f 600 4.90 2 547 1
|
|
|
|
+1202 2021-11-15 20:10:00 Pam's Organic Fuji Apples 1 kg t 1 3.99 1 20 2
|
|
|
|
+1203 2021-11-15 20:10:00 Anchor butter 500g f 500.00 5.4 2 23 2
|
|
|
|
+1204 2021-11-15 20:10:00 Mainland Cheese Organic 500g t 500 10.39 2 502 2
|
|
|
|
+1205 2021-11-15 20:10:00 Hoco Coconut Water 1L f 1 2.99 3 544 2
|
|
|
|
+1207 2021-11-03 23:00:00 Snapper Frames f 0.995 4.48 1 533 12
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3025 (class 0 OID 16593)
|
|
|
|
+-- Dependencies: 199
|
|
|
|
+-- Data for Name: units; Type: TABLE DATA; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+COPY public.units (id, name) FROM stdin;
|
|
|
|
+1 kg
|
|
|
|
+2 g
|
|
|
|
+3 L
|
|
|
|
+4 mL
|
|
|
|
+6 Bunch
|
|
|
|
+7 Piece
|
|
|
|
+\.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3049 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 197
|
|
|
|
+-- Name: categories_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+SELECT pg_catalog.setval('public.categories_id_seq', 562, true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3050 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 202
|
|
|
|
+-- Name: conversions_complex_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+SELECT pg_catalog.setval('public.conversions_complex_id_seq', 1, true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3051 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 204
|
|
|
|
+-- Name: groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+SELECT pg_catalog.setval('public.groups_id_seq', 565, true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3052 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 213
|
|
|
|
+-- Name: products_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+SELECT pg_catalog.setval('public.products_id_seq', 560, true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3053 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 214
|
|
|
|
+-- Name: stores_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+SELECT pg_catalog.setval('public.stores_id_seq', 14, true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3054 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 216
|
|
|
|
+-- Name: transactions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+SELECT pg_catalog.setval('public.transactions_id_seq', 1385, true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 3055 (class 0 OID 0)
|
|
|
|
+-- Dependencies: 217
|
|
|
|
+-- Name: units_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+SELECT pg_catalog.setval('public.units_id_seq', 7, true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2867 (class 2606 OID 16684)
|
|
|
|
+-- Name: categories categories_name_key; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.categories
|
|
|
|
+ ADD CONSTRAINT categories_name_key UNIQUE (name);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2869 (class 2606 OID 16686)
|
|
|
|
+-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.categories
|
|
|
|
+ ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2873 (class 2606 OID 16688)
|
|
|
|
+-- Name: groups groups_name_key; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.groups
|
|
|
|
+ ADD CONSTRAINT groups_name_key UNIQUE (name);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2875 (class 2606 OID 16690)
|
|
|
|
+-- Name: groups groups_pkey; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.groups
|
|
|
|
+ ADD CONSTRAINT groups_pkey PRIMARY KEY (id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2877 (class 2606 OID 16692)
|
|
|
|
+-- Name: products products_name_key; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.products
|
|
|
|
+ ADD CONSTRAINT products_name_key UNIQUE (name);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2879 (class 2606 OID 16694)
|
|
|
|
+-- Name: products products_pkey; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.products
|
|
|
|
+ ADD CONSTRAINT products_pkey PRIMARY KEY (id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2881 (class 2606 OID 16696)
|
|
|
|
+-- Name: stores stores_name_key; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.stores
|
|
|
|
+ ADD CONSTRAINT stores_name_key UNIQUE (name);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2883 (class 2606 OID 16698)
|
|
|
|
+-- Name: stores stores_pkey; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.stores
|
|
|
|
+ ADD CONSTRAINT stores_pkey PRIMARY KEY (id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2871 (class 2606 OID 16700)
|
|
|
|
+-- Name: units units_pkey; Type: CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.units
|
|
|
|
+ ADD CONSTRAINT units_pkey PRIMARY KEY (id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2890 (class 2606 OID 16701)
|
|
|
|
+-- Name: products fk_category_id; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.products
|
|
|
|
+ ADD CONSTRAINT fk_category_id FOREIGN KEY (category_id) REFERENCES public.categories(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2885 (class 2606 OID 16706)
|
|
|
|
+-- Name: conversions fk_from; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.conversions
|
|
|
|
+ ADD CONSTRAINT fk_from FOREIGN KEY (_from) REFERENCES public.units(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2887 (class 2606 OID 16711)
|
|
|
|
+-- Name: conversions_complex fk_from; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.conversions_complex
|
|
|
|
+ ADD CONSTRAINT fk_from FOREIGN KEY (_from) REFERENCES public.units(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2884 (class 2606 OID 16716)
|
|
|
|
+-- Name: categories fk_group_id; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.categories
|
|
|
|
+ ADD CONSTRAINT fk_group_id FOREIGN KEY (group_id) REFERENCES public.groups(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2891 (class 2606 OID 16721)
|
|
|
|
+-- Name: transactions fk_product_id; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.transactions
|
|
|
|
+ ADD CONSTRAINT fk_product_id FOREIGN KEY (product_id) REFERENCES public.products(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2888 (class 2606 OID 16726)
|
|
|
|
+-- Name: conversions_complex fk_product_id; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.conversions_complex
|
|
|
|
+ ADD CONSTRAINT fk_product_id FOREIGN KEY (product_id) REFERENCES public.products(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2892 (class 2606 OID 16731)
|
|
|
|
+-- Name: transactions fk_store_id; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.transactions
|
|
|
|
+ ADD CONSTRAINT fk_store_id FOREIGN KEY (store_id) REFERENCES public.stores(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2886 (class 2606 OID 16736)
|
|
|
|
+-- Name: conversions fk_to; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.conversions
|
|
|
|
+ ADD CONSTRAINT fk_to FOREIGN KEY (_to) REFERENCES public.units(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2889 (class 2606 OID 16741)
|
|
|
|
+-- Name: conversions_complex fk_to; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.conversions_complex
|
|
|
|
+ ADD CONSTRAINT fk_to FOREIGN KEY (_to) REFERENCES public.units(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- TOC entry 2893 (class 2606 OID 16746)
|
|
|
|
+-- Name: transactions fk_unit_id; Type: FK CONSTRAINT; Schema: public; Owner: das
|
|
|
|
+--
|
|
|
|
+
|
|
|
|
+ALTER TABLE ONLY public.transactions
|
|
|
|
+ ADD CONSTRAINT fk_unit_id FOREIGN KEY (unit_id) REFERENCES public.units(id);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+-- Completed on 2021-12-06 18:15:55 NZDT
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+-- PostgreSQL database dump complete
|
|
|
|
+--
|
|
|
|
+
|