Daniel Sheffield 3 anos atrás
pai
commit
fbad30ab65
1 arquivos alterados com 1356 adições e 0 exclusões
  1. 1356 0
      db/2022-01-14

+ 1356 - 0
db/2022-01-14

@@ -0,0 +1,1356 @@
+--
+-- 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)
+
+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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
+--
+
+ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id;
+
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- Name: groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
+--
+
+ALTER SEQUENCE public.groups_id_seq OWNED BY public.groups.id;
+
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
+--
+
+ALTER SEQUENCE public.products_id_seq OWNED BY public.products.id;
+
+
+--
+-- 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;
+
+--
+-- Name: stores_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
+--
+
+ALTER SEQUENCE public.stores_id_seq OWNED BY public.stores.id;
+
+
+--
+-- 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;
+
+--
+-- 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;
+
+--
+-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
+--
+
+ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id;
+
+
+--
+-- 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;
+
+--
+-- Name: units_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: das
+--
+
+ALTER SEQUENCE public.units_id_seq OWNED BY public.units.id;
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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
+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
+143	Baking	144
+565	Bars	499
+567	Cold	499
+569	Whole	2
+570	Legumes	559
+697	Sweetener	3
+\.
+
+
+--
+-- 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
+\.
+
+
+--
+-- 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
+\.
+
+
+--
+-- 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
+\.
+
+
+--
+-- 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
+704	FR Chicken Drumsticks	324
+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
+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
+561	Refillable Bottle	491
+313	Vanilla	143
+33	Coffee Beans	35
+563	OSM bars	565
+564	Starter	143
+565	Coconut Yoghurt	567
+566	White Flour	146
+567	Brown Rice	569
+568	Red Lentils	570
+569	Mung Beans	570
+570	Pumpkin Seeds	561
+571	Salt	21
+572	Pukka Tea	144
+708	FR Chicken Mince	324
+712	Chicken Mince	324
+715	Peaches	5
+695	Honey	697
+1338	Canned Salmon	8
+1339	Apricots	5
+701	Dried Dates	559
+1340	Plums	5
+1341	Watermelon	5
+1342	Colby Cheese	145
+\.
+
+
+--
+-- 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
+15	Sarah Geerlings	PERSN
+31	New World	NW
+\.
+
+
+--
+-- 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
+1614	2021-11-30 23:00:00	Bulk Red Lentils Ceres 3.5 kg bag	t	3.5	20.26	1	568	6
+1615	2021-11-30 23:00:00	Bulk Mung Beans Ceres 3.5 kg bag	t	1	7.72	1	569	6
+1616	2021-11-30 23:00:00	Bulk Pumpkin Seeds Ceres 3 kg bag	t	3	39.44	1	570	6
+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
+1617	2021-11-30 23:00:00	Bulk Ceres Salt	t	1	2.93	1	571	6
+1618	2021-11-30 23:00:00	Licorice and Cinnamon Tea, Pukka 20 count box 40g NET	t	40	15.50	18	572	6
+2480	2021-12-20 23:18:00	Value Honey Creamed Clover Blend 500g	f	0.5	5.49	1	695	2
+2481	2021-12-20 23:18:00	Otaika Valley Size 7 12 pack	f	2976.00	27.96	2	7	2
+2482	2021-12-20 23:18:00	Pams Flour Wholemeal 1.5 kg	f	1.50	1.98	1	144	2
+2483	2021-12-20 23:18:00	Queens Diamond Pitted Dates 400g	f	400	2.19	2	701	2
+2484	2021-12-20 23:18:00	T/Colledge Vanilla Exract 100 mL FairTrade	t	100.00	8.99	4	313	2
+2485	2021-12-20 23:18:00	Value Rice Brown Long Grain 1 kg	f	1	2.09	1	567	2
+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
+2486	2021-12-20 23:18:00	Whittakers Block Dark Ghana 250g	f	500	9	2	34	2
+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
+2487	2021-12-20 23:18:00	Whole Snapper Leigh, 1.225 kg after gutted	f	1.456	23.28	1	314	2
+889	2021-08-12 01:33:00	Mainland Cheese Organic 500g	t	1	21.00	1	502	1
+2488	2021-12-20 23:18:00	Apples Braeburn	f	1.931	7.32	1	20	2
+2489	2021-12-20 23:18:00	Avocado Small	f	4	2	7	148	2
+2490	2021-12-20 23:18:00	Bananas Conventional	f	1.826	4.91	1	5	2
+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
+2491	2021-12-20 23:18:00	Beetroot Conventional	f	0.296	1.27	1	318	2
+2492	2021-12-20 23:18:00	Carrots, Loose	f	0.626	1.25	1	31	2
+2493	2021-12-20 23:18:00	Cucumber Telegraph	f	1.00	0.99	7	536	2
+2494	2021-12-20 23:18:00	Kumara Orange	f	1.401	4.19	1	21	2
+2495	2021-12-20 23:18:00	Mushrooms Button Loose	f	0.347	4.33	1	22	2
+2496	2021-12-20 23:18:00	Onions Brown	f	1.731	3.44	1	2	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
+2497	2021-12-20 23:18:00	Potatoes washed loose	f	1.246	2.85	1	3	2
+2498	2021-12-20 23:18:00	Capsicum mixed bag 700g	f	0.7	2.99	1	149	2
+2499	2021-12-20 23:18:00	Anchor butter 500g	f	500	4.9	2	23	2
+2500	2021-12-20 23:18:00	Lewis Road Creamery Organic Single Cream 300mL	f	0.3	3.99	3	490	2
+1387	2021-11-10 23:00:00	PYO Strawberries at Whatawhata Berry Farm	f	1.037	15.94	1	551	13
+3062	2021-11-11 01:02:00	Ceres Organic Tomato Paste 190g	t	760.00	9.96	2	6	2
+3063	2021-11-11 01:02:00	Otaika Valley Size 7 12 pack	f	744	6.99	2	7	2
+3064	2021-11-11 01:02:00	Otaika Valley Sz 8 10pk 675g	f	1350.00	12.58	2	7	2
+3065	2021-11-11 01:02:00	Robert Harris Italian Roast Beans 240g	f	480.00	9.00	2	33	2
+3066	2021-11-11 01:02:00	Whittakers Block Cocoa Dark 72% 250g	f	500	9	2	34	2
+3067	2021-11-11 01:02:00	Avocado Small	f	4	4	7	148	2
+2558	2021-11-03 23:13:00	Loose Avocado	f	2	2	7	148	1
+2559	2021-11-03 23:13:00	Capsicum Red NZ	f	2	3	7	149	1
+2560	2021-11-03 23:13:00	WW Coconut Water 1L	f	3	10.50	3	544	1
+2561	2021-11-03 23:13:00	Macro Organic Apple 1 kg bag	t	1	4.5	1	20	1
+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
+2562	2021-11-03 23:13:00	Mainland Cheese Vintage 500g	f	500	10.50	2	143	1
+2563	2021-11-03 23:13:00	Mainland Cheese Organic 500g	t	1000	21.20	2	502	1
+2564	2021-11-03 23:13:00	Macro Free Range Chicken Mince Reduced	f	450	7	2	708	1
+2565	2021-11-03 23:13:00	Macro Organic White Washed Potatoes 1.5 kg	t	1.5	8.5	1	3	1
+2566	2021-11-03 23:13:00	Woodland Free Range Eggs Sz6 18pk	f	954.00	8.50	2	7	1
+3068	2021-11-11 01:02:00	Bananas Conventional	f	1.92	3.83	1	5	2
+3069	2021-11-11 01:02:00	Cucumber Telegraph	f	1.00	1.99	7	536	2
+3070	2021-11-11 01:02:00	Kumara Orange	f	0.61	1.83	1	21	2
+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
+3071	2021-11-11 01:02:00	Mushrooms Button Loose	f	0.24	2.06	1	22	2
+3072	2021-11-11 01:02:00	Apples Fuji Organic 1 kg bag	t	1	3.99	1	20	2
+3073	2021-11-11 01:02:00	Eclipse Cheese Tasty 1 kg	f	1.00	11.99	1	321	2
+3074	2021-11-11 01:02:00	Chicken Mince, reduced	f	0.518	7.99	1	712	2
+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
+1620	2021-07-17 00:00:00	Whittakers Block Dark Ghana 250g	f	500	9	2	34	2
+2999	2021-11-03 23:00:00	OSM bars chocolate 6 pieces 507g NET 	f	6	13.48	7	563	2
+3000	2021-11-03 23:00:00	Fresh Ginger	f	0.096	1.15	1	537	2
+3001	2021-11-03 23:00:00	Mushrooms Button Loose	f	0.207	2.59	1	22	2
+3002	2021-11-03 23:00:00	Eclipse Cheese Tasty 1 kg	f	1	11.99	1	321	2
+1452	2021-08-05 00:00:00	Dreamview Cream 500mL	f	0.50	6.00	3	490	5
+1453	2021-08-08 00:00:00	Dreamview Raw Milk 1L	f	3	9	3	489	5
+1454	2021-08-08 00:00:00	Dreamview Cream 500mL	f	0.50	6.00	3	490	5
+1455	2021-08-08 00:00:00	Refillable Bottle	f	1	4	7	491	5
+1456	2021-08-16 00:00:00	Dreamview Cream 500mL	f	0.50	6.00	3	490	5
+1457	2021-08-16 00:00:00	Dreamview Raw Milk 1L	f	3	9	3	489	5
+1458	2021-08-23 00:00:00	Dreamview Raw Milk 1L	f	1	3	3	489	5
+1460	2021-07-21 00:00:00	Brewer's Yeast, from Bulk Bin	f	109	5.44	2	553	4
+3754	2022-01-11 02:54:00	John West Pink Salmon Canned 210g	f	420.00	5	2	1338	2
+3755	2022-01-11 02:54:00	Pams Free Range Eggs Mixed Grade 12s	f	1746.00	15.87	2	7	2
+3756	2022-01-11 02:54:00	Value Rice Brown Long Grain 1 kg	f	1	2.09	1	567	2
+3757	2022-01-11 02:54:00	Whittakers Block Cocoa Dark 72% 250g	f	500	9	2	34	2
+3758	2022-01-11 02:54:00	NZ Snapper Heads	f	0.836	5.84	1	315	2
+3759	2022-01-11 02:54:00	Apples Braeburn	f	1.881	7.13	1	20	2
+3760	2022-01-11 02:54:00	Apricots Fresh Loose	f	0.155	0.93	1	1339	2
+3761	2022-01-11 02:54:00	Bananas Conventional	f	0.831	2.24	1	5	2
+3762	2022-01-11 02:54:00	Cucumber Telegraph	f	1.00	1.49	7	536	2
+3763	2022-01-11 02:54:00	Kumara Orange	f	0.661	1.98	1	21	2
+3764	2022-01-11 02:54:00	Mango Peru	f	3	5	7	317	2
+3765	2022-01-11 02:54:00	Mushrooms Button Loose	f	0.197	2.46	1	22	2
+3766	2022-01-11 02:54:00	Onions Brown, 1 large	f	0.311	0.87	1	2	2
+3767	2022-01-11 02:54:00	Plums Black Loose	f	0.075	0.37	1	1340	2
+3768	2022-01-11 02:54:00	Watermelon Red Whole 1ea	f	2.68	6.99	1	1341	2
+3769	2022-01-11 02:54:00	Anchor butter 500g	f	2000	17.56	2	23	2
+1479	2021-12-04 23:11:00	Ceres Organic Apple Cider Vinegar 750mL	t	1500	10	4	312	2
+1480	2021-12-04 23:11:00	Pams Flour Wholemeal 1.5 kg	f	1.50	1.98	1	144	2
+1481	2021-12-04 23:11:00	Whittakers Block Cocoa Dark 72% 250g	f	500	9	2	34	2
+1482	2021-12-04 23:11:00	Bananas Conventional	f	0.671	1.54	1	5	2
+1483	2021-12-04 23:11:00	Kumara Orange	f	1.451	2.67	1	21	2
+1484	2021-12-04 23:11:00	Mushrooms Button Loose	f	0.227	2.72	1	22	2
+1485	2021-12-04 23:11:00	Pam's Organic Fuji Apples 1 kg	t	1	3.99	1	20	2
+1486	2021-12-04 23:11:00	Anchor butter 500g	f	1500.00	11.97	2	23	2
+1487	2021-12-04 23:11:00	OSM bars chocolate 6 pieces 507g NET 	f	12	25.78	7	563	2
+3770	2022-01-11 02:54:00	Valumetric Colby Cheese 1kg	f	1	7.99	1	1342	2
+1489	2021-12-08 23:00:00	Tip Top Sundae Ice Cream 2 L	f	2	6.90	3	319	14
+1491	2021-12-12 23:00:00	NZ Snapper Heads x2	f	1.59	7.16	1	315	12
+1493	2021-12-07 23:00:00	No Label Jumbo dozen eggs	f	800	5	2	7	14
+1495	2021-12-11 23:00:00	Sourdough starter with instructions	t	50	5	2	564	15
+3107	2021-12-27 03:50:00	Whittakers Block Cocoa Dark 72% 250g	f	500	9	2	34	2
+3108	2021-12-27 03:50:00	Bananas Cavendish	f	1.121	2.57	1	5	2
+3109	2021-12-27 03:50:00	Cucumber Telegraph	f	1.00	1.49	7	536	2
+3110	2021-12-27 03:50:00	Mushrooms Button Loose	f	0.087	1.09	1	22	2
+3111	2021-12-27 03:50:00	Pam's Organic Fuji Apples 1 kg	t	1	3.99	1	20	2
+2308	2021-12-19 03:20:00	Bananas Conventional	f	0.626	1.87	1	5	31
+3112	2021-12-27 03:50:00	Peaches Yellow Flesh	f	0.46	2.76	1	715	2
+3113	2021-12-27 03:50:00	Kapiti Ice Cream Triple Chocolate 1L	f	1	9.89	3	319	2
+3114	2021-12-27 03:50:00	Eclipse Cheese Tasty 1 kg	f	1.00	13.99	1	321	2
+3115	2021-12-27 03:50:00	Pam's Cream 1L	f	1	7.57	3	490	2
+3116	2021-12-27 03:50:00	Anchor butter 500g	f	1000	10	2	23	2
+3009	2021-11-09 01:09:00	Bananas Cavendish	f	0.902	2.71	1	5	1
+3171	2022-01-07 01:28:00	Beetroot Conventional	f	0.172	0.83	1	318	1
+3172	2022-01-07 01:28:00	Onions Brown Loose	f	1.142	3.99	1	2	1
+3173	2022-01-07 01:28:00	Mushrooms Button Loose	f	0.293	3.81	1	22	1
+3174	2022-01-07 01:28:00	Macro Organic Tomatoes Diced NAS 400g	t	2000.00	7.5	2	501	1
+3175	2022-01-07 01:28:00	Exotic Food Red Curry Paste 220g	f	440.00	7.6	2	535	1
+3176	2022-01-07 01:28:00	Carrots, 1.5 kg Odd Bunch	f	1.5	3	1	31	1
+3177	2022-01-07 01:28:00	Essentials French Whole Bean 200g	f	200	5	2	33	1
+3178	2022-01-07 01:28:00	Cucumber Telegraph	f	1.00	2	7	536	1
+3179	2022-01-07 01:28:00	Capsicum Odd Bunch 750g	f	750	4.5	2	149	1
+1550	2021-12-12 22:19:00	Macro Free Range Chicken Thigh Fillet, Reduced	f	0.495	9.78	1	549	1
+1551	2021-12-12 22:19:00	Macro Free Range Chicken Thigh Fillet, Reduced	f	0.513	10.14	1	549	1
+1552	2021-12-12 22:19:00	Mushrooms Button Loose	f	228	2.96	2	22	1
+1553	2021-12-12 22:19:00	Bananas Cavendish	f	1.182	3.55	1	5	1
+1554	2021-12-12 22:19:00	Beetroot Conventional	f	0.117	0.560	1	318	1
+1555	2021-12-12 22:19:00	Garlic NZ	f	0.017	0.49	1	539	1
+1556	2021-12-12 22:19:00	Fresh Ginger	f	0.232	3.94	1	537	1
+1557	2021-12-12 22:19:00	Apples Royal Gala	f	0.947	4.74	1	20	1
+1558	2021-12-12 22:19:00	CD Cream 500mL	f	0.50	3.91	3	490	1
+1559	2021-12-12 22:19:00	Raglan Coconut Yoghurt Vanilla 700g	t	700	12	2	565	1
+1560	2021-12-12 22:19:00	CD Flour Plain 1.5 kg	f	1.5	2	1	566	1
+1561	2021-12-12 22:19:00	Onion Red 1.5 kg bag	f	1.5	4	1	2	1
+1562	2021-12-12 22:19:00	Arnotts Vita-weat Cracked Pepper 250g	f	250	3	2	4	1
+1563	2021-12-12 22:19:00	Countdown Free Range Sz 7 12pk	f	1488.00	13.80	2	7	1
+1564	2021-12-12 22:19:00	Essentials Coconut Cream 400 mL	f	400	1.2	4	32	1
+1565	2021-12-12 22:19:00	Ceres Organic Brown Rice Basmati 500 g	t	500	5.79	2	567	1
+1566	2021-12-12 22:19:00	Capsicum Odd Bunch 750g	f	750	5	2	149	1
+1567	2021-12-12 22:19:00	Organic Potato	t	2	6.99	1	3	1
+1568	2021-12-12 22:19:00	Cucumber Telegraph	f	1.00	1.8	7	536	1
+1581	2021-10-09 23:00:00	Almonds, Transitional, 2.5 kg bag	f	2.5	56.66	1	554	6
+1582	2021-10-09 23:00:00	Quinoa, Tricolor, bulk 3 kg bag	t	3	28.53	1	555	6
+1583	2021-10-09 23:00:00	Nutritional Yeast, 1 kg bag	t	1	47.83	1	556	6
+1584	2021-10-09 23:00:00	Sultanas, Bulk 2.5 kg bag	t	2.5	21.47	1	557	6
+1585	2021-10-09 23:00:00	Chocolate Chips, bulk 10 kg bag	t	3	78.75	1	141	6
+1586	2021-10-09 23:00:00	Hemp Hearts, stock	t	1	23.86	1	559	6
+1588	2021-07-26 00:00:00	Jumbo Dozen Eggs from Dairy	f	860	5	2	7	14
+2516	2021-11-10 23:48:00	Macro Free Range Chicken Drumsticks	f	0.957	9.47	1	704	1
+2517	2021-11-10 23:48:00	CD Prime Beef Mince Reduced	f	1	12.85	1	35	1
+2518	2021-11-10 23:48:00	WW Flour Wholemeal 1.5 kg	f	1.50	2	1	144	1
+2519	2021-11-10 23:48:00	WW Coconut Water 1L	f	3	10.5	3	544	1
+2520	2021-11-10 23:48:00	Macro Organic Tomatoes Diced NAS 400g	t	1.2	4.5	1	501	1
+2521	2021-11-10 23:48:00	Essentials Coconut Cream 400 mL	f	800.00	2.4	4	32	1
+2522	2021-11-10 23:48:00	Capsicum Odd Bunch 750g	f	750	5	2	149	1
+3079	2021-10-25 19:31:00	Apples Braeburn	f	0.651	2.6	1	20	31
+3080	2021-10-25 19:31:00	Banana Sweetio 4 pk	f	1	3.49	6	5	31
+\.
+
+
+--
+-- 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
+18	Bags
+7	Pieces
+6	Bunches
+\.
+
+
+--
+-- Name: categories_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
+--
+
+SELECT pg_catalog.setval('public.categories_id_seq', 1344, true);
+
+
+--
+-- Name: conversions_complex_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
+--
+
+SELECT pg_catalog.setval('public.conversions_complex_id_seq', 1, true);
+
+
+--
+-- Name: groups_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
+--
+
+SELECT pg_catalog.setval('public.groups_id_seq', 1347, true);
+
+
+--
+-- Name: products_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
+--
+
+SELECT pg_catalog.setval('public.products_id_seq', 1342, true);
+
+
+--
+-- Name: stores_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
+--
+
+SELECT pg_catalog.setval('public.stores_id_seq', 31, true);
+
+
+--
+-- Name: transactions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
+--
+
+SELECT pg_catalog.setval('public.transactions_id_seq', 3770, true);
+
+
+--
+-- Name: units_id_seq; Type: SEQUENCE SET; Schema: public; Owner: das
+--
+
+SELECT pg_catalog.setval('public.units_id_seq', 130, true);
+
+
+--
+-- Name: categories categories_name_key; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.categories
+    ADD CONSTRAINT categories_name_key UNIQUE (name);
+
+
+--
+-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.categories
+    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: groups groups_name_key; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.groups
+    ADD CONSTRAINT groups_name_key UNIQUE (name);
+
+
+--
+-- Name: groups groups_pkey; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.groups
+    ADD CONSTRAINT groups_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: products products_name_key; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.products
+    ADD CONSTRAINT products_name_key UNIQUE (name);
+
+
+--
+-- Name: products products_pkey; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.products
+    ADD CONSTRAINT products_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: stores stores_name_key; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.stores
+    ADD CONSTRAINT stores_name_key UNIQUE (name);
+
+
+--
+-- Name: stores stores_pkey; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.stores
+    ADD CONSTRAINT stores_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: units units_pkey; Type: CONSTRAINT; Schema: public; Owner: das
+--
+
+ALTER TABLE ONLY public.units
+    ADD CONSTRAINT units_pkey PRIMARY KEY (id);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- 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);
+
+
+--
+-- PostgreSQL database dump complete
+--
+