Files
graphql-api-js/src/__test__/db/schema.sql
T

7504 lines
276 KiB
PL/PgSQL

--
-- PostgreSQL database dump
--
-- Dumped from database version 13.5
-- Dumped by pg_dump version 14.0
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: unaccent; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
--
-- Name: order_row_status; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.order_row_status AS ENUM (
'no_status',
'process',
'error',
'print',
'packed',
'cancelled',
'sent'
);
--
-- Name: order_row_sub_type; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.order_row_sub_type AS ENUM (
'no_subtype',
'wallpaper',
'canvas',
'poster',
'framed_print',
'inquiry_wallpaper',
'inquiry_canvas',
'inquiry_poster',
'inquiry_framed_print',
'retouch_fee',
'contract_customer_discount',
'discount_code',
'wallpaper_kit',
'canvas_frame',
'sample',
'admin_product'
);
--
-- Name: order_row_type; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.order_row_type AS ENUM (
'discount',
'fee',
'print',
'stock',
'sample',
'refund'
);
--
-- Name: field(anyelement, anyarray); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.field(anyelement, anyarray) RETURNS integer LANGUAGE sql STABLE AS $_$
SELECT COALESCE(
(
SELECT i
FROM generate_series(1, array_upper($2, 1)) gs(i)
WHERE $2 [i] = $1
),
0
);
$_$;
--
-- Name: function_copy_order(); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.function_copy_order() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN
INSERT INTO orders(id, inserted)
VALUES(new.orderid, new.inserted);
RETURN new;
END;
$$;
--
-- Name: function_copy_order_date(); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.function_copy_order_date() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN
UPDATE orders
SET inserted = new.inserted
WHERE id = new.orderid;
RETURN new;
END;
$$;
--
-- Name: function_copy_order_field(); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.function_copy_order_field() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN -- comment
IF new.fieldid = 203 THEN
UPDATE orders
SET comment = new.value
WHERE id = new.orderid;
-- country code
ELSIF new.fieldid = 151 THEN
UPDATE orders
SET country_code = new.value
WHERE id = new.orderid;
-- delivery method
ELSIF new.fieldid = 152 THEN
UPDATE orders
SET delivery_method = new.value
WHERE id = new.orderid;
-- delivery price
ELSIF new.fieldid = 153 THEN
UPDATE orders
SET delivery_price = new.value::numeric
WHERE id = new.orderid;
-- delivery country code
ELSIF new.fieldid = 213 THEN
UPDATE orders
SET delivery_country_code = new.value
WHERE id = new.orderid;
-- delivery vat
ELSIF new.fieldid = 154 THEN
UPDATE orders
SET delivery_vat = new.value::numeric
WHERE id = new.orderid;
-- attention
ELSIF new.fieldid = 162 THEN
UPDATE orders
SET attention = new.value
WHERE id = new.orderid;
-- paid
ELSIF new.fieldid = 168 THEN
UPDATE orders
SET paid = CASE
WHEN new.value = 'true' THEN 1
ELSE 0
END
WHERE id = new.orderid;
-- currency
ELSIF new.fieldid = 169 THEN
UPDATE orders
SET currency = new.value
WHERE id = new.orderid;
-- payment type
ELSIF new.fieldid = 170 THEN
UPDATE orders
SET payment_type = new.value
WHERE id = new.orderid;
-- exchange rate
ELSIF new.fieldid = 171 THEN
UPDATE orders
SET exchange_rate = new.value::numeric
WHERE id = new.orderid;
-- invoice id
ELSIF new.fieldid = 172 THEN
UPDATE orders
SET invoice_id = new.value
WHERE id = new.orderid;
-- confirmed
ELSIF new.fieldid = 175 THEN
UPDATE orders
SET confirmed = CASE
WHEN new.value = 'true' THEN 1
ELSE 0
END
WHERE id = new.orderid;
-- delivered
ELSIF new.fieldid = 176 THEN
UPDATE orders
SET delivered = CASE
WHEN new.value = 'true' THEN 1
ELSE 0
END
WHERE id = new.orderid;
-- email
ELSIF new.fieldid = 184 THEN
UPDATE orders
SET email = new.value
WHERE id = new.orderid;
-- phone
ELSIF new.fieldid = 185 THEN
UPDATE orders
SET phone = new.value
WHERE id = new.orderid;
-- newsletter
ELSIF new.fieldid = 188 THEN
UPDATE orders
SET newsletter = CASE
WHEN new.value = 'true' THEN 1
WHEN new.value = 'false' THEN 0
ELSE new.value::numeric
END
WHERE id = new.orderid;
-- language
ELSIF new.fieldid = 190 THEN
UPDATE orders
SET language = new.value
WHERE id = new.orderid;
-- contract customer id
ELSIF new.fieldid = 191 THEN
UPDATE orders
SET contract_customer_id = new.value::int
WHERE id = new.orderid;
-- credit invoice
ELSIF new.fieldid = 199 THEN
UPDATE orders
SET credit_invoice = CASE
WHEN new.value = 'true' THEN 1
ELSE 0
END
WHERE id = new.orderid;
-- canceled
ELSIF new.fieldid = 200 THEN
UPDATE orders
SET canceled = CASE
WHEN new.value = 'true' THEN 1
ELSE 0
END
WHERE id = new.orderid;
-- vat number
ELSEIF new.fieldid = 202 THEN
UPDATE orders
SET vat_number = new.value
WHERE id = new.orderid;
-- customer firstname
ELSIF new.fieldid = 209 THEN
UPDATE orders
SET customer_firstname = new.value
WHERE id = new.orderid;
-- customer lastname
ELSIF new.fieldid = 210 THEN
UPDATE orders
SET customer_lastname = new.value
WHERE id = new.orderid;
-- customer email
ELSIF new.fieldid = 211 THEN
UPDATE orders
SET customer_email = new.value
WHERE id = new.orderid;
-- customer cellphone
ELSIF new.fieldid = 212 THEN
UPDATE orders
SET customer_cellphone = new.value
WHERE id = new.orderid;
-- reminder
ELSEIF new.fieldid = 219 THEN
UPDATE orders
SET reminder = CASE
WHEN new.value = 'true' THEN 1
ELSE 0
END
WHERE id = new.orderid;
-- exchange rate eur
ELSIF new.fieldid = 223 THEN
UPDATE orders
SET exchange_rate_eur = new.value::numeric
WHERE id = new.orderid;
-- delivered_date
ELSIF new.fieldid = 225 THEN
UPDATE orders
SET delivered_date = new.value::date
WHERE id = new.orderid;
-- customer type
ELSIF new.fieldid = 227 THEN
UPDATE orders
SET customer_type = new.value
WHERE id = new.orderid;
-- cancels order id
ELSIF new.fieldid = 237 THEN
UPDATE orders
SET cancels_order_id = new.value::int
WHERE id = new.orderid;
-- cancelled by order id
ELSIF new.fieldid = 238 THEN
UPDATE orders
SET cancelled_by_order_id = new.value::int
WHERE id = new.orderid;
-- orderlog_id
ELSIF new.fieldid = 244 THEN
UPDATE orders
SET orderlog_id = new.value::int
WHERE id = new.orderid;
-- reseller store
ELSIF new.fieldid = 245 THEN
UPDATE orders
SET reseller_store = new.value
WHERE id = new.orderid;
-- order_sum
ELSIF new.fieldid = 246 THEN
UPDATE orders
SET order_sum = new.value::numeric
WHERE id = new.orderid;
-- klarna order id
ELSIF new.fieldid = 247 THEN
UPDATE orders
SET klarna_order_id = new.value
WHERE id = new.orderid;
-- delivery email
ELSIF new.fieldid = 248 THEN
UPDATE orders
SET delivery_email = new.value
WHERE id = new.orderid;
-- delivery phone
ELSIF new.fieldid = 249 THEN
UPDATE orders
SET delivery_phone = new.value
WHERE id = new.orderid;
ELSIF new.fieldid = 250 THEN
UPDATE orders
SET pwinty_id = new.value::int
WHERE id = new.orderid;
-- delivery_address_id
ELSIF new.fieldid = 254 THEN
UPDATE orders
SET delivery_address_id = new.value::int
WHERE id = new.orderid;
-- billing_address_id
ELSIF new.fieldid = 255 THEN
UPDATE orders
SET billing_address_id = new.value::int
WHERE id = new.orderid;
-- flyer ids
ELSIF new.fieldid = 240 THEN
UPDATE orders
SET flyer_ids = new.value
WHERE id = new.orderid;
-- market
ELSIF new.fieldid = 256 THEN
UPDATE orders
SET market = new.value
WHERE id = new.orderid;
-- locale
ELSIF new.fieldid = 257 THEN
UPDATE orders
SET locale = new.value
WHERE id = new.orderid;
-- paypal transaction id
ELSIF new.fieldid = 258 THEN
UPDATE orders
SET paypal_transaction_id = new.value
WHERE id = new.orderid;
END IF;
RETURN new;
END;
$$;
--
-- Name: getsafexmlpath(character varying, integer); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.getsafexmlpath(
val character varying,
with_root integer DEFAULT 0
) RETURNS character varying LANGUAGE plpgsql AS $$ BEGIN IF with_root = 1 THEN val = regexp_replace(val, '^\w+', 'root');
ELSIF with_root = 2 THEN val = regexp_replace(val, '^\w+/', '');
END IF;
val = UNACCENT(val);
val = REGEXP_REPLACE(val, '[\., _]', '-', 'g');
val = REPLACE(val, '&', '-');
/* ampersand should always be blank but it gets fixed in below */
val = lower(val);
val = REGEXP_REPLACE(val, '-+', '-', 'g');
val = REGEXP_REPLACE(val, '[^\/\w\-]', '', 'g');
RETURN val;
END;
$$;
--
-- Name: report_sales_sthlm(); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.report_sales_sthlm() RETURNS refcursor LANGUAGE plpgsql AS $$
DECLARE ref refcursor;
BEGIN OPEN ref FOR
SELECT *
FROM (
SELECT COUNT(*) AS order_count,
to_char(
(
SELECT MAX(s.order_date)
FROM v_orders s
WHERE s.email = o.email
LIMIT 1
), 'YYYY-MM-DD'
) AS last_order_date,
email,
CASE
WHEN newsletter = 'true' THEN 1
ELSE 0
END AS newsletter
FROM v_orders o
WHERE o.id IN (
SELECt id
FROM v_orders
WHERE true
AND (
iscompany = 'false'
OR iscompany IS NULL
OR iscompany = ''
)
AND (
contractcode IS NULL
OR contractcode = ''
)
AND order_date > '2014-01-01'
AND countrycode = 'SE'
AND zipcode LIKE '1%' -- Remove garbage
AND NOT email = ''
AND NOT email IS NULL
AND NOT email like '%photowall%'
)
GROUP BY email,
newsletter
) main
WHERE order_count > 1
GROUP BY order_count,
last_order_date,
email,
newsletter
LIMIT 10;
RETURN ref;
END $$;
--
-- Name: updated_timestamp(); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION public.updated_timestamp() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN NEW.updated := current_timestamp;
RETURN NEW;
END;
$$;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: delivery-methods; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."delivery-methods" (
id integer NOT NULL,
name character varying(255) NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: Delivery-methods_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."Delivery-methods_id_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: Delivery-methods_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."Delivery-methods_id_seq" OWNED BY public."delivery-methods".id;
--
-- Name: addresses; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.addresses (
id integer NOT NULL,
address1 character varying,
company_name character varying,
country_code character varying,
city character varying,
zipcode character varying,
first_name character varying,
last_name character varying,
address2 character varying,
state character varying,
email text,
phone text
);
--
-- Name: addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.addresses_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.addresses_id_seq OWNED BY public.addresses.id;
--
-- Name: agencies_agencyid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.agencies_agencyid_seq START WITH 32 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: article_article_categories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.article_article_categories (
article_id integer NOT NULL,
category_id integer NOT NULL,
main integer DEFAULT 0
);
--
-- Name: article_categories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.article_categories (
id integer NOT NULL,
name text,
slug text
);
--
-- Name: article_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.article_categories_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: article_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.article_categories_id_seq OWNED BY public.article_categories.id;
--
-- Name: article_content; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.article_content (
id integer NOT NULL,
article_id integer,
title text,
preamble text,
body text,
body_saved timestamp with time zone,
meta_title text,
meta_description text,
slug text,
market_locale_id integer NOT NULL
);
--
-- Name: article_content_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.article_content_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: article_content_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.article_content_id_seq OWNED BY public.article_content.id;
--
-- Name: articles; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.articles (
id integer NOT NULL,
created timestamp with time zone DEFAULT now() NOT NULL,
published timestamp with time zone,
deleted timestamp with time zone,
name text
);
--
-- Name: articles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.articles_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.articles_id_seq OWNED BY public.articles.id;
--
-- Name: cache; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.cache (
id integer NOT NULL,
method character varying(255) NOT NULL,
params text,
content text,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: cache_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.cache_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: cache_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.cache_id_seq OWNED BY public.cache.id;
--
-- Name: carts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.carts (
uuid uuid NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
order_id integer,
klarna_order_id text,
content jsonb NOT NULL
);
--
-- Name: categories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.categories (
id integer NOT NULL,
name character varying(255) NOT NULL,
lft integer NOT NULL,
rgt integer NOT NULL,
photo_wallpaper_image_id integer,
design_wallpaper_image_id integer,
canvas_image_id integer,
poster_image_id integer,
framed_print_image_id integer
);
--
-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.categories_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id;
--
-- Name: category_images; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_images (
id integer NOT NULL,
category_id integer,
product_group integer,
url character varying(255)
);
--
-- Name: category_images_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.category_images_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: category_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.category_images_id_seq OWNED BY public.category_images.id;
--
-- Name: category_keyword; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_keyword (
id integer NOT NULL,
category_id integer,
keyword_id integer
);
--
-- Name: category_keyword_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.category_keyword_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: category_keyword_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.category_keyword_id_seq OWNED BY public.category_keyword.id;
--
-- Name: category_metadata; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_metadata (
category_id integer NOT NULL,
canonical integer,
panel_visibility integer DEFAULT 1
);
--
-- Name: category_texts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.category_texts (
id integer NOT NULL,
category_id integer NOT NULL,
locale_id integer NOT NULL,
wallpaper_name character varying(250),
wallpaper_h1 character varying(250),
wallpaper_description text,
canvas_name character varying(250),
canvas_h1 character varying(250),
canvas_description text,
name character varying(255),
design_wallpaper_h1 character varying(255),
design_wallpaper_description text,
poster_name character varying(250),
poster_h1 character varying(250),
poster_description text,
framed_print_name character varying(250),
framed_print_h1 character varying(250),
framed_print_description text
);
--
-- Name: category_texts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.category_texts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: category_texts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.category_texts_id_seq OWNED BY public.category_texts.id;
--
-- Name: categorydata; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.categorydata (
category_id integer NOT NULL,
datakey_id integer NOT NULL,
locale_id integer NOT NULL,
text text NOT NULL
);
--
-- Name: categorydatakeys; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.categorydatakeys (
id integer NOT NULL,
name character varying(255) NOT NULL
);
--
-- Name: categorydatakeys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.categorydatakeys_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: categorydatakeys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.categorydatakeys_id_seq OWNED BY public.categorydatakeys.id;
--
-- Name: collections; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.collections (
id integer NOT NULL,
name text NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
deleted timestamp with time zone,
wallpaper_image_id integer,
canvas_image_id integer,
poster_image_id integer,
framed_print_image_id integer,
default_product_list_tab text DEFAULT 'wallpapers'::text,
face_image_key text,
author text,
author_handle text,
show_only_default boolean DEFAULT false NOT NULL,
CONSTRAINT collections_default_product_list_tab_check CHECK (
(
default_product_list_tab = ANY (
ARRAY ['wallpapers'::text, 'canvas-prints'::text, 'framed-prints'::text, 'posters'::text]
)
)
)
);
--
-- Name: collections_blacklist; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.collections_blacklist (
id integer NOT NULL,
collection_id integer NOT NULL,
market_id integer NOT NULL
);
--
-- Name: collections_blacklist_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.collections_blacklist_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: collections_blacklist_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.collections_blacklist_id_seq OWNED BY public.collections_blacklist.id;
--
-- Name: collections_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.collections_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: collections_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.collections_id_seq OWNED BY public.collections.id;
--
-- Name: collections_products; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.collections_products (
id integer NOT NULL,
collection_id integer NOT NULL,
product_id integer,
inserted timestamp with time zone DEFAULT now() NOT NULL
);
--
-- Name: collections_products_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.collections_products_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: collections_products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.collections_products_id_seq OWNED BY public.collections_products.id;
--
-- Name: collections_texts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.collections_texts (
id integer NOT NULL,
collection_id integer NOT NULL,
meta_title text,
meta_description text,
title text,
description text,
slug text,
locale_id integer NOT NULL
);
--
-- Name: collections_texts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.collections_texts_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: collections_texts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.collections_texts_id_seq OWNED BY public.collections_texts.id;
--
-- Name: contract_customers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.contract_customers (
contractcustomerid integer NOT NULL,
companyname character varying(255) NOT NULL,
code character varying(255) NOT NULL,
address character varying NOT NULL,
zipcode character varying NOT NULL,
city character varying NOT NULL,
country character varying NOT NULL,
"delivery-address" character varying NOT NULL,
"delivery-zipcode" character varying NOT NULL,
"delivery-city" character varying NOT NULL,
"delivery-country" character varying NOT NULL,
firstname character varying(255) NOT NULL,
lastname character varying(255) NOT NULL,
phone character varying(100) NOT NULL,
email character varying(100) NOT NULL,
designerid integer,
comment text NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone,
dealerstore boolean DEFAULT false NOT NULL,
dealerurl character varying(255) NOT NULL,
hideprices boolean DEFAULT false NOT NULL,
"delivery-company" character varying NOT NULL,
pricepremium numeric DEFAULT 0 NOT NULL,
"reseller-companyname" character varying(255),
"reseller-address" character varying,
"reseller-zipcode" character varying,
"reseller-city" character varying,
"reseller-phone" character varying(100),
"reseller-email" character varying(100),
vat_reg_nr character varying(100),
send_invoice character varying(100) DEFAULT 'snail mail'::character varying NOT NULL,
deleted integer DEFAULT 0 NOT NULL,
"contact-us-text" text,
"head-logo" character varying(100),
payment_type character varying(13),
email_invoice character varying(100),
state character varying,
"delivery-state" character varying,
discount integer DEFAULT 0,
"delivery-firstname" character varying,
"delivery-lastname" character varying,
"delivery-email" character varying,
"delivery-phone" character varying,
address2 character varying,
"delivery-address2" character varying,
CONSTRAINT contract_customers_send_invoice_check CHECK (
(
(send_invoice)::text = ANY (
ARRAY [('snail mail'::character varying)::text, ('email'::character varying)::text, ('edi'::character varying)::text]
)
)
)
);
--
-- Name: contract_customers_contractcustomerid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.contract_customers_contractcustomerid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: contract_customers_contractcustomerid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.contract_customers_contractcustomerid_seq OWNED BY public.contract_customers.contractcustomerid;
--
-- Name: database_versions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.database_versions (
version character varying(32) NOT NULL,
is_active boolean DEFAULT false NOT NULL,
creation_date timestamp without time zone DEFAULT now() NOT NULL
);
--
-- Name: delivery-methods_prices; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."delivery-methods_prices" (
method integer NOT NULL,
option character varying(255) NOT NULL,
option_value character varying(255) NOT NULL,
currency character varying(3) NOT NULL,
price numeric NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone,
territory character varying(2) NOT NULL
);
--
-- Name: designer_texts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.designer_texts (
id integer NOT NULL,
designerid integer NOT NULL,
locale_id integer NOT NULL,
header character varying(250),
description text
);
--
-- Name: designer_texts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.designer_texts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: designer_texts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.designer_texts_id_seq OWNED BY public.designer_texts.id;
--
-- Name: designers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.designers (
designerid integer NOT NULL,
name character varying(100) NOT NULL,
path character varying(100) NOT NULL,
username character varying(100) NOT NULL,
password character varying(32),
co character varying(100),
street character varying(100),
zipcode character varying(10),
city character varying(100),
territory character varying(2) NOT NULL,
phone character varying(100),
email character varying(100),
orgnr character varying(50),
currency character varying(3) NOT NULL,
commission integer NOT NULL,
commission_resale integer NOT NULL,
balance numeric DEFAULT 0 NOT NULL,
description text,
comments text,
status integer DEFAULT 1 NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone,
license_image character varying(100),
type character varying(20),
segmentation integer DEFAULT 1 NOT NULL,
visible_search integer DEFAULT 1,
visible_list integer DEFAULT 1,
visible_productpage integer DEFAULT 1,
visible_designerpage integer DEFAULT 1,
sort_desc boolean DEFAULT false NOT NULL,
no_follow integer DEFAULT 0,
logotype character varying,
automatic_payout integer DEFAULT 0 NOT NULL,
pricepremium_wallpaper numeric DEFAULT 0 NOT NULL,
pricepremium_canvas numeric DEFAULT 0 NOT NULL,
pricepremium_poster numeric DEFAULT 0 NOT NULL,
pricepremium_framed_print numeric DEFAULT 0 NOT NULL,
wallpaper_image_id integer,
canvas_image_id integer,
poster_image_id integer,
framed_print_image_id integer,
payout_platform_id text
);
--
-- Name: designers-blocked; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."designers-blocked" (
designerid integer NOT NULL,
domain character varying(255) NOT NULL
);
--
-- Name: designers-collections_collectionid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."designers-collections_collectionid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: designers_designerid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.designers_designerid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: designers_designerid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.designers_designerid_seq OWNED BY public.designers.designerid;
--
-- Name: designers_history; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.designers_history (
designerhistoryid integer NOT NULL,
designerid integer NOT NULL,
currency_from character varying(3) NOT NULL,
currency_to character varying(3) NOT NULL,
rowid integer NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: designers_history_designerhistoryid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.designers_history_designerhistoryid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: designers_history_designerhistoryid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.designers_history_designerhistoryid_seq OWNED BY public.designers_history.designerhistoryid;
--
-- Name: designers_resets_resetid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.designers_resets_resetid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: discount_code_filters; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discount_code_filters (
id integer NOT NULL,
filter_name character varying(100),
filter_value character varying(100),
discount_code_id integer NOT NULL
);
--
-- Name: disc_filters_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.disc_filters_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: disc_filters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.disc_filters_id_seq OWNED BY public.discount_code_filters.id;
--
-- Name: discount_codes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.discount_codes (
discountid integer NOT NULL,
name character varying(255) NOT NULL,
value integer NOT NULL,
type character varying(3) NOT NULL,
start timestamp with time zone NOT NULL,
"end" timestamp with time zone NOT NULL,
code character varying(100) NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone,
no_shipping boolean DEFAULT false,
completion_limit integer,
"group" character varying(255) DEFAULT NULL::character varying
);
--
-- Name: discount_codes_discountid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.discount_codes_discountid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: discount_codes_discountid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.discount_codes_discountid_seq OWNED BY public.discount_codes.discountid;
--
-- Name: flyers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.flyers (
flyerid integer NOT NULL,
name character varying(255) NOT NULL,
start timestamp with time zone NOT NULL,
"end" timestamp with time zone NOT NULL,
completion_limit integer,
territory character(2),
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: flyers_flyerid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.flyers_flyerid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: flyers_flyerid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.flyers_flyerid_seq OWNED BY public.flyers.flyerid;
--
-- Name: i18n-currencies; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-currencies" (
iso3char character varying(3) NOT NULL,
symbol character varying(5),
fractional_parts integer,
exchange_rate numeric DEFAULT 1,
locale character varying(50),
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: i18n-currencies_names; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-currencies_names" (
currency character varying(3) NOT NULL,
language character varying(3) NOT NULL,
name character varying(255),
name_counted character varying(255),
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: i18n-currencies_territories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-currencies_territories" (
territory character varying NOT NULL,
currency character varying NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: i18n-languages; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-languages" (
iso3char character varying(3) NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: i18n-languages_names; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-languages_names" (
iso3char character varying(3) NOT NULL,
language character varying(3) NOT NULL,
name character varying(255),
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: i18n-languages_territories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-languages_territories" (
language character varying(3) NOT NULL,
territory character varying(2) NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: i18n-territories; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-territories" (
iso2char character varying(2) NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone,
vat numeric DEFAULT 1 NOT NULL
);
--
-- Name: i18n-territories_names; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-territories_names" (
territory character varying(2) NOT NULL,
language character varying(3) NOT NULL,
name character varying(255),
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: i18n-texts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-texts" (
textid integer NOT NULL,
name character varying(100) NOT NULL,
category character varying(255),
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: i18n-texts_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."i18n-texts_data" (
textid integer NOT NULL,
text text NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone,
locale_id integer NOT NULL
);
--
-- Name: i18n-texts_textid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."i18n-texts_textid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: i18n-texts_textid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."i18n-texts_textid_seq" OWNED BY public."i18n-texts".textid;
--
-- Name: inquiries; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.inquiries (
inquiryid integer NOT NULL,
company character varying(255),
firstname character varying(255),
lastname character varying(255),
email character varying(255),
phone character varying(255),
submitted timestamp with time zone DEFAULT now() NOT NULL,
status integer DEFAULT 1 NOT NULL,
product_group character varying(100),
msg text,
msg_internal text,
msg_effect text,
price_m2 numeric,
price_effect numeric,
price_retouch numeric,
width integer,
height integer,
x numeric,
y numeric,
effect integer,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone,
dealer_store integer,
framed integer DEFAULT 0 NOT NULL,
edge character varying(255),
mirrored integer DEFAULT 0 NOT NULL,
imagedonotprint character varying(10) DEFAULT false NOT NULL,
"artNo" character varying(255),
materialid integer DEFAULT 1 NOT NULL,
pricepremium numeric DEFAULT 0 NOT NULL,
"productId" integer,
timer integer,
uploaded integer DEFAULT 0,
in_cart integer DEFAULT 0 NOT NULL,
automated integer DEFAULT 0 NOT NULL,
img_hash character varying,
img_width integer,
img_height integer,
img_size bigint,
img_format character varying,
img_timestamp bigint,
hanger character varying,
deleted timestamp with time zone,
zendesk_ticket integer,
market_id integer NOT NULL,
locale_id integer NOT NULL
);
--
-- Name: inquiries_inquiryid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.inquiries_inquiryid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: inquiries_inquiryid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.inquiries_inquiryid_seq OWNED BY public.inquiries.inquiryid;
--
-- Name: inquiry_markers; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.inquiry_markers (
id integer NOT NULL,
inquiry_id integer NOT NULL,
comment text,
number integer NOT NULL
);
--
-- Name: inquiry_markers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.inquiry_markers_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: inquiry_markers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.inquiry_markers_id_seq OWNED BY public.inquiry_markers.id;
--
-- Name: inquiry_messages; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.inquiry_messages (
id integer NOT NULL,
inquiry_id integer NOT NULL,
message text NOT NULL,
message_type integer NOT NULL,
created_at timestamp(0) without time zone DEFAULT now() NOT NULL,
user_id integer,
price numeric,
price_premium numeric,
price_total numeric,
material_id integer
);
--
-- Name: inquiry_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.inquiry_messages_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: inquiry_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.inquiry_messages_id_seq OWNED BY public.inquiry_messages.id;
--
-- Name: interiors; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.interiors (
id integer NOT NULL,
print_id integer NOT NULL,
room_id integer,
"position" smallint DEFAULT 0 NOT NULL,
create_date timestamp with time zone DEFAULT now() NOT NULL
);
--
-- Name: interiors2; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.interiors2 (
id integer NOT NULL,
print_id integer NOT NULL,
room_id integer,
"position" smallint NOT NULL,
create_date timestamp with time zone NOT NULL
);
--
-- Name: interiors_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.interiors_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: interiors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.interiors_id_seq OWNED BY public.interiors.id;
--
-- Name: invoices; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.invoices (
id integer NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
order_id integer,
invoice_date date,
invoice_sent integer DEFAULT 0 NOT NULL
);
--
-- Name: invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.invoices_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: invoices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.invoices_id_seq OWNED BY public.invoices.id;
--
-- Name: keyword_type; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.keyword_type (
keyword_id integer NOT NULL,
type_id integer
);
--
-- Name: keywords; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.keywords (
id integer NOT NULL,
value character varying(255)
);
--
-- Name: keywords_i18n; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.keywords_i18n (
parent_id integer NOT NULL,
en character varying(255) NOT NULL,
en_intl character varying(255) NOT NULL,
da character varying(255) NOT NULL,
fi character varying(255) NOT NULL,
fr character varying(255) NOT NULL,
de character varying(255) NOT NULL,
de_au character varying(255) NOT NULL,
nl character varying(255) NOT NULL,
no character varying(255) NOT NULL,
pl character varying(255) NOT NULL,
es character varying(255) NOT NULL,
sv character varying(255) NOT NULL
);
--
-- Name: keywords_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.keywords_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.keywords_id_seq OWNED BY public.keywords.id;
--
-- Name: keywordtypes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.keywordtypes (
id integer NOT NULL,
name character varying(255)
);
--
-- Name: keywordtypes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.keywordtypes_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: keywordtypes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.keywordtypes_id_seq OWNED BY public.keywordtypes.id;
--
-- Name: listprices; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.listprices (
printproduct_id integer NOT NULL,
market_id integer NOT NULL,
listprice integer
);
--
-- Name: locales; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.locales (
id integer NOT NULL,
value character(5),
fallback_id integer,
name text NOT NULL
);
--
-- Name: locales_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.locales_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: locales_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.locales_id_seq OWNED BY public.locales.id;
--
-- Name: market_locales; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.market_locales (
id integer NOT NULL,
market_id integer NOT NULL,
locale_id integer NOT NULL,
name text NOT NULL
);
--
-- Name: market_locales_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.market_locales_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: market_locales_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.market_locales_id_seq OWNED BY public.market_locales.id;
--
-- Name: markets; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.markets (
id integer NOT NULL,
name character varying,
vat numeric NOT NULL,
currency text NOT NULL,
price_adjustment numeric DEFAULT 1 NOT NULL
);
--
-- Name: markets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.markets_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: markets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.markets_id_seq OWNED BY public.markets.id;
--
-- Name: order-fields_fieldid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-fields_fieldid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."order-fields" (
fieldid integer DEFAULT nextval('public."order-fields_fieldid_seq"'::regclass) NOT NULL,
name character varying(255),
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: order-invoiceId; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceId" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdAT; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdAT" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdBE; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdBE" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdCA; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdCA" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdDE; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdDE" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdDK; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdDK" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdES; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdES" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdFI; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdFI" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdFR; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdFR" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdGB; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdGB" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdIT; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdIT" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdLT; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdLT" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdNL; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdNL" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdNO; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdNO" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-invoiceIdPL; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-invoiceIdPL" START WITH 1000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-orders_orderid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-orders_orderid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-orders; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."order-orders" (
orderid integer DEFAULT nextval('public."order-orders_orderid_seq"'::regclass) NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: order-orders_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."order-orders_fields" (
orderid integer NOT NULL,
fieldid integer NOT NULL,
value text,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: order-row_fields_fieldid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-row_fields_fieldid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-row_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."order-row_fields" (
fieldid integer DEFAULT nextval(
'public."order-row_fields_fieldid_seq"'::regclass
) NOT NULL,
name character varying(255) NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: order-rows_rowid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."order-rows_rowid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: order-rows; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."order-rows" (
orderid integer NOT NULL,
rowid integer DEFAULT nextval('public."order-rows_rowid_seq"'::regclass) NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: order-rows_details; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."order-rows_details" (
rowid integer NOT NULL,
fieldid integer NOT NULL,
value text,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: order_rows; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.order_rows (
id integer NOT NULL,
type public.order_row_type NOT NULL,
sub_type public.order_row_sub_type NOT NULL,
status public.order_row_status DEFAULT 'no_status'::public.order_row_status,
order_id integer,
designer_id integer,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone,
price numeric NOT NULL,
commission_amount numeric DEFAULT 0.0,
data jsonb
);
--
-- Name: COLUMN order_rows.price; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN public.order_rows.price IS 'Price without VAT';
--
-- Name: order_rows_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
ALTER TABLE public.order_rows
ALTER COLUMN id
ADD GENERATED ALWAYS AS IDENTITY (
SEQUENCE NAME public.order_rows_id_seq START WITH 2500000 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1
);
--
-- Name: orderlogs; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.orderlogs (
id integer NOT NULL,
created timestamp with time zone NOT NULL
);
--
-- Name: orderlogs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.orderlogs_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: orderlogs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.orderlogs_id_seq OWNED BY public.orderlogs.id;
--
-- Name: orders; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.orders (
id integer NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
paid integer DEFAULT 0 NOT NULL,
confirmed integer DEFAULT 0 NOT NULL,
delivered integer DEFAULT 0 NOT NULL,
newsletter integer DEFAULT 0 NOT NULL,
credit_invoice integer DEFAULT 0 NOT NULL,
canceled integer DEFAULT 0 NOT NULL,
reminder integer DEFAULT 0 NOT NULL,
delivered_date date,
country_code character varying(2),
language character varying(2),
delivery_country_code character varying(2),
delivery_method text,
delivery_price numeric,
delivery_vat numeric,
customer_type text,
payment_type text,
attention text,
currency character varying(3),
exchange_rate numeric,
exchange_rate_eur numeric,
invoice_id text,
contract_customer_id integer,
vat_number text,
comment text,
cancels_order_id integer,
cancelled_by_order_id integer,
orderlog_id integer,
reseller_store text,
order_sum numeric,
klarna_order_id text,
pwinty_id integer,
email text,
phone text,
delivery_email text,
delivery_phone text,
customer_firstname text,
customer_lastname text,
customer_email text,
customer_cellphone text,
billing_address_id integer,
delivery_address_id integer,
flyer_ids text,
market text,
locale text,
paypal_transaction_id text
);
--
-- Name: orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.orders_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.orders_id_seq OWNED BY public.orders.id;
--
-- Name: permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.permissions_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-currencies; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-currencies" (
iso3char character varying(3) NOT NULL,
exchange_rate numeric DEFAULT 1
);
--
-- Name: product-fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-fields" (
fieldid integer NOT NULL,
field character varying,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: product-fields_fieldid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-fields_fieldid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-fields_fieldid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-fields_fieldid_seq" OWNED BY public."product-fields".fieldid;
--
-- Name: product-groups; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-groups" (
groupid integer NOT NULL,
"group" character varying,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: product-groups_groupid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-groups_groupid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-groups_groupid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-groups_groupid_seq" OWNED BY public."product-groups".groupid;
--
-- Name: product-materials; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-materials" (
materialid integer NOT NULL,
material character varying(255) NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone,
price integer DEFAULT 1 NOT NULL
);
--
-- Name: product-materials_materialid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-materials_materialid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-materials_materialid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-materials_materialid_seq" OWNED BY public."product-materials".materialid;
--
-- Name: product-printprices; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-printprices" (
groupid integer NOT NULL,
materialid integer NOT NULL,
price numeric NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: product-printproducts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-printproducts" (
printid integer NOT NULL,
productid integer NOT NULL,
groupid integer NOT NULL,
typeid integer,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: product-printproducts_materials; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-printproducts_materials" (
printid integer NOT NULL,
materialid integer NOT NULL
);
--
-- Name: product-printproducts_printid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-printproducts_printid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-printproducts_printid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-printproducts_printid_seq" OWNED BY public."product-printproducts".printid;
--
-- Name: product-products; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-products" (
productid integer NOT NULL,
path character varying(255) NOT NULL,
visible integer DEFAULT 0 NOT NULL,
browsable integer DEFAULT 1 NOT NULL,
designerid integer,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone,
publishing_date timestamp with time zone DEFAULT now(),
ref1 text,
ref2 text,
ref3 text
);
--
-- Name: product-products_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-products_fields" (
productid integer NOT NULL,
fieldid integer NOT NULL,
value character varying,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: product-products_productid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-products_productid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-products_productid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-products_productid_seq" OWNED BY public."product-products".productid;
--
-- Name: product-products_products; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-products_products" (
productid1 integer NOT NULL,
productid2 integer NOT NULL
);
--
-- Name: product-status-history_lookup; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-status-history_lookup" (
id integer NOT NULL,
group_status character varying NOT NULL,
name character varying NOT NULL
);
--
-- Name: product-status-history_lookup_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-status-history_lookup_id_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-status-history_lookup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-status-history_lookup_id_seq" OWNED BY public."product-status-history_lookup".id;
--
-- Name: product-stockprices; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-stockprices" (
priceid integer NOT NULL,
name character varying(255),
price numeric,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: product-stockprices_priceid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-stockprices_priceid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-stockprices_priceid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-stockprices_priceid_seq" OWNED BY public."product-stockprices".priceid;
--
-- Name: product-stockproducts; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-stockproducts" (
stockid integer NOT NULL,
productid integer NOT NULL,
priceid integer NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: product-stockproducts_stockid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-stockproducts_stockid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-stockproducts_stockid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-stockproducts_stockid_seq" OWNED BY public."product-stockproducts".stockid;
--
-- Name: product-types; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."product-types" (
typeid integer NOT NULL,
type character varying,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: product-types_typeid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."product-types_typeid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product-types_typeid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."product-types_typeid_seq" OWNED BY public."product-types".typeid;
--
-- Name: product_blacklist; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.product_blacklist (
id integer NOT NULL,
product_id integer NOT NULL,
group_id integer,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
market_id integer NOT NULL
);
--
-- Name: product_blacklist_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.product_blacklist_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: product_blacklist_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.product_blacklist_id_seq OWNED BY public.product_blacklist.id;
--
-- Name: product_category; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.product_category (
product_id integer NOT NULL,
category_id integer NOT NULL
);
--
-- Name: product_keyword; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.product_keyword (
product_id integer NOT NULL,
keyword_id integer NOT NULL
);
--
-- Name: product_wallpapertypes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.product_wallpapertypes (
product_id integer NOT NULL,
wallpapertype_id integer NOT NULL
);
--
-- Name: redirects; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.redirects (
id integer NOT NULL,
source_uri character varying NOT NULL,
target_uri character varying NOT NULL,
market_locale_id integer NOT NULL
);
--
-- Name: redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.redirects_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.redirects_id_seq OWNED BY public.redirects.id;
--
-- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.roles_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: room_types; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.room_types (
id integer NOT NULL,
name character varying
);
--
-- Name: room_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.room_types_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: room_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.room_types_id_seq OWNED BY public.room_types.id;
--
-- Name: rooms; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.rooms (
id integer NOT NULL,
name character varying(255) NOT NULL,
room_type_id integer,
s3_suffix text
);
--
-- Name: rooms_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.rooms_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: rooms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.rooms_id_seq OWNED BY public.rooms.id;
--
-- Name: samples; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.samples (
id integer NOT NULL,
artno character varying,
material_id integer,
address_id integer,
quantity integer NOT NULL,
date_processed timestamp with time zone,
status character varying NOT NULL,
order_id integer,
order_row_id integer
);
--
-- Name: samples_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.samples_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: samples_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.samples_id_seq OWNED BY public.samples.id;
--
-- Name: slideshow_slides; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.slideshow_slides (
id integer NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
visible integer DEFAULT 0 NOT NULL,
"position" integer,
comment text,
target_url text,
desktop_image text,
mobile_image text,
tablet_image text,
hide_resellers integer DEFAULT 0 NOT NULL,
name text,
campaign text,
market_locale_id integer NOT NULL
);
--
-- Name: slideshow_slides_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.slideshow_slides_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: slideshow_slides_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.slideshow_slides_id_seq OWNED BY public.slideshow_slides.id;
--
-- Name: stock-items; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."stock-items" (
itemid integer NOT NULL,
name character varying(255) NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: stock-items_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."stock-items_data" (
itemid integer NOT NULL,
fieldid integer NOT NULL,
data character varying NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: stock-items_data_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."stock-items_data_fields" (
fieldid integer NOT NULL,
name character varying NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: stock-items_data_fields_fieldid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."stock-items_data_fields_fieldid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: stock-items_data_fields_fieldid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."stock-items_data_fields_fieldid_seq" OWNED BY public."stock-items_data_fields".fieldid;
--
-- Name: stock-items_itemid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."stock-items_itemid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: stock-items_itemid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."stock-items_itemid_seq" OWNED BY public."stock-items".itemid;
--
-- Name: stock-places; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."stock-places" (
placeid integer NOT NULL,
name character varying(255) NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: stock-places_placeid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."stock-places_placeid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: stock-places_placeid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."stock-places_placeid_seq" OWNED BY public."stock-places".placeid;
--
-- Name: stock-stock; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."stock-stock" (
stockid bigint NOT NULL,
itemid integer NOT NULL,
placeid integer NOT NULL,
inserted timestamp with time zone DEFAULT now(),
updated timestamp with time zone
);
--
-- Name: stock-stock_data; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."stock-stock_data" (
stockid integer NOT NULL,
fieldid integer NOT NULL,
data character varying NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: stock-stock_data_fields; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."stock-stock_data_fields" (
fieldid integer NOT NULL,
name character varying NOT NULL,
inserted timestamp with time zone DEFAULT now() NOT NULL,
updated timestamp with time zone
);
--
-- Name: stock-stock_data_fields_fieldid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."stock-stock_data_fields_fieldid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: stock-stock_data_fields_fieldid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."stock-stock_data_fields_fieldid_seq" OWNED BY public."stock-stock_data_fields".fieldid;
--
-- Name: stock-stock_stockid_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."stock-stock_stockid_seq" START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: stock-stock_stockid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."stock-stock_stockid_seq" OWNED BY public."stock-stock".stockid;
--
-- Name: teaser_images; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.teaser_images (
id integer NOT NULL,
key character varying
);
--
-- Name: teaser_images_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.teaser_images_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: teaser_images_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.teaser_images_id_seq OWNED BY public.teaser_images.id;
--
-- Name: temp_without_new_rooms; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.temp_without_new_rooms (
interiors_id integer,
print_id integer,
room_id integer,
interiors_position integer,
room_name text
);
--
-- Name: test; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.test AS
SELECT orders.id
FROM public.orders
LIMIT 10 WITH NO DATA;
--
-- Name: v_analytics_contract_customer_discounts; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_contract_customer_discounts AS
SELECT order_rows.id,
order_rows.order_id,
orders.delivery_vat,
order_rows.price,
round(
(
((order_rows.data->>'percent'::text))::numeric / (100)::numeric
),
2
) AS percent
FROM (
public.order_rows
JOIN public.orders ON ((orders.id = order_rows.order_id))
)
WHERE (
order_rows.sub_type = 'contract_customer_discount'::public.order_row_sub_type
);
--
-- Name: v_analytics_discounts; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_discounts AS
SELECT rows.orderid,
rows.rowid,
type.value AS type,
vat.value AS vat,
abs(
(
(price.value)::double precision / (exchange_rate.value)::double precision
)
) AS price_sek,
code.value AS code,
no_shipping.value AS no_shipping
FROM (
(
(
(
(
(
(
public."order-rows" rows
JOIN public."order-rows_details" modifier ON (
(
(rows.rowid = modifier.rowid)
AND (modifier.fieldid = 113)
AND (modifier.value = 'discount'::text)
)
)
)
LEFT JOIN public."order-rows_details" type ON (
(
(rows.rowid = type.rowid)
AND (type.fieldid = 94)
)
)
)
LEFT JOIN public."order-rows_details" price ON (
(
(rows.rowid = price.rowid)
AND (price.fieldid = 98)
)
)
)
LEFT JOIN public."order-rows_details" vat ON (
(
(rows.rowid = vat.rowid)
AND (vat.fieldid = 110)
)
)
)
LEFT JOIN public."order-rows_details" code ON (
(
(rows.rowid = code.rowid)
AND (code.fieldid = 115)
)
)
)
LEFT JOIN public."order-rows_details" no_shipping ON (
(
(rows.rowid = no_shipping.rowid)
AND (no_shipping.fieldid = 130)
)
)
)
LEFT JOIN public."order-orders_fields" exchange_rate ON (
(
(rows.orderid = exchange_rate.orderid)
AND (exchange_rate.fieldid = 171)
)
)
);
--
-- Name: v_analytics_inquiries; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_inquiries AS
SELECT inquiries.inquiryid,
(inquiries.inserted)::date AS inserted,
(inquiries.updated)::date AS updated,
inquiries.company,
inquiries.firstname,
inquiries.lastname AS email,
inquiries.market_id,
inquiries.locale_id AS product_group,
inquiries.price_m2,
inquiries.price_effect,
inquiries.price_retouch,
inquiries.width,
inquiries.height,
inquiries."artNo",
inquiries.materialid,
inquiries.zendesk_ticket,
order_row.rowid AS order_row_id,
order_row.orderid AS order_id
FROM (
(
public.inquiries
LEFT JOIN public."order-rows_details" order_row_inquiry ON (
(
(order_row_inquiry.fieldid = 114)
AND (
(order_row_inquiry.value)::numeric = (inquiries.inquiryid)::numeric
)
)
)
)
LEFT JOIN public."order-rows" order_row ON ((order_row.rowid = order_row_inquiry.rowid))
)
ORDER BY ((inquiries.inserted)::date) DESC;
--
-- Name: v_analytics_order_rows; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_order_rows AS
SELECT CASE
WHEN (country_code.value IS NULL) THEN 'Unknown'::text
WHEN (country_code.value = 'GB'::text) THEN 'Photowall UK'::text
WHEN (
country_code.value = ANY (
ARRAY ['SE'::text, 'NO'::text, 'DE'::text, 'AT'::text, 'FR'::text, 'ES'::text, 'FI'::text, 'DK'::text, 'PL'::text, 'US'::text, 'NL'::text]
)
) THEN ('Photowall '::text || country_code.value)
ELSE 'Photowall OTHER'::text
END AS account,
orderrows.orderid,
orderrows.rowid,
(orders.inserted)::date AS orderdate,
artno.value AS artno,
productid.value AS productid,
name.value AS name,
inquiryid.value AS inquiryid,
CASE
WHEN (
(producttype.value = 'stock'::text)
AND (productpath.value = 'sample'::text)
) THEN 'Sample'::text
ELSE productgroup.value
END AS type,
material.value AS material,
COALESCE(
(
(width_mm.value)::double precision / (10)::double precision
),
(width.value)::double precision
) AS width,
COALESCE(
(
(height_mm.value)::double precision / (10)::double precision
),
(height.value)::double precision
) AS height,
CASE
WHEN (status.value = 'process'::text) THEN 'Ready for processing'::text
WHEN (status.value = 'print'::text) THEN 'Ready for printing'::text
WHEN (
(status.value = 'sent'::text)
OR (status.value = 'pack'::text)
) THEN 'Ready for packing'::text
ELSE 'Unknown'::text
END AS status,
commission.value AS commission_percent,
round((commission_amount.value)::double precision) AS commission_amount,
discount_type.value AS discount_type,
discount_value.value AS discount_value,
CASE
WHEN (discount_type.value <> '%'::text) THEN (
(discount_value.value)::double precision / (exchange_rate.value)::double precision
)
ELSE NULL::double precision
END AS discount_amount_sek,
order_currency.value AS order_currency,
designer.value AS designer,
(
(price.value)::double precision / (exchange_rate.value)::double precision
) AS item_value_sek,
framed.value AS canvas_frame,
poster_hanger.value AS poster_hanger,
frame_color.value AS framed_print_frame,
(price.value)::double precision AS price,
vat.value AS vat
FROM (
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
public."order-rows" orderrows
LEFT JOIN public."order-rows_details" artno ON (
(
(orderrows.rowid = artno.rowid)
AND (artno.fieldid = 95)
)
)
)
LEFT JOIN public."order-rows_details" productid ON (
(
(orderrows.rowid = productid.rowid)
AND (productid.fieldid = 92)
)
)
)
LEFT JOIN public."order-rows_details" name ON (
(
(orderrows.rowid = name.rowid)
AND (name.fieldid = 97)
)
)
)
LEFT JOIN public."order-rows_details" price ON (
(
(orderrows.rowid = price.rowid)
AND (price.fieldid = 98)
)
)
)
LEFT JOIN public."order-rows_details" modifier ON (
(
(orderrows.rowid = modifier.rowid)
AND (modifier.fieldid = 113)
)
)
)
LEFT JOIN public."order-rows_details" inquiryid ON (
(
(orderrows.rowid = inquiryid.rowid)
AND (inquiryid.fieldid = 114)
)
)
)
LEFT JOIN public."order-rows_details" producttype ON (
(
(orderrows.rowid = producttype.rowid)
AND (producttype.fieldid = 94)
)
)
)
LEFT JOIN public."order-rows_details" productpath ON (
(
(orderrows.rowid = productpath.rowid)
AND (productpath.fieldid = 96)
)
)
)
LEFT JOIN public."order-rows_details" productgroup ON (
(
(orderrows.rowid = productgroup.rowid)
AND (productgroup.fieldid = 93)
)
)
)
LEFT JOIN public."order-rows_details" material ON (
(
(orderrows.rowid = material.rowid)
AND (material.fieldid = 131)
)
)
)
LEFT JOIN public."order-rows_details" width ON (
(
(orderrows.rowid = width.rowid)
AND (width.fieldid = 99)
)
)
)
LEFT JOIN public."order-rows_details" height ON (
(
(orderrows.rowid = height.rowid)
AND (height.fieldid = 100)
)
)
)
LEFT JOIN public."order-rows_details" width_mm ON (
(
(orderrows.rowid = width_mm.rowid)
AND (width_mm.fieldid = 161)
)
)
)
LEFT JOIN public."order-rows_details" height_mm ON (
(
(orderrows.rowid = height_mm.rowid)
AND (height_mm.fieldid = 162)
)
)
)
LEFT JOIN public."order-rows_details" status ON (
(
(orderrows.rowid = status.rowid)
AND (status.fieldid = 108)
)
)
)
LEFT JOIN public."order-rows_details" commission ON (
(
(orderrows.rowid = commission.rowid)
AND (commission.fieldid = 106)
)
)
)
LEFT JOIN public."order-rows_details" commission_amount ON (
(
(orderrows.rowid = commission_amount.rowid)
AND (commission_amount.fieldid = 120)
)
)
)
LEFT JOIN public."order-rows_details" discount_type ON (
(
(orderrows.rowid = discount_type.rowid)
AND (discount_type.fieldid = 142)
)
)
)
LEFT JOIN public."order-rows_details" discount_value ON (
(
(orderrows.rowid = discount_value.rowid)
AND (discount_value.fieldid = 143)
)
)
)
LEFT JOIN public."order-rows_details" poster_hanger ON (
(
(orderrows.rowid = poster_hanger.rowid)
AND (poster_hanger.fieldid = 153)
)
)
)
LEFT JOIN public."order-rows_details" framed ON (
(
(orderrows.rowid = framed.rowid)
AND (framed.fieldid = 122)
)
)
)
LEFT JOIN public."order-rows_details" frame_color ON (
(
(orderrows.rowid = frame_color.rowid)
AND (frame_color.fieldid = 156)
)
)
)
LEFT JOIN public."order-orders_fields" order_currency ON (
(
(orderrows.orderid = order_currency.orderid)
AND (order_currency.fieldid = 169)
)
)
)
LEFT JOIN public."order-orders_fields" country_code ON (
(
(orderrows.orderid = country_code.orderid)
AND (country_code.fieldid = 151)
)
)
)
LEFT JOIN public."order-rows_details" designer ON (
(
(orderrows.rowid = designer.rowid)
AND (designer.fieldid = 104)
)
)
)
LEFT JOIN public."order-orders_fields" exchange_rate ON (
(
(orderrows.orderid = exchange_rate.orderid)
AND (exchange_rate.fieldid = 171)
)
)
)
LEFT JOIN public."order-rows_details" vat ON (
(
(orderrows.rowid = vat.rowid)
AND (vat.fieldid = 110)
)
)
)
LEFT JOIN public."order-orders" orders ON ((orders.orderid = orderrows.orderid))
)
WHERE (modifier.rowid IS NULL);
--
-- Name: v_analytics_orders; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_orders AS
SELECT CASE
WHEN (billing_address.country_code IS NULL) THEN 'Unknown'::text
WHEN (
(billing_address.country_code)::text = 'GB'::text
) THEN 'Photowall UK'::text
WHEN (
(billing_address.country_code)::text = ANY (
ARRAY ['SE'::text, 'NO'::text, 'DE'::text, 'AT'::text, 'FR'::text, 'ES'::text, 'FI'::text, 'DK'::text, 'PL'::text, 'US'::text, 'NL'::text]
)
) THEN (
'Photowall '::text || (billing_address.country_code)::text
)
ELSE 'Photowall OTHER'::text
END AS account,
(orders.inserted)::date AS orderdate,
COALESCE((confirmed.value)::boolean, false) AS confirmed,
COALESCE((paid.value)::boolean, false) AS paid,
COALESCE((delivered.value)::boolean, false) AS delivered,
orders.orderid,
billing_address.first_name,
billing_address.last_name,
md5(
(
(billing_address.company_name)::text || 'vX9Px6g6yOBRTKRyH6Kt'::text
)
) AS company,
md5(
(
(billing_address.address1)::text || 'gK8fM79jomiQK4joWc3t'::text
)
) AS address,
billing_address.zipcode AS postal_code,
billing_address.city,
billing_address.country_code AS country,
email.value AS email,
(
(order_sum.value)::double precision / (exchange_rate.value)::double precision
) AS order_value_sek
FROM (
(
(
(
(
(
(
(
public."order-orders" orders
LEFT JOIN public."order-orders_fields" confirmed ON (
(
(orders.orderid = confirmed.orderid)
AND (confirmed.fieldid = 175)
)
)
)
LEFT JOIN public."order-orders_fields" delivered ON (
(
(orders.orderid = delivered.orderid)
AND (delivered.fieldid = 176)
)
)
)
LEFT JOIN public."order-orders_fields" paid ON (
(
(orders.orderid = paid.orderid)
AND (paid.fieldid = 168)
)
)
)
LEFT JOIN public."order-orders_fields" email ON (
(
(orders.orderid = email.orderid)
AND (email.fieldid = 184)
)
)
)
LEFT JOIN public."order-orders_fields" order_sum ON (
(
(orders.orderid = order_sum.orderid)
AND (order_sum.fieldid = 246)
)
)
)
LEFT JOIN public."order-orders_fields" exchange_rate ON (
(
(orders.orderid = exchange_rate.orderid)
AND (exchange_rate.fieldid = 171)
)
)
)
LEFT JOIN public."order-orders_fields" billing_address_id ON (
(
(billing_address_id.fieldid = 255)
AND (billing_address_id.orderid = orders.orderid)
)
)
)
LEFT JOIN public.addresses billing_address ON (
(
billing_address.id = (billing_address_id.value)::integer
)
)
);
--
-- Name: v_analytics_orders2; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_orders2 AS
SELECT orders.id AS order_id,
orders.inserted AS order_date,
orders.delivered,
orders.newsletter,
orders.credit_invoice,
orders.canceled,
orders.reminder,
orders.delivered_date,
orders.country_code,
orders.language,
orders.delivery_country_code,
orders.delivery_method,
orders.delivery_price,
orders.customer_type,
orders.payment_type,
orders.currency,
orders.exchange_rate,
orders.exchange_rate_eur,
orders.invoice_id,
orders.contract_customer_id,
orders.vat_number,
orders.cancels_order_id,
orders.cancelled_by_order_id,
orders.reseller_store,
orders.order_sum,
(orders.order_sum / orders.exchange_rate) AS order_sum_sek,
orders.email,
orders.phone,
billing_address.address1 AS billing_address_address1,
billing_address.address2 AS billing_address_address2,
billing_address.company_name AS billing_address_company_name,
billing_address.country_code AS billing_address_country_code,
billing_address.city AS billing_address_city,
billing_address.zipcode AS billing_address_zipcode,
billing_address.first_name AS billing_address_first_name,
billing_address.last_name AS billing_address_last_name,
billing_address.state AS billing_address_state,
delivery_address.address1 AS delivery_address_address1,
delivery_address.address2 AS delivery_address_address2,
delivery_address.company_name AS delivery_address_company_name,
delivery_address.country_code AS delivery_address_country_code,
delivery_address.city AS delivery_address_city,
delivery_address.zipcode AS delivery_address_zipcode,
delivery_address.first_name AS delivery_address_first_name,
delivery_address.last_name AS delivery_address_last_name,
delivery_address.state AS delivery_address_state
FROM (
(
public.orders
JOIN public.addresses billing_address ON ((billing_address.id = orders.billing_address_id))
)
LEFT JOIN public.addresses delivery_address ON (
(delivery_address.id = orders.delivery_address_id)
)
)
WHERE (orders.paid = 1);
--
-- Name: v_analytics_orders_not_delivered; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_orders_not_delivered AS
SELECT CASE
WHEN (billing_address.country_code IS NULL) THEN 'Unknown'::text
WHEN (
(billing_address.country_code)::text = 'GB'::text
) THEN 'Photowall UK'::text
WHEN (
(billing_address.country_code)::text = ANY (
ARRAY ['SE'::text, 'NO'::text, 'DE'::text, 'AT'::text, 'FR'::text, 'ES'::text, 'FI'::text, 'DK'::text, 'PL'::text, 'US'::text, 'NL'::text]
)
) THEN (
'Photowall '::text || (billing_address.country_code)::text
)
ELSE 'Photowall OTHER'::text
END AS account,
(orders.inserted)::date AS orderdate,
orders.orderid,
md5(
(
(billing_address.first_name)::text || 'secret'::text
)
) AS first_name,
md5(
(
(billing_address.last_name)::text || 'secret'::text
)
) AS last_name,
md5(
(
(billing_address.company_name)::text || 'secret'::text
)
) AS company,
md5(
(
(billing_address.address1)::text || 'secret'::text
)
) AS address,
billing_address.zipcode AS postal_code,
billing_address.city,
billing_address.country_code AS country,
md5((email.value || 'secret'::text)) AS email,
(
(order_sum.value)::double precision / (exchange_rate.value)::double precision
) AS order_value_sek
FROM (
(
(
(
(
(
(
(
(
public."order-orders" orders
LEFT JOIN public."order-orders_fields" confirmed ON (
(
(orders.orderid = confirmed.orderid)
AND (confirmed.fieldid = 175)
)
)
)
LEFT JOIN public."order-orders_fields" delivered ON (
(
(orders.orderid = delivered.orderid)
AND (delivered.fieldid = 176)
)
)
)
LEFT JOIN public."order-orders_fields" paid ON (
(
(orders.orderid = paid.orderid)
AND (paid.fieldid = 168)
)
)
)
LEFT JOIN public."order-orders_fields" email ON (
(
(orders.orderid = email.orderid)
AND (email.fieldid = 184)
)
)
)
LEFT JOIN public."order-orders_fields" order_sum ON (
(
(orders.orderid = order_sum.orderid)
AND (order_sum.fieldid = 246)
)
)
)
LEFT JOIN public."order-orders_fields" exchange_rate ON (
(
(orders.orderid = exchange_rate.orderid)
AND (exchange_rate.fieldid = 171)
)
)
)
LEFT JOIN public."order-orders_fields" canceled ON (
(
(orders.orderid = canceled.orderid)
AND (canceled.fieldid = 200)
)
)
)
LEFT JOIN public."order-orders_fields" billing_address_id ON (
(
(billing_address_id.fieldid = 255)
AND (billing_address_id.orderid = orders.orderid)
)
)
)
LEFT JOIN public.addresses billing_address ON (
(
billing_address.id = (billing_address_id.value)::integer
)
)
)
WHERE (
(confirmed.value = 'true'::text)
AND (delivered.value = 'false'::text)
AND (canceled.value IS NULL)
AND (paid.value = 'true'::text)
);
--
-- Name: v_analytics_orders_rows_not_delivered; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_orders_rows_not_delivered AS
SELECT rows.rowid AS order_row_id,
orders.orderid,
orders.inserted AS order_date,
product_group.value AS product_group,
artno.value AS artno,
status.value AS status,
name.value AS name,
material.value AS material
FROM (
(
(
(
(
(
(
(
(
(
(
public."order-rows" rows
JOIN public."order-orders" orders ON ((rows.orderid = orders.orderid))
)
LEFT JOIN public."order-orders_fields" order_confirmed ON (
(
(orders.orderid = order_confirmed.orderid)
AND (order_confirmed.fieldid = 175)
)
)
)
LEFT JOIN public."order-orders_fields" order_delivered ON (
(
(orders.orderid = order_delivered.orderid)
AND (order_delivered.fieldid = 176)
)
)
)
LEFT JOIN public."order-orders_fields" order_canceled ON (
(
(orders.orderid = order_canceled.orderid)
AND (order_canceled.fieldid = 200)
)
)
)
LEFT JOIN public."order-orders_fields" order_paid ON (
(
(orders.orderid = order_paid.orderid)
AND (order_paid.fieldid = 168)
)
)
)
LEFT JOIN public."order-rows_details" product_group ON (
(
(rows.rowid = product_group.rowid)
AND (product_group.fieldid = 93)
)
)
)
LEFT JOIN public."order-rows_details" artno ON (
(
(rows.rowid = artno.rowid)
AND (artno.fieldid = 95)
)
)
)
LEFT JOIN public."order-rows_details" status ON (
(
(rows.rowid = status.rowid)
AND (status.fieldid = 108)
)
)
)
LEFT JOIN public."order-rows_details" name ON (
(
(rows.rowid = name.rowid)
AND (name.fieldid = 97)
)
)
)
LEFT JOIN public."order-rows_details" modifier ON (
(
(rows.rowid = modifier.rowid)
AND (modifier.fieldid = 113)
)
)
)
LEFT JOIN public."order-rows_details" material ON (
(
(rows.rowid = material.rowid)
AND (material.fieldid = 131)
)
)
)
WHERE (
(modifier.value IS NULL)
AND (order_confirmed.value = 'true'::text)
AND (order_delivered.value = 'false'::text)
AND (order_canceled.value IS NULL)
AND (order_paid.value = 'true'::text)
);
--
-- Name: v_esales_categorytree_i18n; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.v_esales_categorytree_i18n AS
SELECT main.id,
main.parent_id,
main.locale_id,
main.locale,
main.name,
main.path,
main.is_leaf,
main.depth,
main.child_count,
main.lft,
main.rgt
FROM (
SELECT c.id,
(
SELECT s.id
FROM public.categories s
WHERE (
(s.lft < c.lft)
AND (s.rgt > c.rgt)
)
ORDER BY (s.rgt - c.rgt)
LIMIT 1
) AS parent_id,
c.locale_id,
c.locale,
c.name,
(
SELECT lower(
array_to_string(array_agg(main_1.parent_name), '/'::text)
) AS path
FROM (
SELECT node.id,
(
SELECT category_texts.name
FROM public.category_texts
WHERE (
(category_texts.locale_id = c.locale_id)
AND (category_texts.category_id = parent.id)
)
) AS parent_name
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
ORDER BY parent.lft
) main_1
GROUP BY main_1.id
) AS path,
CASE
(c.rgt - c.lft)
WHEN 1 THEN 1
ELSE 0
END AS is_leaf,
(
SELECT (count(*) - 1)
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
) AS depth,
(
SELECT (count(*) - 1)
FROM public.categories c1
WHERE (
(c1.lft >= c.lft)
AND (c1.lft <= c.rgt)
)
) AS child_count,
c.lft,
c.rgt
FROM (
SELECT c_1.id,
s.id AS locale_id,
s.value AS locale,
lower((s_t.name)::text) AS name,
c_1.rgt,
c_1.lft
FROM (
(
public.locales s
JOIN public.category_texts s_t ON ((s.id = s_t.locale_id))
)
JOIN public.categories c_1 ON ((s_t.category_id = c_1.id))
)
ORDER BY s.id,
c_1.lft
) c
) main WITH NO DATA;
--
-- Name: v_analytics_product_categories; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_product_categories AS
SELECT DISTINCT tree.id AS category_id,
public.getsafexmlpath((tree.path)::character varying, 2) AS category_path,
category_texts.name AS category_name,
product_category.product_id
FROM (
(
(
(
public.product_category
JOIN public.categories ON ((product_category.category_id = categories.id))
)
JOIN public.categories hidden_category ON (((hidden_category.name)::text = 'hidden'::text))
)
JOIN public.v_esales_categorytree_i18n tree ON (
(
(
(
(tree.lft < categories.lft)
AND (tree.rgt > categories.rgt)
)
OR (categories.id = tree.id)
)
AND (tree.id <> 1)
AND (
(tree.lft < hidden_category.lft)
OR (tree.lft > hidden_category.rgt)
)
)
)
)
JOIN public.category_texts ON (
(
(tree.id = category_texts.category_id)
AND (tree.locale_id = category_texts.locale_id)
)
)
)
WHERE (tree.locale_id = 3);
--
-- Name: v_analytics_products; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_analytics_products AS
SELECT products.productid AS product_id,
products.path AS product_path,
products.visible,
products.browsable,
products.inserted AS product_inserted,
products.updated AS product_updated,
designers.designerid AS designer_id,
designers.name AS designer_name,
products.ref1,
products.ref2,
products.ref3,
artno.value AS artno,
name.value AS product_name,
(width.value)::integer AS width,
(height.value)::integer AS height,
copyright.value AS copyright,
batch.value AS batch
FROM (
(
(
(
(
(
(
public."product-products" products
LEFT JOIN public.designers ON ((products.designerid = designers.designerid))
)
LEFT JOIN public."product-products_fields" artno ON (
(
(artno.fieldid = 1)
AND (artno.productid = products.productid)
)
)
)
LEFT JOIN public."product-products_fields" name ON (
(
(name.fieldid = 2)
AND (name.productid = products.productid)
)
)
)
LEFT JOIN public."product-products_fields" width ON (
(
(width.fieldid = 5)
AND (width.productid = products.productid)
)
)
)
LEFT JOIN public."product-products_fields" height ON (
(
(height.fieldid = 3)
AND (height.productid = products.productid)
)
)
)
LEFT JOIN public."product-products_fields" copyright ON (
(
(copyright.fieldid = 25)
AND (copyright.productid = products.productid)
)
)
)
LEFT JOIN public."product-products_fields" batch ON (
(
(batch.fieldid = 36)
AND (batch.productid = products.productid)
)
)
);
--
-- Name: v_category_keyword; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_category_keyword AS
SELECT NULL::integer AS id,
main.id AS parent_id,
k.keyword_id,
(
SELECT keywords.value
FROM public.keywords
WHERE (keywords.id = k.keyword_id)
LIMIT 1
) AS value,
CASE
WHEN (main.id = main.parent_id) THEN false
ELSE true
END AS static
FROM (
(
SELECT node.id,
parent.id AS parent_id
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
)
ORDER BY parent.lft
) main
JOIN public.category_keyword k ON ((main.parent_id = k.category_id))
);
--
-- Name: v_categorytree; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.v_categorytree AS
SELECT c.id,
c.name,
(
SELECT array_to_string(array_agg(main.parent_name), '/'::text) AS path
FROM (
SELECT node.id,
parent.name AS parent_name
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
ORDER BY parent.lft
) main
GROUP BY main.id
) AS path,
(
SELECT array_to_string(array_agg(main.parent_id), '/'::text) AS path
FROM (
SELECT node.id,
parent.id AS parent_id
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
ORDER BY parent.lft
) main
GROUP BY main.id
) AS path_numeric,
CASE
(c.rgt - c.lft)
WHEN 1 THEN 1
ELSE 0
END AS is_leaf,
(
SELECT (count(*) - 1)
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
) AS depth,
(
SELECT (count(*) - 1)
FROM public.categories c1
WHERE (
(c1.lft >= c.lft)
AND (c1.lft <= c.rgt)
)
) AS child_count,
c.lft,
c.rgt
FROM public.categories c
ORDER BY c.lft WITH NO DATA;
--
-- Name: v_categorytree_bak; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_categorytree_bak AS
SELECT c.id,
c.name,
(
SELECT array_to_string(array_agg(main.parent_name), '/'::text) AS path
FROM (
SELECT node.id,
parent.name AS parent_name
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
ORDER BY parent.lft
) main
GROUP BY main.id
) AS path,
(
SELECT array_to_string(array_agg(main.parent_id), '/'::text) AS path
FROM (
SELECT node.id,
parent.id AS parent_id
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
ORDER BY parent.lft
) main
GROUP BY main.id
) AS path_numeric,
CASE
(c.rgt - c.lft)
WHEN 1 THEN 1
ELSE 0
END AS is_leaf,
(
SELECT (count(*) - 1)
FROM public.categories node,
public.categories parent
WHERE (
(node.lft >= parent.lft)
AND (node.lft <= parent.rgt)
AND (node.id = c.id)
)
) AS depth,
(
SELECT (count(*) - 1)
FROM public.categories c1
WHERE (
(c1.lft >= c.lft)
AND (c1.lft <= c.rgt)
)
) AS child_count,
c.lft,
c.rgt
FROM public.categories c
ORDER BY c.lft;
--
-- Name: v_esales_category_count; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.v_esales_category_count AS
SELECT main.id,
main.market_id,
main.product_id,
main.groupid,
main.wallpapertype_id,
CASE
WHEN (
(main.blacklist_id IS NULL)
AND (main.visible = 1)
AND (main.browsable = 1)
) THEN true
ELSE false
END AS is_visible
FROM (
SELECT p.id,
markets.id AS market_id,
pc.product_id,
pp.groupid,
CASE
pp.groupid
WHEN 2 THEN NULL::integer
ELSE pw.wallpapertype_id
END AS wallpapertype_id,
(
SELECT product_blacklist.id
FROM public.product_blacklist
WHERE (
(product_blacklist.product_id = pc.product_id)
AND (product_blacklist.market_id = markets.id)
AND (
(product_blacklist.group_id = pp.groupid)
OR (product_blacklist.group_id IS NULL)
)
)
) AS blacklist_id,
prod.visible,
prod.browsable
FROM (
(
(
(
(
public.categories p
JOIN public.categories c ON (
(
(c.lft >= p.lft)
AND (c.rgt <= p.rgt)
)
)
)
JOIN public.product_category pc ON ((c.id = pc.category_id))
)
JOIN (
SELECT "product-printproducts".productid,
"product-printproducts".groupid
FROM public."product-printproducts"
) pp ON ((pc.product_id = pp.productid))
)
JOIN (
SELECT "product-products".productid,
"product-products".visible,
"product-products".browsable
FROM public."product-products"
) prod ON ((pc.product_id = prod.productid))
)
LEFT JOIN public.product_wallpapertypes pw ON ((pc.product_id = pw.product_id))
),
public.markets
) main
GROUP BY main.id,
main.market_id,
main.product_id,
main.groupid,
main.wallpapertype_id,
main.visible,
main.browsable,
main.blacklist_id WITH NO DATA;
--
-- Name: v_esales_product_categories; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.v_esales_product_categories AS
SELECT DISTINCT tree.id,
tree.locale_id,
public.getsafexmlpath((tree.path)::character varying, 2) AS path,
category_texts.name,
product_category.product_id
FROM (
(
(
(
public.product_category
JOIN public.categories ON ((product_category.category_id = categories.id))
)
JOIN public.categories hidden_category ON (((hidden_category.name)::text = 'hidden'::text))
)
JOIN public.v_esales_categorytree_i18n tree ON (
(
(
(
(tree.lft < categories.lft)
AND (tree.rgt > categories.rgt)
)
OR (categories.id = tree.id)
)
AND (tree.id <> 1)
AND (
(tree.lft < hidden_category.lft)
OR (tree.lft > hidden_category.rgt)
)
)
)
)
JOIN public.category_texts ON (
(
(tree.id = category_texts.category_id)
AND (tree.locale_id = category_texts.locale_id)
)
)
) WITH NO DATA;
--
-- Name: v_interior_image_urls; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_interior_image_urls AS
SELECT interiors.id AS interior_id,
"product-printproducts".productid,
interiors.print_id,
"product-printproducts".groupid AS product_group,
rooms.id AS room_id,
rooms.name AS room_name,
interiors."position",
room_types.name AS room_type,
CASE
WHEN (interiors.room_id IS NULL) THEN (
('/interior-images/'::text || interiors.id) || '.jpg'::text
)
ELSE (
(
(
'/interiors/'::text || "product-printproducts".productid
) || '/'::text
) || rooms.s3_suffix
)
END AS uri
FROM (
(
(
(
public.interiors
JOIN public."product-printproducts" ON (
(
"product-printproducts".printid = interiors.print_id
)
)
)
JOIN public."product-groups" ON (
(
"product-groups".groupid = "product-printproducts".groupid
)
)
)
LEFT JOIN public.rooms ON ((interiors.room_id = rooms.id))
)
LEFT JOIN public.room_types ON ((room_types.id = rooms.room_type_id))
);
--
-- Name: v_order_rows; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_order_rows AS
SELECT r.rowid AS id,
r.orderid AS order_id,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 91)
)
) AS printid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 92)
)
) AS productid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 93)
)
) AS "group",
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 94)
)
) AS type,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 95)
)
) AS artno,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 96)
)
) AS path,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 97)
)
) AS name,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 98)
)
) AS price,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 99)
)
) AS width,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 100)
)
) AS height,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 101)
)
) AS x,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 102)
)
) AS y,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 103)
)
) AS weight,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 104)
)
) AS designer,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 105)
)
) AS designerid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 106)
)
) AS commission,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 107)
)
) AS commission_resale,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 108)
)
) AS status,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 109)
)
) AS process,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 110)
)
) AS vat,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 111)
)
) AS qty,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 112)
)
) AS fixedvat,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 113)
)
) AS modifier,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 114)
)
) AS inquiryid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 115)
)
) AS code,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 116)
)
) AS gvid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 117)
)
) AS currency,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 118)
)
) AS comment,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 119)
)
) AS stockprice,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 120)
)
) AS commission_amount,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 121)
)
) AS stockpricenote,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 122)
)
) AS framed,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 123)
)
) AS mirrored,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 124)
)
) AS edge,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 125)
)
) AS sealinglabel_printed,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 126)
)
) AS imageprocessed,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 127)
)
) AS imageprocessingrejected,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 128)
)
) AS resolution,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 129)
)
) AS imagedonotprint,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 130)
)
) AS no_shipping,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 131)
)
) AS material,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 132)
)
) AS materialid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 133)
)
) AS stockid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 134)
)
) AS categoryid,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 135)
)
) AS automated,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 136)
)
) AS uploaded,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 137)
)
) AS imghash,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 138)
)
) AS namelocalized,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 139)
)
) AS commission_agency,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 140)
)
) AS commission_agency_resale,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 141)
)
) AS commission_agency_amount,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 142)
)
) AS discounttype,
(
SELECT s.value
FROM public."order-rows_details" s
WHERE (
(s.rowid = r.rowid)
AND (s.fieldid = 143)
)
) AS discountvalue
FROM public."order-rows" r;
--
-- Name: v_orders; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_orders AS
SELECT of.orderid AS id,
of.inserted AS order_date,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 158)
)
) AS address,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 162)
)
) AS att,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 216)
)
) AS auto_confirm,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 200)
)
) AS canceled,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 238)
)
) AS cancelledbyorderid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 237)
)
) AS cancelsorderid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 229)
)
) AS checkout2,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 160)
)
) AS city,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 155)
)
) AS co,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 203)
)
) AS comment,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 177)
)
) AS company,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 189)
)
) AS conditions,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 215)
)
) AS confirmcode,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 175)
)
) AS confirmed,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 214)
)
) AS confirmtype,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 192)
)
) AS contractcode,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 191)
)
) AS contractcustomerid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 161)
)
) AS country,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 151)
)
) AS countrycode,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 199)
)
) AS creditinvoice,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 169)
)
) AS currency,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 212)
)
) AS customercellphone,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 211)
)
) AS customeremail,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 209)
)
) AS customerfirstname,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 210)
)
) AS customerlastname,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 217)
)
) AS customerreference,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 227)
)
) AS customertype,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 174)
)
) AS custominvoice,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 197)
)
) AS debitechid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 176)
)
) AS delivered,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 225)
)
) AS delivereddate,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 178)
)
) AS delivertobillingaddress,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 181)
)
) AS delivery_address,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 183)
)
) AS delivery_city,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 180)
)
) AS delivery_co,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 213)
)
) AS delivery_countrycode,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 221)
)
) AS delivery_firstname,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 234)
)
) AS delivery_housenumber,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 222)
)
) AS delivery_lastname,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 152)
)
) AS deliverymethod,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 179)
)
) AS delivery_name,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 153)
)
) AS deliveryprice,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 154)
)
) AS deliveryvat,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 182)
)
) AS delivery_zipcode,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 184)
)
) AS email,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 171)
)
) AS exchangerate,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 223)
)
) AS exchangerateeur,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 206)
)
) AS expirationdate,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 156)
)
) AS firstname,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 231)
)
) AS gender,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 233)
)
) AS houseextension,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 232)
)
) AS housenumber,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 173)
)
) AS invoice,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 166)
)
) AS invoicedate,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 165)
)
) AS invoicedays,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 172)
)
) AS invoiceid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 207)
)
) AS invoicepaid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 205)
)
) AS invoicesent,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 201)
)
) AS iscompany,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 230)
)
) AS kco_reservation,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 224)
)
) AS kreditorinvoicenr,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 198)
)
) AS kreditorocr,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 190)
)
) AS language,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 157)
)
) AS lastname,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 188)
)
) AS newsletter,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 164)
)
) AS ourreference,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 168)
)
) AS paid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 187)
)
) AS payment_cc,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 194)
)
) AS payment_contractcode,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 193)
)
) AS payment_contractcustomerid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 226)
)
) AS paymentoption,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 204)
)
) AS payment_partpaymentoption,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 170)
)
) AS paymenttype,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 228)
)
) AS payment_value,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 218)
)
) AS permit_custom_delivery,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 185)
)
) AS phone,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 195)
)
) AS readyforhandling,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 219)
)
) AS reminder,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 167)
)
) AS sent,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 236)
)
) AS sessionid,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 186)
)
) AS socialnr,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 235)
)
) AS state,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 163)
)
) AS theirreference,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 208)
)
) AS url,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 202)
)
) AS vatnumber,
(
SELECT s.value
FROM public."order-orders_fields" s
WHERE (
(s.orderid = of.orderid)
AND (s.fieldid = 159)
)
) AS zipcode
FROM public."order-orders_fields" of
GROUP BY of.orderid,
of.inserted;
--
-- Name: v_product; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_product AS
SELECT main.product_id AS id,
main."artNo",
stock.id AS stock_id,
stock.price AS stock_price,
main.path,
main.visible,
main.browsable,
main.designerid,
main.name,
main.height,
main.print_file_height,
main.original_article_number,
main.width,
main.print_file_width,
main.widths,
main.min_height,
main.min_width,
main.max_height,
main.max_width,
main.photowall_resolution,
main.canvas_resolution,
main.wallpaper_resolution,
main.print_file_dpi,
main.lock_height,
COALESCE(main.additionalprice, (0)::double precision) AS additionalprice,
main.ref1,
main.ref2,
main.ref3,
main.copyright,
main.proportions_warning,
main.margin_width_max,
main.margin_width_min,
main.margin_height_max,
main.margin_height_min,
(
(main.width)::numeric / CASE
WHEN (main.height = 0) THEN '-1.0'::numeric
ELSE (main.height)::numeric
END
) AS width_height_ratio,
main.batch,
main.image_resolution,
main."focusXpoint",
main."focusYpoint",
main."focusXpoint2",
main."focusYpoint2",
main.repeating_pattern
FROM (
(
SELECT products.productid AS product_id,
products.path,
products.visible,
products.browsable,
products.designerid,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'artNo'::text)
LIMIT 1
)
)
)
) AS "artNo",
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'name'::text)
LIMIT 1
)
)
)
) AS name,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'height'::text)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS height,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'print_file_height'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS print_file_height,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'orgArtNo'::text
)
LIMIT 1
)
)
)
) AS original_article_number,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'width'::text)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS width,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'print_file_width'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS print_file_width,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'widths'::text)
LIMIT 1
)
)
)
) AS widths,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'min-height'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS min_height,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'min-width'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS min_width,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'max-height'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS max_height,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'max-width'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS max_width,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'photowall_resolution'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS photowall_resolution,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'canvas_resolution'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS canvas_resolution,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'wallpaper_resolution'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS wallpaper_resolution,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'lock_height'::text
)
LIMIT 1
)
)
)
) AS lock_height,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'additionalprice'::text
)
LIMIT 1
)
)
)
)
)::double precision AS additionalprice,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'ref1'::text)
LIMIT 1
)
)
)
) AS ref1,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'ref2'::text)
LIMIT 1
)
)
)
) AS ref2,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'ref3'::text)
LIMIT 1
)
)
)
) AS ref3,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'copyright'::text
)
LIMIT 1
)
)
)
) AS copyright,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'proportions_warning'::text
)
LIMIT 1
)
)
)
) AS proportions_warning,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'margin_width_max'::text
)
LIMIT 1
)
)
)
) AS margin_width_max,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'margin_width_min'::text
)
LIMIT 1
)
)
)
) AS margin_width_min,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'margin_height_max'::text
)
LIMIT 1
)
)
)
) AS margin_height_max,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'margin_height_min'::text
)
LIMIT 1
)
)
)
) AS margin_height_min,
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (("product-fields".field)::text = 'batch'::text)
LIMIT 1
)
)
)
) AS batch,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'image_resolution'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS image_resolution,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'print_file_dpi'::text
)
LIMIT 1
)
)
AND (
("product-products_fields".value)::text ~ '^\d+$'::text
)
)
)
)::integer AS print_file_dpi,
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'focusXpoint'::text
)
LIMIT 1
)
)
)
)
)::double precision AS "focusXpoint",
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'focusYpoint'::text
)
LIMIT 1
)
)
)
)
)::double precision AS "focusYpoint",
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'focusXpoint2'::text
)
LIMIT 1
)
)
)
)
)::double precision AS "focusXpoint2",
(
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'focusYpoint2'::text
)
LIMIT 1
)
)
)
)
)::double precision AS "focusYpoint2",
(
SELECT "product-products_fields".value
FROM public."product-products_fields"
WHERE (
(
"product-products_fields".productid = products.productid
)
AND (
"product-products_fields".fieldid = (
SELECT "product-fields".fieldid
FROM public."product-fields"
WHERE (
("product-fields".field)::text = 'repeating_pattern'::text
)
LIMIT 1
)
)
)
) AS repeating_pattern
FROM public."product-products" products
) main
LEFT JOIN (
SELECT s.stockid AS id,
s.productid AS product_id,
(
SELECT "product-stockprices".price
FROM public."product-stockprices"
WHERE ("product-stockprices".priceid = s.priceid)
LIMIT 1
) AS price
FROM public."product-stockproducts" s
) stock ON ((main.product_id = stock.product_id))
);
--
-- Name: v_product_keyword; Type: VIEW; Schema: public; Owner: -
--
CREATE VIEW public.v_product_keyword AS
SELECT NULL::integer AS id,
main.product_id AS parent_id,
main.keyword_id,
main.value,
main.static
FROM (
SELECT pc.product_id,
NULL::integer AS keyword_id,
true AS static,
(
SELECT categories.name
FROM public.categories
WHERE (categories.id = c.id)
) AS value
FROM public.product_category pc,
(
SELECT c_1.id,
c2.id AS child_id
FROM public.categories c_1,
public.categories c2
WHERE (
(c_1.rgt >= c2.rgt)
AND (c_1.lft <= c2.lft)
AND (c_1.id <> 1)
)
) c
WHERE (pc.category_id = c.child_id)
UNION
SELECT pc.product_id,
k.id AS keyword_id,
true AS static,
(
SELECT keywords.value
FROM public.keywords
WHERE (keywords.id = k.id)
LIMIT 1
) AS value
FROM public.product_category pc,
(
(
SELECT c_1.id,
c2.id AS child_id
FROM public.categories c_1,
public.categories c2
WHERE (
(c_1.rgt >= c2.rgt)
AND (c_1.lft <= c2.lft)
)
) c
JOIN (
SELECT category_keyword.category_id,
category_keyword.keyword_id AS id
FROM public.category_keyword
) k ON ((c.id = k.category_id))
)
WHERE (pc.category_id = c.child_id)
GROUP BY pc.product_id,
k.id
UNION
SELECT k.product_id,
k.keyword_id,
false AS static,
(
SELECT keywords.value
FROM public.keywords
WHERE (keywords.id = k.keyword_id)
LIMIT 1
) AS value
FROM public.product_keyword k
) main;
--
-- Name: v_sales_report; Type: MATERIALIZED VIEW; Schema: public; Owner: -
--
CREATE MATERIALIZED VIEW public.v_sales_report AS
SELECT o.orderid,
date(o.inserted) AS inserted,
(
SELECT "order-rows_details".value
FROM public."order-rows_details"
WHERE (
("order-rows_details".rowid = r.rowid)
AND ("order-rows_details".fieldid = 95)
)
) AS article_number,
(
(
SELECT "order-rows_details".value
FROM public."order-rows_details"
WHERE (
("order-rows_details".rowid = r.rowid)
AND ("order-rows_details".fieldid = 92)
)
)
)::integer AS product_id,
(
SELECT "order-rows_details".value
FROM public."order-rows_details"
WHERE (
("order-rows_details".rowid = r.rowid)
AND ("order-rows_details".fieldid = 96)
)
) AS path
FROM (
public."order-orders" o
JOIN public."order-rows" r ON (
(
(r.orderid = o.orderid)
AND (
EXISTS (
SELECT NULL::text AS unknown
FROM public."order-rows_details"
WHERE (
("order-rows_details".rowid = r.rowid)
AND (
"order-rows_details".fieldid = ANY (ARRAY [92, 95, 96])
)
AND (NOT ("order-rows_details".value IS NULL))
AND (NOT ("order-rows_details".value = ''::text))
)
)
)
)
)
) WITH NO DATA;
--
-- Name: wallpapertypes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.wallpapertypes (
id integer NOT NULL,
name character varying(255)
);
--
-- Name: wallpapertypes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.wallpapertypes_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
--
-- Name: wallpapertypes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.wallpapertypes_id_seq OWNED BY public.wallpapertypes.id;
--
-- Name: addresses id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.addresses
ALTER COLUMN id
SET DEFAULT nextval('public.addresses_id_seq'::regclass);
--
-- Name: article_categories id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_categories
ALTER COLUMN id
SET DEFAULT nextval('public.article_categories_id_seq'::regclass);
--
-- Name: article_content id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_content
ALTER COLUMN id
SET DEFAULT nextval('public.article_content_id_seq'::regclass);
--
-- Name: articles id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.articles
ALTER COLUMN id
SET DEFAULT nextval('public.articles_id_seq'::regclass);
--
-- Name: cache id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.cache
ALTER COLUMN id
SET DEFAULT nextval('public.cache_id_seq'::regclass);
--
-- Name: categories id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categories
ALTER COLUMN id
SET DEFAULT nextval('public.categories_id_seq'::regclass);
--
-- Name: category_images id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_images
ALTER COLUMN id
SET DEFAULT nextval('public.category_images_id_seq'::regclass);
--
-- Name: category_keyword id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_keyword
ALTER COLUMN id
SET DEFAULT nextval('public.category_keyword_id_seq'::regclass);
--
-- Name: category_texts id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_texts
ALTER COLUMN id
SET DEFAULT nextval('public.category_texts_id_seq'::regclass);
--
-- Name: categorydatakeys id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categorydatakeys
ALTER COLUMN id
SET DEFAULT nextval('public.categorydatakeys_id_seq'::regclass);
--
-- Name: collections id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections
ALTER COLUMN id
SET DEFAULT nextval('public.collections_id_seq'::regclass);
--
-- Name: collections_blacklist id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_blacklist
ALTER COLUMN id
SET DEFAULT nextval('public.collections_blacklist_id_seq'::regclass);
--
-- Name: collections_products id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_products
ALTER COLUMN id
SET DEFAULT nextval('public.collections_products_id_seq'::regclass);
--
-- Name: collections_texts id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_texts
ALTER COLUMN id
SET DEFAULT nextval('public.collections_texts_id_seq'::regclass);
--
-- Name: contract_customers contractcustomerid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.contract_customers
ALTER COLUMN contractcustomerid
SET DEFAULT nextval(
'public.contract_customers_contractcustomerid_seq'::regclass
);
--
-- Name: delivery-methods id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."delivery-methods"
ALTER COLUMN id
SET DEFAULT nextval('public."Delivery-methods_id_seq"'::regclass);
--
-- Name: designer_texts id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designer_texts
ALTER COLUMN id
SET DEFAULT nextval('public.designer_texts_id_seq'::regclass);
--
-- Name: designers designerid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers
ALTER COLUMN designerid
SET DEFAULT nextval('public.designers_designerid_seq'::regclass);
--
-- Name: designers_history designerhistoryid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers_history
ALTER COLUMN designerhistoryid
SET DEFAULT nextval(
'public.designers_history_designerhistoryid_seq'::regclass
);
--
-- Name: discount_code_filters id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.discount_code_filters
ALTER COLUMN id
SET DEFAULT nextval('public.disc_filters_id_seq'::regclass);
--
-- Name: discount_codes discountid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.discount_codes
ALTER COLUMN discountid
SET DEFAULT nextval('public.discount_codes_discountid_seq'::regclass);
--
-- Name: flyers flyerid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.flyers
ALTER COLUMN flyerid
SET DEFAULT nextval('public.flyers_flyerid_seq'::regclass);
--
-- Name: i18n-texts textid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-texts"
ALTER COLUMN textid
SET DEFAULT nextval('public."i18n-texts_textid_seq"'::regclass);
--
-- Name: inquiries inquiryid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiries
ALTER COLUMN inquiryid
SET DEFAULT nextval('public.inquiries_inquiryid_seq'::regclass);
--
-- Name: inquiry_markers id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiry_markers
ALTER COLUMN id
SET DEFAULT nextval('public.inquiry_markers_id_seq'::regclass);
--
-- Name: inquiry_messages id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiry_messages
ALTER COLUMN id
SET DEFAULT nextval('public.inquiry_messages_id_seq'::regclass);
--
-- Name: interiors id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.interiors
ALTER COLUMN id
SET DEFAULT nextval('public.interiors_id_seq'::regclass);
--
-- Name: invoices id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.invoices
ALTER COLUMN id
SET DEFAULT nextval('public.invoices_id_seq'::regclass);
--
-- Name: keywords id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keywords
ALTER COLUMN id
SET DEFAULT nextval('public.keywords_id_seq'::regclass);
--
-- Name: keywordtypes id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keywordtypes
ALTER COLUMN id
SET DEFAULT nextval('public.keywordtypes_id_seq'::regclass);
--
-- Name: locales id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.locales
ALTER COLUMN id
SET DEFAULT nextval('public.locales_id_seq'::regclass);
--
-- Name: market_locales id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.market_locales
ALTER COLUMN id
SET DEFAULT nextval('public.market_locales_id_seq'::regclass);
--
-- Name: markets id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.markets
ALTER COLUMN id
SET DEFAULT nextval('public.markets_id_seq'::regclass);
--
-- Name: orderlogs id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.orderlogs
ALTER COLUMN id
SET DEFAULT nextval('public.orderlogs_id_seq'::regclass);
--
-- Name: orders id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.orders
ALTER COLUMN id
SET DEFAULT nextval('public.orders_id_seq'::regclass);
--
-- Name: product-fields fieldid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-fields"
ALTER COLUMN fieldid
SET DEFAULT nextval('public."product-fields_fieldid_seq"'::regclass);
--
-- Name: product-groups groupid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-groups"
ALTER COLUMN groupid
SET DEFAULT nextval('public."product-groups_groupid_seq"'::regclass);
--
-- Name: product-materials materialid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-materials"
ALTER COLUMN materialid
SET DEFAULT nextval(
'public."product-materials_materialid_seq"'::regclass
);
--
-- Name: product-printproducts printid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts"
ALTER COLUMN printid
SET DEFAULT nextval(
'public."product-printproducts_printid_seq"'::regclass
);
--
-- Name: product-products productid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products"
ALTER COLUMN productid
SET DEFAULT nextval(
'public."product-products_productid_seq"'::regclass
);
--
-- Name: product-status-history_lookup id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-status-history_lookup"
ALTER COLUMN id
SET DEFAULT nextval(
'public."product-status-history_lookup_id_seq"'::regclass
);
--
-- Name: product-stockprices priceid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-stockprices"
ALTER COLUMN priceid
SET DEFAULT nextval(
'public."product-stockprices_priceid_seq"'::regclass
);
--
-- Name: product-stockproducts stockid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-stockproducts"
ALTER COLUMN stockid
SET DEFAULT nextval(
'public."product-stockproducts_stockid_seq"'::regclass
);
--
-- Name: product-types typeid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-types"
ALTER COLUMN typeid
SET DEFAULT nextval('public."product-types_typeid_seq"'::regclass);
--
-- Name: product_blacklist id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_blacklist
ALTER COLUMN id
SET DEFAULT nextval('public.product_blacklist_id_seq'::regclass);
--
-- Name: redirects id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.redirects
ALTER COLUMN id
SET DEFAULT nextval('public.redirects_id_seq'::regclass);
--
-- Name: room_types id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.room_types
ALTER COLUMN id
SET DEFAULT nextval('public.room_types_id_seq'::regclass);
--
-- Name: rooms id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.rooms
ALTER COLUMN id
SET DEFAULT nextval('public.rooms_id_seq'::regclass);
--
-- Name: samples id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.samples
ALTER COLUMN id
SET DEFAULT nextval('public.samples_id_seq'::regclass);
--
-- Name: slideshow_slides id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.slideshow_slides
ALTER COLUMN id
SET DEFAULT nextval('public.slideshow_slides_id_seq'::regclass);
--
-- Name: stock-items itemid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items"
ALTER COLUMN itemid
SET DEFAULT nextval('public."stock-items_itemid_seq"'::regclass);
--
-- Name: stock-items_data_fields fieldid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items_data_fields"
ALTER COLUMN fieldid
SET DEFAULT nextval(
'public."stock-items_data_fields_fieldid_seq"'::regclass
);
--
-- Name: stock-places placeid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-places"
ALTER COLUMN placeid
SET DEFAULT nextval('public."stock-places_placeid_seq"'::regclass);
--
-- Name: stock-stock stockid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock"
ALTER COLUMN stockid
SET DEFAULT nextval('public."stock-stock_stockid_seq"'::regclass);
--
-- Name: stock-stock_data_fields fieldid; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock_data_fields"
ALTER COLUMN fieldid
SET DEFAULT nextval(
'public."stock-stock_data_fields_fieldid_seq"'::regclass
);
--
-- Name: teaser_images id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.teaser_images
ALTER COLUMN id
SET DEFAULT nextval('public.teaser_images_id_seq'::regclass);
--
-- Name: wallpapertypes id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.wallpapertypes
ALTER COLUMN id
SET DEFAULT nextval('public.wallpapertypes_id_seq'::regclass);
--
-- Name: delivery-methods Delivery-methods_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."delivery-methods"
ADD CONSTRAINT "Delivery-methods_pkey" PRIMARY KEY (id);
--
-- Name: addresses addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.addresses
ADD CONSTRAINT addresses_pkey PRIMARY KEY (id);
--
-- Name: article_article_categories article_article_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_article_categories
ADD CONSTRAINT article_article_categories_pkey PRIMARY KEY (article_id, category_id);
--
-- Name: article_categories article_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_categories
ADD CONSTRAINT article_categories_pkey PRIMARY KEY (id);
--
-- Name: article_content article_content_article_id_market_locale_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_content
ADD CONSTRAINT article_content_article_id_market_locale_id_key UNIQUE (article_id, market_locale_id);
--
-- Name: articles articles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.articles
ADD CONSTRAINT articles_pkey PRIMARY KEY (id);
--
-- Name: cache cache_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.cache
ADD CONSTRAINT cache_pkey PRIMARY KEY (id);
--
-- Name: carts carts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.carts
ADD CONSTRAINT carts_pkey PRIMARY KEY (uuid);
--
-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
--
-- Name: category_images category_images_category_id_product_group_ukey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_images
ADD CONSTRAINT category_images_category_id_product_group_ukey UNIQUE (category_id, product_group);
--
-- Name: category_images category_images_pk; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_images
ADD CONSTRAINT category_images_pk PRIMARY KEY (id);
--
-- Name: category_keyword category_keyword_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_keyword
ADD CONSTRAINT category_keyword_pkey PRIMARY KEY (id);
--
-- Name: category_metadata category_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_metadata
ADD CONSTRAINT category_metadata_pkey PRIMARY KEY (category_id);
--
-- Name: category_texts category_texts_category_id_locale_ukey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_texts
ADD CONSTRAINT category_texts_category_id_locale_ukey UNIQUE (category_id, locale_id);
--
-- Name: category_texts category_texts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_texts
ADD CONSTRAINT category_texts_pkey PRIMARY KEY (id);
--
-- Name: categorydata categorydata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categorydata
ADD CONSTRAINT categorydata_pkey PRIMARY KEY (category_id, datakey_id, locale_id);
--
-- Name: categorydatakeys categorydatakeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categorydatakeys
ADD CONSTRAINT categorydatakeys_pkey PRIMARY KEY (id);
--
-- Name: collections_blacklist collections_blacklist_collection_id_market_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_blacklist
ADD CONSTRAINT collections_blacklist_collection_id_market_id_key UNIQUE (collection_id, market_id);
--
-- Name: collections_blacklist collections_blacklist_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_blacklist
ADD CONSTRAINT collections_blacklist_pkey PRIMARY KEY (id);
--
-- Name: collections collections_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections
ADD CONSTRAINT collections_pkey PRIMARY KEY (id);
--
-- Name: collections_products collections_products_collection_id_product_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_products
ADD CONSTRAINT collections_products_collection_id_product_id_key UNIQUE (collection_id, product_id);
--
-- Name: contract_customers contract_customers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.contract_customers
ADD CONSTRAINT contract_customers_pkey PRIMARY KEY (contractcustomerid);
--
-- Name: delivery-methods_prices delivery-methods_prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."delivery-methods_prices"
ADD CONSTRAINT "delivery-methods_prices_pkey" PRIMARY KEY (
method,
option,
option_value,
currency,
territory
);
--
-- Name: designer_texts designer_texts_designerid_locale_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designer_texts
ADD CONSTRAINT designer_texts_designerid_locale_id_key UNIQUE (designerid, locale_id);
--
-- Name: designer_texts designer_texts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designer_texts
ADD CONSTRAINT designer_texts_pkey PRIMARY KEY (id);
--
-- Name: designers-blocked designers-blocked_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."designers-blocked"
ADD CONSTRAINT "designers-blocked_pkey" PRIMARY KEY (designerid, domain);
--
-- Name: designers_history designers_history_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers_history
ADD CONSTRAINT designers_history_pkey PRIMARY KEY (designerhistoryid);
--
-- Name: designers designers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers
ADD CONSTRAINT designers_pkey PRIMARY KEY (designerid);
ALTER TABLE public.designers CLUSTER ON designers_pkey;
--
-- Name: discount_codes discount_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.discount_codes
ADD CONSTRAINT discount_codes_pkey PRIMARY KEY (discountid);
--
-- Name: discount_code_filters discount_filters_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.discount_code_filters
ADD CONSTRAINT discount_filters_pkey PRIMARY KEY (id);
--
-- Name: flyers flyers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.flyers
ADD CONSTRAINT flyers_pkey PRIMARY KEY (flyerid);
--
-- Name: i18n-currencies_names i18n-currencies_names_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-currencies_names"
ADD CONSTRAINT "i18n-currencies_names_pkey" PRIMARY KEY (currency, language);
--
-- Name: i18n-currencies i18n-currencies_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-currencies"
ADD CONSTRAINT "i18n-currencies_pkey" PRIMARY KEY (iso3char);
--
-- Name: i18n-currencies_territories i18n-currencies_territories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-currencies_territories"
ADD CONSTRAINT "i18n-currencies_territories_pkey" PRIMARY KEY (territory);
--
-- Name: i18n-languages_names i18n-languages_names_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-languages_names"
ADD CONSTRAINT "i18n-languages_names_pkey" PRIMARY KEY (iso3char, language);
--
-- Name: i18n-languages i18n-languages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-languages"
ADD CONSTRAINT "i18n-languages_pkey" PRIMARY KEY (iso3char);
--
-- Name: i18n-languages_territories i18n-languages_territories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-languages_territories"
ADD CONSTRAINT "i18n-languages_territories_pkey" PRIMARY KEY (language, territory);
--
-- Name: i18n-territories_names i18n-territories_names_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-territories_names"
ADD CONSTRAINT "i18n-territories_names_pkey" PRIMARY KEY (territory, language);
--
-- Name: i18n-texts_data i18n-texts_data_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-texts_data"
ADD CONSTRAINT "i18n-texts_data_pkey" PRIMARY KEY (textid, locale_id);
--
-- Name: i18n-texts i18n-texts_name_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-texts"
ADD CONSTRAINT "i18n-texts_name_key" UNIQUE (name, category);
ALTER TABLE public."i18n-texts" CLUSTER ON "i18n-texts_name_key";
--
-- Name: i18n-texts i18n-texts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-texts"
ADD CONSTRAINT "i18n-texts_pkey" PRIMARY KEY (textid);
--
-- Name: inquiries inquiries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiries
ADD CONSTRAINT inquiries_pkey PRIMARY KEY (inquiryid);
--
-- Name: inquiry_markers inquiry_markers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiry_markers
ADD CONSTRAINT inquiry_markers_pkey PRIMARY KEY (id);
--
-- Name: inquiry_messages inquiry_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiry_messages
ADD CONSTRAINT inquiry_messages_pkey PRIMARY KEY (id);
--
-- Name: interiors2 interiors2_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.interiors2
ADD CONSTRAINT interiors2_pkey PRIMARY KEY (id);
--
-- Name: interiors interiors_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.interiors
ADD CONSTRAINT interiors_pkey PRIMARY KEY (id);
--
-- Name: invoices invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.invoices
ADD CONSTRAINT invoices_pkey PRIMARY KEY (id);
--
-- Name: keywords_i18n keyword_trans_norm_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keywords_i18n
ADD CONSTRAINT keyword_trans_norm_pkey PRIMARY KEY (parent_id);
--
-- Name: keyword_type keyword_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keyword_type
ADD CONSTRAINT keyword_type_pkey PRIMARY KEY (keyword_id);
--
-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keywords
ADD CONSTRAINT keywords_pkey PRIMARY KEY (id);
--
-- Name: keywordtypes keywordtypes_name_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keywordtypes
ADD CONSTRAINT keywordtypes_name_key UNIQUE (name);
--
-- Name: keywordtypes keywordtypes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keywordtypes
ADD CONSTRAINT keywordtypes_pkey PRIMARY KEY (id);
--
-- Name: listprices listprices_printproduct_id_market_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.listprices
ADD CONSTRAINT listprices_printproduct_id_market_id_key UNIQUE (printproduct_id, market_id);
--
-- Name: locales locales_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.locales
ADD CONSTRAINT locales_pkey PRIMARY KEY (id);
--
-- Name: market_locales market_locales_market_id_locale_id_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.market_locales
ADD CONSTRAINT market_locales_market_id_locale_id_key UNIQUE (market_id, locale_id);
--
-- Name: market_locales market_locales_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.market_locales
ADD CONSTRAINT market_locales_pkey PRIMARY KEY (id);
--
-- Name: markets markets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.markets
ADD CONSTRAINT markets_pkey PRIMARY KEY (id);
--
-- Name: order-fields order-fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-fields"
ADD CONSTRAINT "order-fields_pkey" PRIMARY KEY (fieldid);
--
-- Name: order-orders_fields order-order_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-orders_fields"
ADD CONSTRAINT "order-order_fields_pkey" PRIMARY KEY (orderid, fieldid);
--
-- Name: order-orders order-orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-orders"
ADD CONSTRAINT "order-orders_pkey" PRIMARY KEY (orderid);
--
-- Name: order-row_fields order-row_detail_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-row_fields"
ADD CONSTRAINT "order-row_detail_fields_pkey" PRIMARY KEY (fieldid);
--
-- Name: order-rows_details order-row_details_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-rows_details"
ADD CONSTRAINT "order-row_details_pkey" PRIMARY KEY (rowid, fieldid);
--
-- Name: order-rows order-rows_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-rows"
ADD CONSTRAINT "order-rows_pkey" PRIMARY KEY (rowid);
--
-- Name: order_rows order_rows_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.order_rows
ADD CONSTRAINT order_rows_pkey PRIMARY KEY (id);
--
-- Name: orderlogs orderlogs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.orderlogs
ADD CONSTRAINT orderlogs_pkey PRIMARY KEY (id);
--
-- Name: orders orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.orders
ADD CONSTRAINT orders_pkey PRIMARY KEY (id);
--
-- Name: product-currencies product-currencies_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-currencies"
ADD CONSTRAINT "product-currencies_pkey" PRIMARY KEY (iso3char);
--
-- Name: product-fields product-fields_field_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-fields"
ADD CONSTRAINT "product-fields_field_key" UNIQUE (field);
--
-- Name: product-fields product-fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-fields"
ADD CONSTRAINT "product-fields_pkey" PRIMARY KEY (fieldid);
--
-- Name: product-groups product-groups_group_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-groups"
ADD CONSTRAINT "product-groups_group_key" UNIQUE ("group");
--
-- Name: product-groups product-groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-groups"
ADD CONSTRAINT "product-groups_pkey" PRIMARY KEY (groupid);
ALTER TABLE public."product-groups" CLUSTER ON "product-groups_pkey";
--
-- Name: product-materials product-materials_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-materials"
ADD CONSTRAINT "product-materials_pkey" PRIMARY KEY (materialid);
--
-- Name: product-printproducts_materials product-printproducts_materials_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts_materials"
ADD CONSTRAINT "product-printproducts_materials_pkey" PRIMARY KEY (printid, materialid);
ALTER TABLE public."product-printproducts_materials" CLUSTER ON "product-printproducts_materials_pkey";
--
-- Name: product-printproducts product-printproducts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts"
ADD CONSTRAINT "product-printproducts_pkey" PRIMARY KEY (printid);
--
-- Name: product-printproducts product-printproducts_productid_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts"
ADD CONSTRAINT "product-printproducts_productid_key" UNIQUE (productid, groupid);
--
-- Name: product-products_fields product-products_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products_fields"
ADD CONSTRAINT "product-products_fields_pkey" PRIMARY KEY (productid, fieldid);
--
-- Name: product-products product-products_path_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products"
ADD CONSTRAINT "product-products_path_key" UNIQUE (path);
--
-- Name: product-products product-products_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products"
ADD CONSTRAINT "product-products_pkey" PRIMARY KEY (productid);
--
-- Name: product-products_products product-products_products_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products_products"
ADD CONSTRAINT "product-products_products_pkey" PRIMARY KEY (productid1, productid2);
--
-- Name: product-status-history_lookup product-status-history-lookup_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-status-history_lookup"
ADD CONSTRAINT "product-status-history-lookup_pkey" PRIMARY KEY (id);
--
-- Name: product-stockprices product-stockprices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-stockprices"
ADD CONSTRAINT "product-stockprices_pkey" PRIMARY KEY (priceid);
--
-- Name: product-stockproducts product-stockproducts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-stockproducts"
ADD CONSTRAINT "product-stockproducts_pkey" PRIMARY KEY (stockid);
--
-- Name: product-types product-types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-types"
ADD CONSTRAINT "product-types_pkey" PRIMARY KEY (typeid);
ALTER TABLE public."product-types" CLUSTER ON "product-types_pkey";
--
-- Name: product-types product-types_type_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-types"
ADD CONSTRAINT "product-types_type_key" UNIQUE (type);
--
-- Name: product_blacklist product_blacklist_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_blacklist
ADD CONSTRAINT product_blacklist_pkey PRIMARY KEY (id);
--
-- Name: product_category product_category_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_category
ADD CONSTRAINT product_category_pkey PRIMARY KEY (product_id, category_id);
--
-- Name: product_keyword product_keyword_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_keyword
ADD CONSTRAINT product_keyword_pkey PRIMARY KEY (product_id, keyword_id);
--
-- Name: product_wallpapertypes product_wallpapertypes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_wallpapertypes
ADD CONSTRAINT product_wallpapertypes_pkey PRIMARY KEY (product_id, wallpapertype_id);
--
-- Name: redirects redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.redirects
ADD CONSTRAINT redirects_pkey PRIMARY KEY (id);
--
-- Name: room_types room_types_name_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.room_types
ADD CONSTRAINT room_types_name_key UNIQUE (name);
--
-- Name: room_types room_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.room_types
ADD CONSTRAINT room_types_pkey PRIMARY KEY (id);
--
-- Name: rooms rooms_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.rooms
ADD CONSTRAINT rooms_pkey PRIMARY KEY (id);
--
-- Name: rooms rooms_s3_suffix_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.rooms
ADD CONSTRAINT rooms_s3_suffix_key UNIQUE (s3_suffix);
--
-- Name: samples samples_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.samples
ADD CONSTRAINT samples_pkey PRIMARY KEY (id);
--
-- Name: slideshow_slides slideshow_slides_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.slideshow_slides
ADD CONSTRAINT slideshow_slides_pkey PRIMARY KEY (id);
--
-- Name: stock-items_data_fields stock-items_data_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items_data_fields"
ADD CONSTRAINT "stock-items_data_fields_pkey" PRIMARY KEY (fieldid);
--
-- Name: stock-items_data stock-items_data_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items_data"
ADD CONSTRAINT "stock-items_data_pkey" PRIMARY KEY (itemid, fieldid);
--
-- Name: stock-items stock-items_name_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items"
ADD CONSTRAINT "stock-items_name_key" UNIQUE (name);
--
-- Name: stock-items stock-items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items"
ADD CONSTRAINT "stock-items_pkey" PRIMARY KEY (itemid);
--
-- Name: stock-places stock-places_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-places"
ADD CONSTRAINT "stock-places_pkey" PRIMARY KEY (placeid);
--
-- Name: stock-stock_data_fields stock-stock_data_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock_data_fields"
ADD CONSTRAINT "stock-stock_data_fields_pkey" PRIMARY KEY (fieldid);
--
-- Name: stock-stock_data stock-stock_data_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock_data"
ADD CONSTRAINT "stock-stock_data_pkey" PRIMARY KEY (stockid, fieldid);
--
-- Name: stock-stock stock-stock_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock"
ADD CONSTRAINT "stock-stock_pkey" PRIMARY KEY (stockid);
--
-- Name: teaser_images teaser_images_key_key; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.teaser_images
ADD CONSTRAINT teaser_images_key_key UNIQUE (key);
--
-- Name: teaser_images teaser_images_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.teaser_images
ADD CONSTRAINT teaser_images_pkey PRIMARY KEY (id);
--
-- Name: i18n-territories territories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-territories"
ADD CONSTRAINT territories_pkey PRIMARY KEY (iso2char);
--
-- Name: collections_texts unique_slug; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_texts
ADD CONSTRAINT unique_slug UNIQUE (locale_id, slug);
--
-- Name: wallpapertypes wallpapertypes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.wallpapertypes
ADD CONSTRAINT wallpapertypes_pkey PRIMARY KEY (id);
--
-- Name: FK_inquiry_markers_inquiries; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX "FK_inquiry_markers_inquiries" ON public.inquiry_markers USING btree (inquiry_id);
--
-- Name: categories_lft_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX categories_lft_idx ON public.categories USING btree (lft);
--
-- Name: categories_lft_rgt_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX categories_lft_rgt_idx ON public.categories USING btree (lft, rgt);
--
-- Name: categories_name; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX categories_name ON public.categories USING btree (name);
--
-- Name: category_keyword_category_id_keyword_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX category_keyword_category_id_keyword_id_idx ON public.category_keyword USING btree (category_id, keyword_id);
--
-- Name: categorydatakeys_value_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX categorydatakeys_value_idx ON public.categorydatakeys USING btree (name);
--
-- Name: idx_filter_name; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_filter_name ON public.discount_code_filters USING btree (filter_name);
--
-- Name: img_hash; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX img_hash ON public.inquiries USING btree (img_hash);
--
-- Name: inquiries_inserted_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX inquiries_inserted_index ON public.inquiries USING btree (inserted);
--
-- Name: interiors_print_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX interiors_print_id_idx ON public.interiors USING btree (print_id);
--
-- Name: interiors_print_id_room_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX interiors_print_id_room_id_idx ON public.interiors USING btree (print_id, room_id);
--
-- Name: invoices_inserted; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX invoices_inserted ON public.invoices USING btree (inserted DESC NULLS LAST);
--
-- Name: invoices_sent; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX invoices_sent ON public.invoices USING btree (invoice_sent);
--
-- Name: ix_billing_address_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ix_billing_address_id ON public.orders USING btree (billing_address_id);
--
-- Name: ix_confirmed; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ix_confirmed ON public."order-orders_fields" USING btree (value)
WHERE (fieldid = 175);
--
-- Name: ix_creditinvoice; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ix_creditinvoice ON public."order-orders_fields" USING btree (value)
WHERE (fieldid = 199);
--
-- Name: ix_delivery_address_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ix_delivery_address_id ON public.orders USING btree (delivery_address_id);
--
-- Name: ix_email; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ix_email ON public."order-orders_fields" USING btree (value)
WHERE (fieldid = 184);
--
-- Name: ix_i18n-texts_category; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX "ix_i18n-texts_category" ON public."i18n-texts" USING btree (category);
--
-- Name: ix_invoiceid; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ix_invoiceid ON public."order-orders_fields" USING btree (value)
WHERE (fieldid = 172);
--
-- Name: ix_samples_address_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ix_samples_address_id ON public.samples USING btree (address_id);
--
-- Name: keywords_value_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX keywords_value_idx ON public.keywords USING btree (value);
--
-- Name: locales_value_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX locales_value_idx ON public.locales USING btree (value);
--
-- Name: order-rows_details_value_key; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX "order-rows_details_value_key" ON public."order-rows_details" USING btree (value);
ALTER TABLE public."order-rows_details" CLUSTER ON "order-rows_details_value_key";
--
-- Name: order_rows_designer_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_designer_id_idx ON public.order_rows USING btree (designer_id);
--
-- Name: order_rows_expr_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_expr_idx ON public.order_rows USING btree (((data->>'inquiryid'::text)));
--
-- Name: order_rows_expr_idx1; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_expr_idx1 ON public.order_rows USING btree (((data->>'code'::text)));
--
-- Name: order_rows_expr_idx2; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_expr_idx2 ON public.order_rows USING btree (((data->>'artNo'::text)));
--
-- Name: order_rows_inserted_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_inserted_index ON public."order-rows" USING btree (inserted);
--
-- Name: order_rows_order_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_order_id_idx ON public.order_rows USING btree (order_id);
--
-- Name: order_rows_status_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_status_idx ON public.order_rows USING btree (status);
--
-- Name: order_rows_sub_type_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_sub_type_idx ON public.order_rows USING btree (sub_type);
--
-- Name: order_rows_type_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX order_rows_type_idx ON public.order_rows USING btree (type);
--
-- Name: orderid_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX orderid_idx ON public."order-rows" USING btree (orderid);
--
-- Name: orders_inserted_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX orders_inserted_idx ON public.orders USING btree (inserted DESC);
--
-- Name: orders_inserted_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX orders_inserted_index ON public."order-orders" USING btree (inserted);
--
-- Name: product-printproducts_groupid; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX "product-printproducts_groupid" ON public."product-printproducts" USING btree (groupid);
ALTER TABLE public."product-printproducts" CLUSTER ON "product-printproducts_groupid";
--
-- Name: product_blacklist_product_id_group_id_market_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX product_blacklist_product_id_group_id_market_id_idx ON public.product_blacklist USING btree (product_id, group_id, market_id);
--
-- Name: product_category_product_id_category_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX product_category_product_id_category_id_idx ON public.product_category USING btree (product_id, category_id);
--
-- Name: product_keyword_product_id_keyword_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX product_keyword_product_id_keyword_id_idx ON public.product_keyword USING btree (product_id, keyword_id);
--
-- Name: product_locale_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX product_locale_idx ON public.v_esales_product_categories USING btree (product_id, locale_id);
--
-- Name: product_products_fields_fieldid_index; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX product_products_fields_fieldid_index ON public."product-products_fields" USING btree (fieldid);
--
-- Name: redirects_market_locale_id_source_uri_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX redirects_market_locale_id_source_uri_idx ON public.redirects USING btree (market_locale_id, source_uri);
--
-- Name: rooms_name_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX rooms_name_idx ON public.rooms USING btree (name);
--
-- Name: stock-stock_itemid_ix; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX "stock-stock_itemid_ix" ON public."stock-stock" USING btree (itemid);
--
-- Name: stock-stock_itemid_placeid_ix; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX "stock-stock_itemid_placeid_ix" ON public."stock-stock" USING btree (itemid, placeid);
ALTER TABLE public."stock-stock" CLUSTER ON "stock-stock_itemid_placeid_ix";
--
-- Name: v_categorytree_key; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX v_categorytree_key ON public.v_categorytree USING btree (id);
--
-- Name: v_esales_category_count_id_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX v_esales_category_count_id_idx ON public.v_esales_category_count USING btree (
id,
market_id,
product_id,
groupid,
wallpapertype_id
);
--
-- Name: v_esales_categorytree_i18n_id_locale_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX v_esales_categorytree_i18n_id_locale_id ON public.v_esales_categorytree_i18n USING btree (id, locale_id);
--
-- Name: v_sales_report_idx_1; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX v_sales_report_idx_1 ON public.v_sales_report USING btree (product_id);
--
-- Name: v_category_keyword v_category_keyword_delete; Type: RULE; Schema: public; Owner: -
--
CREATE RULE v_category_keyword_delete AS ON DELETE TO public.v_category_keyword DO INSTEAD
DELETE FROM public.category_keyword
WHERE (
(category_keyword.category_id = old.parent_id)
AND (category_keyword.keyword_id = old.keyword_id)
);
--
-- Name: v_category_keyword v_category_keyword_insert; Type: RULE; Schema: public; Owner: -
--
CREATE RULE v_category_keyword_insert AS ON
INSERT TO public.v_category_keyword DO INSTEAD
INSERT INTO public.category_keyword (category_id, keyword_id)
SELECT new.parent_id,
new.keyword_id;
--
-- Name: v_product_keyword v_product_keyword_delete; Type: RULE; Schema: public; Owner: -
--
CREATE RULE v_product_keyword_delete AS ON DELETE TO public.v_product_keyword DO INSTEAD
DELETE FROM public.product_keyword
WHERE (
(product_keyword.product_id = old.parent_id)
AND (product_keyword.keyword_id = old.keyword_id)
);
--
-- Name: v_product_keyword v_product_keyword_insert; Type: RULE; Schema: public; Owner: -
--
CREATE RULE v_product_keyword_insert AS ON
INSERT TO public.v_product_keyword DO INSTEAD
INSERT INTO public.product_keyword (product_id, keyword_id)
SELECT new.parent_id,
new.keyword_id;
--
-- Name: order-orders trig_copy_order; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER trig_copy_order
AFTER
INSERT ON public."order-orders" FOR EACH ROW EXECUTE FUNCTION public.function_copy_order();
--
-- Name: order-orders trig_copy_order_date; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER trig_copy_order_date
AFTER
UPDATE OF inserted ON public."order-orders" FOR EACH ROW EXECUTE FUNCTION public.function_copy_order_date();
--
-- Name: order-orders_fields trig_copy_order_field; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER trig_copy_order_field
AFTER
INSERT
OR
UPDATE ON public."order-orders_fields" FOR EACH ROW EXECUTE FUNCTION public.function_copy_order_field();
--
-- Name: cache updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public.cache FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: contract_customers updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public.contract_customers FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: delivery-methods updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."delivery-methods" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: delivery-methods_prices updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."delivery-methods_prices" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: designers updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public.designers FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: designers_history updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public.designers_history FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: discount_codes updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public.discount_codes FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-currencies updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-currencies" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-currencies_names updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-currencies_names" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-currencies_territories updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-currencies_territories" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-languages updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-languages" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-languages_names updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-languages_names" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-languages_territories updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-languages_territories" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-territories updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-territories" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: i18n-territories_names updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."i18n-territories_names" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: inquiries updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public.inquiries FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: order-fields updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."order-fields" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: order-orders updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."order-orders" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: order-orders_fields updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."order-orders_fields" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: order-row_fields updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."order-row_fields" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: order-rows updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."order-rows" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: order-rows_details updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."order-rows_details" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: order_rows updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public.order_rows FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-fields updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-fields" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-groups updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-groups" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-materials updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-materials" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-printprices updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-printprices" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-printproducts updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-printproducts" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-products updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-products" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-products_fields updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-products_fields" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-stockprices updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-stockprices" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-stockproducts updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-stockproducts" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: product-types updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."product-types" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: stock-items updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."stock-items" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: stock-places updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."stock-places" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: stock-stock updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."stock-stock" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: stock-stock_data updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."stock-stock_data" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: stock-stock_data_fields updated_timestamp; Type: TRIGGER; Schema: public; Owner: -
--
CREATE TRIGGER updated_timestamp BEFORE
UPDATE ON public."stock-stock_data_fields" FOR EACH ROW EXECUTE FUNCTION public.updated_timestamp();
--
-- Name: delivery-methods_prices Delivery-methods_prices_currency_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."delivery-methods_prices"
ADD CONSTRAINT "Delivery-methods_prices_currency_fkey" FOREIGN KEY (currency) REFERENCES public."i18n-currencies"(iso3char) ON DELETE RESTRICT;
--
-- Name: delivery-methods_prices Delivery-methods_prices_method_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."delivery-methods_prices"
ADD CONSTRAINT "Delivery-methods_prices_method_fkey" FOREIGN KEY (method) REFERENCES public."delivery-methods"(id) ON DELETE RESTRICT;
--
-- Name: samples address_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.samples
ADD CONSTRAINT address_fkey FOREIGN KEY (address_id) REFERENCES public.addresses(id);
--
-- Name: article_content article_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_content
ADD CONSTRAINT article_id FOREIGN KEY (article_id) REFERENCES public.articles(id);
--
-- Name: article_article_categories article_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_article_categories
ADD CONSTRAINT article_id FOREIGN KEY (article_id) REFERENCES public.articles(id);
--
-- Name: orders billing_address_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.orders
ADD CONSTRAINT billing_address_fkey FOREIGN KEY (billing_address_id) REFERENCES public.addresses(id);
--
-- Name: designers canvas_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers
ADD CONSTRAINT canvas_image_fk FOREIGN KEY (canvas_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: collections canvas_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections
ADD CONSTRAINT canvas_image_fk FOREIGN KEY (canvas_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: categories canvas_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT canvas_image_fk FOREIGN KEY (canvas_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: carts carts_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.carts
ADD CONSTRAINT carts_order_id_fkey FOREIGN KEY (order_id) REFERENCES public.orders(id);
--
-- Name: category_texts categories_categories_texts_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_texts
ADD CONSTRAINT categories_categories_texts_fkey FOREIGN KEY (category_id) REFERENCES public.categories(id) ON DELETE CASCADE;
--
-- Name: category_images categories_category_images_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_images
ADD CONSTRAINT categories_category_images_fk FOREIGN KEY (category_id) REFERENCES public.categories(id) ON DELETE CASCADE;
--
-- Name: category_metadata categories_category_metadata_canonical_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_metadata
ADD CONSTRAINT categories_category_metadata_canonical_fk FOREIGN KEY (canonical) REFERENCES public.categories(id) ON UPDATE CASCADE ON DELETE
SET NULL;
--
-- Name: category_metadata categories_category_metadata_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_metadata
ADD CONSTRAINT categories_category_metadata_fk FOREIGN KEY (category_id) REFERENCES public.categories(id) ON DELETE CASCADE;
--
-- Name: article_article_categories category_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_article_categories
ADD CONSTRAINT category_id FOREIGN KEY (category_id) REFERENCES public.article_categories(id);
--
-- Name: category_keyword category_keyword_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_keyword
ADD CONSTRAINT category_keyword_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.categories(id);
--
-- Name: category_keyword category_keyword_keyword_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_keyword
ADD CONSTRAINT category_keyword_keyword_id_fkey FOREIGN KEY (keyword_id) REFERENCES public.keywords(id);
--
-- Name: category_texts category_texts_locale_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_texts
ADD CONSTRAINT category_texts_locale_id_fkey FOREIGN KEY (locale_id) REFERENCES public.locales(id);
--
-- Name: category_texts category_texts_locale_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.category_texts
ADD CONSTRAINT category_texts_locale_id_fkey1 FOREIGN KEY (locale_id) REFERENCES public.locales(id);
--
-- Name: categorydata categorydata_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categorydata
ADD CONSTRAINT categorydata_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.categories(id);
--
-- Name: categorydata categorydata_datakey_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categorydata
ADD CONSTRAINT categorydata_datakey_id_fkey FOREIGN KEY (datakey_id) REFERENCES public.categorydatakeys(id);
--
-- Name: categorydata categorydata_locale_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categorydata
ADD CONSTRAINT categorydata_locale_id_fkey FOREIGN KEY (locale_id) REFERENCES public.locales(id);
--
-- Name: collections_products collection_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_products
ADD CONSTRAINT collection_fkey FOREIGN KEY (collection_id) REFERENCES public.collections(id);
--
-- Name: collections_texts collection_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_texts
ADD CONSTRAINT collection_fkey FOREIGN KEY (collection_id) REFERENCES public.collections(id);
--
-- Name: collections_blacklist collection_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_blacklist
ADD CONSTRAINT collection_fkey FOREIGN KEY (collection_id) REFERENCES public.collections(id);
--
-- Name: addresses country_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.addresses
ADD CONSTRAINT country_code_fkey FOREIGN KEY (country_code) REFERENCES public."i18n-territories"(iso2char);
--
-- Name: markets currency_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.markets
ADD CONSTRAINT currency_fkey FOREIGN KEY (currency) REFERENCES public."product-currencies"(iso3char);
--
-- Name: stock-items_data dataFieldIdToFieldIds; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items_data"
ADD CONSTRAINT "dataFieldIdToFieldIds" FOREIGN KEY (fieldid) REFERENCES public."stock-items_data_fields"(fieldid) ON DELETE RESTRICT;
--
-- Name: stock-items_data dataitemidAnditemId; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-items_data"
ADD CONSTRAINT "dataitemidAnditemId" FOREIGN KEY (itemid) REFERENCES public."stock-items"(itemid) ON DELETE RESTRICT;
--
-- Name: delivery-methods_prices delivery-methods_prices_territory_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."delivery-methods_prices"
ADD CONSTRAINT "delivery-methods_prices_territory_fkey" FOREIGN KEY (territory) REFERENCES public."i18n-territories"(iso2char) ON DELETE RESTRICT;
--
-- Name: orders delivery_address_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.orders
ADD CONSTRAINT delivery_address_fkey FOREIGN KEY (delivery_address_id) REFERENCES public.addresses(id);
--
-- Name: categories design_wallpaper_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT design_wallpaper_image_fk FOREIGN KEY (design_wallpaper_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: designer_texts designer_texts_designerid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designer_texts
ADD CONSTRAINT designer_texts_designerid_fkey FOREIGN KEY (designerid) REFERENCES public.designers(designerid) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: designer_texts designer_texts_locale_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designer_texts
ADD CONSTRAINT designer_texts_locale_id_fkey FOREIGN KEY (locale_id) REFERENCES public.locales(id) ON UPDATE CASCADE;
--
-- Name: designers-blocked designers-blocked_designerid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."designers-blocked"
ADD CONSTRAINT "designers-blocked_designerid_fkey" FOREIGN KEY (designerid) REFERENCES public.designers(designerid);
--
-- Name: discount_code_filters discount_filters_discountcodeid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.discount_code_filters
ADD CONSTRAINT discount_filters_discountcodeid_fkey FOREIGN KEY (discount_code_id) REFERENCES public.discount_codes(discountid);
--
-- Name: locales fallback_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.locales
ADD CONSTRAINT fallback_locale_fkey FOREIGN KEY (fallback_id) REFERENCES public.locales(id);
--
-- Name: stock-stock_data fildidtostockfieldid; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock_data"
ADD CONSTRAINT fildidtostockfieldid FOREIGN KEY (fieldid) REFERENCES public."stock-stock_data_fields"(fieldid) ON DELETE RESTRICT;
--
-- Name: designers framed_print_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers
ADD CONSTRAINT framed_print_image_fk FOREIGN KEY (framed_print_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: collections framed_print_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections
ADD CONSTRAINT framed_print_image_fk FOREIGN KEY (framed_print_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: categories framed_print_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT framed_print_image_fk FOREIGN KEY (framed_print_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: i18n-currencies_names i18n-currencies_names_currency_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-currencies_names"
ADD CONSTRAINT "i18n-currencies_names_currency_fkey" FOREIGN KEY (currency) REFERENCES public."i18n-currencies"(iso3char) ON DELETE RESTRICT;
--
-- Name: i18n-currencies_names i18n-currencies_names_language_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-currencies_names"
ADD CONSTRAINT "i18n-currencies_names_language_fkey" FOREIGN KEY (language) REFERENCES public."i18n-languages"(iso3char) ON DELETE RESTRICT;
--
-- Name: i18n-currencies_territories i18n-currencies_territories_currency_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-currencies_territories"
ADD CONSTRAINT "i18n-currencies_territories_currency_fkey" FOREIGN KEY (currency) REFERENCES public."i18n-currencies"(iso3char) ON DELETE RESTRICT;
--
-- Name: i18n-currencies_territories i18n-currencies_territories_territory_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-currencies_territories"
ADD CONSTRAINT "i18n-currencies_territories_territory_fkey" FOREIGN KEY (territory) REFERENCES public."i18n-territories"(iso2char) ON DELETE RESTRICT;
--
-- Name: i18n-languages_names i18n-languages_names_iso3char_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-languages_names"
ADD CONSTRAINT "i18n-languages_names_iso3char_fkey" FOREIGN KEY (iso3char) REFERENCES public."i18n-languages"(iso3char) ON DELETE RESTRICT;
--
-- Name: i18n-languages_names i18n-languages_names_language_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-languages_names"
ADD CONSTRAINT "i18n-languages_names_language_fkey" FOREIGN KEY (language) REFERENCES public."i18n-languages"(iso3char) ON DELETE RESTRICT;
--
-- Name: i18n-languages_territories i18n-languages_territories_language_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-languages_territories"
ADD CONSTRAINT "i18n-languages_territories_language_fkey" FOREIGN KEY (language) REFERENCES public."i18n-languages"(iso3char) ON DELETE RESTRICT;
--
-- Name: i18n-languages_territories i18n-languages_territories_territory_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-languages_territories"
ADD CONSTRAINT "i18n-languages_territories_territory_fkey" FOREIGN KEY (territory) REFERENCES public."i18n-territories"(iso2char) ON DELETE RESTRICT;
--
-- Name: i18n-territories_names i18n-territories_names_iso2char_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-territories_names"
ADD CONSTRAINT "i18n-territories_names_iso2char_fkey" FOREIGN KEY (territory) REFERENCES public."i18n-territories"(iso2char) ON DELETE RESTRICT;
--
-- Name: i18n-territories_names i18n-territories_names_language_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-territories_names"
ADD CONSTRAINT "i18n-territories_names_language_fkey" FOREIGN KEY (language) REFERENCES public."i18n-languages"(iso3char) ON DELETE RESTRICT;
--
-- Name: i18n-texts_data i18n-texts_data_textid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-texts_data"
ADD CONSTRAINT "i18n-texts_data_textid_fkey" FOREIGN KEY (textid) REFERENCES public."i18n-texts"(textid) ON DELETE RESTRICT;
--
-- Name: inquiries inquiries_materialid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiries
ADD CONSTRAINT inquiries_materialid_fkey FOREIGN KEY (materialid) REFERENCES public."product-materials"(materialid) ON DELETE RESTRICT;
--
-- Name: inquiry_markers inquiry_markers_inquiry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiry_markers
ADD CONSTRAINT inquiry_markers_inquiry_id_fkey FOREIGN KEY (inquiry_id) REFERENCES public.inquiries(inquiryid);
--
-- Name: inquiry_messages inquiry_messages_inquiry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiry_messages
ADD CONSTRAINT inquiry_messages_inquiry_id_fkey FOREIGN KEY (inquiry_id) REFERENCES public.inquiries(inquiryid);
--
-- Name: inquiry_messages inquiry_messages_material_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiry_messages
ADD CONSTRAINT inquiry_messages_material_id_fkey FOREIGN KEY (material_id) REFERENCES public."product-materials"(materialid);
--
-- Name: interiors interiors_print_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.interiors
ADD CONSTRAINT interiors_print_id_fkey FOREIGN KEY (print_id) REFERENCES public."product-printproducts"(printid) ON DELETE CASCADE;
--
-- Name: interiors interiors_room_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.interiors
ADD CONSTRAINT interiors_room_id_fkey FOREIGN KEY (room_id) REFERENCES public.rooms(id) ON DELETE RESTRICT;
--
-- Name: keywords_i18n keyword_trans_norm_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keywords_i18n
ADD CONSTRAINT keyword_trans_norm_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.keywords(id);
--
-- Name: keyword_type keyword_type_keyword_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keyword_type
ADD CONSTRAINT keyword_type_keyword_id_fkey FOREIGN KEY (keyword_id) REFERENCES public.keywords(id);
--
-- Name: keyword_type keyword_type_keywordtype_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.keyword_type
ADD CONSTRAINT keyword_type_keywordtype_id_fkey FOREIGN KEY (type_id) REFERENCES public.keywordtypes(id);
--
-- Name: market_locales locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.market_locales
ADD CONSTRAINT locale_fkey FOREIGN KEY (locale_id) REFERENCES public.locales(id);
--
-- Name: i18n-texts_data locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."i18n-texts_data"
ADD CONSTRAINT locale_fkey FOREIGN KEY (locale_id) REFERENCES public.locales(id);
--
-- Name: inquiries locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiries
ADD CONSTRAINT locale_fkey FOREIGN KEY (locale_id) REFERENCES public.locales(id);
--
-- Name: collections_texts locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_texts
ADD CONSTRAINT locale_fkey FOREIGN KEY (locale_id) REFERENCES public.locales(id);
--
-- Name: market_locales market_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.market_locales
ADD CONSTRAINT market_fkey FOREIGN KEY (market_id) REFERENCES public.markets(id);
--
-- Name: product_blacklist market_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_blacklist
ADD CONSTRAINT market_fkey FOREIGN KEY (market_id) REFERENCES public.markets(id);
--
-- Name: inquiries market_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.inquiries
ADD CONSTRAINT market_fkey FOREIGN KEY (market_id) REFERENCES public.markets(id);
--
-- Name: collections_blacklist market_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_blacklist
ADD CONSTRAINT market_fkey FOREIGN KEY (market_id) REFERENCES public.markets(id);
--
-- Name: redirects market_locale_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.redirects
ADD CONSTRAINT market_locale_id_fkey FOREIGN KEY (market_locale_id) REFERENCES public.market_locales(id);
--
-- Name: article_content market_locales_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.article_content
ADD CONSTRAINT market_locales_fkey FOREIGN KEY (market_locale_id) REFERENCES public.market_locales(id);
--
-- Name: samples material_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.samples
ADD CONSTRAINT material_fkey FOREIGN KEY (material_id) REFERENCES public."product-materials"(materialid);
--
-- Name: order-orders_fields order-orders_fields_fieldid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-orders_fields"
ADD CONSTRAINT "order-orders_fields_fieldid_fkey" FOREIGN KEY (fieldid) REFERENCES public."order-fields"(fieldid) ON DELETE RESTRICT;
--
-- Name: order-orders_fields order-orders_fields_orderid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-orders_fields"
ADD CONSTRAINT "order-orders_fields_orderid_fkey" FOREIGN KEY (orderid) REFERENCES public."order-orders"(orderid) ON DELETE RESTRICT;
--
-- Name: order-rows_details order-rows_details_fieldid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-rows_details"
ADD CONSTRAINT "order-rows_details_fieldid_fkey" FOREIGN KEY (fieldid) REFERENCES public."order-row_fields"(fieldid) ON DELETE RESTRICT;
--
-- Name: order-rows_details order-rows_details_rowid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-rows_details"
ADD CONSTRAINT "order-rows_details_rowid_fkey" FOREIGN KEY (rowid) REFERENCES public."order-rows"(rowid) ON DELETE RESTRICT;
--
-- Name: order-rows order-rows_orderid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."order-rows"
ADD CONSTRAINT "order-rows_orderid_fkey" FOREIGN KEY (orderid) REFERENCES public."order-orders"(orderid) ON DELETE RESTRICT;
--
-- Name: invoices order_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.invoices
ADD CONSTRAINT order_fk FOREIGN KEY (order_id) REFERENCES public."order-orders"(orderid);
--
-- Name: order_rows order_rows_designer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.order_rows
ADD CONSTRAINT order_rows_designer_id_fkey FOREIGN KEY (designer_id) REFERENCES public.designers(designerid);
--
-- Name: order_rows order_rows_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.order_rows
ADD CONSTRAINT order_rows_order_id_fkey FOREIGN KEY (order_id) REFERENCES public.orders(id);
--
-- Name: categories photo_wallpaper_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT photo_wallpaper_image_fk FOREIGN KEY (photo_wallpaper_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: designers poster_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers
ADD CONSTRAINT poster_image_fk FOREIGN KEY (poster_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: collections poster_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections
ADD CONSTRAINT poster_image_fk FOREIGN KEY (poster_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: categories poster_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT poster_image_fk FOREIGN KEY (poster_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: product-printprices product-printprices_groupid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printprices"
ADD CONSTRAINT "product-printprices_groupid_fkey" FOREIGN KEY (groupid) REFERENCES public."product-groups"(groupid) ON DELETE RESTRICT;
--
-- Name: product-printprices product-printprices_materialid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printprices"
ADD CONSTRAINT "product-printprices_materialid_fkey" FOREIGN KEY (materialid) REFERENCES public."product-materials"(materialid) ON DELETE RESTRICT;
--
-- Name: product-printproducts product-printproducts_groupid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts"
ADD CONSTRAINT "product-printproducts_groupid_fkey" FOREIGN KEY (groupid) REFERENCES public."product-groups"(groupid) ON DELETE RESTRICT;
--
-- Name: product-printproducts_materials product-printproducts_materials_materialid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts_materials"
ADD CONSTRAINT "product-printproducts_materials_materialid_fkey" FOREIGN KEY (materialid) REFERENCES public."product-materials"(materialid) ON DELETE RESTRICT;
--
-- Name: product-printproducts_materials product-printproducts_materials_printid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts_materials"
ADD CONSTRAINT "product-printproducts_materials_printid_fkey" FOREIGN KEY (printid) REFERENCES public."product-printproducts"(printid) ON DELETE RESTRICT;
--
-- Name: product-printproducts product-printproducts_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts"
ADD CONSTRAINT "product-printproducts_productid_fkey" FOREIGN KEY (productid) REFERENCES public."product-products"(productid) ON DELETE RESTRICT;
--
-- Name: product-printproducts product-printproducts_typeid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-printproducts"
ADD CONSTRAINT "product-printproducts_typeid_fkey" FOREIGN KEY (typeid) REFERENCES public."product-types"(typeid) ON DELETE RESTRICT;
--
-- Name: product-products product-products_designerid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products"
ADD CONSTRAINT "product-products_designerid_fkey" FOREIGN KEY (designerid) REFERENCES public.designers(designerid) ON DELETE RESTRICT;
--
-- Name: product-products_fields product-products_fields_fieldid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products_fields"
ADD CONSTRAINT "product-products_fields_fieldid_fkey" FOREIGN KEY (fieldid) REFERENCES public."product-fields"(fieldid) ON DELETE RESTRICT;
--
-- Name: product-products_fields product-products_fields_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products_fields"
ADD CONSTRAINT "product-products_fields_productid_fkey" FOREIGN KEY (productid) REFERENCES public."product-products"(productid) ON DELETE RESTRICT;
--
-- Name: product_wallpapertypes product-products_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_wallpapertypes
ADD CONSTRAINT "product-products_productid_fkey" FOREIGN KEY (product_id) REFERENCES public."product-products"(productid) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- Name: product-products_products product-products_products_productid1_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products_products"
ADD CONSTRAINT "product-products_products_productid1_fkey" FOREIGN KEY (productid1) REFERENCES public."product-products"(productid) ON DELETE RESTRICT;
--
-- Name: product-products_products product-products_products_productid2_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-products_products"
ADD CONSTRAINT "product-products_products_productid2_fkey" FOREIGN KEY (productid2) REFERENCES public."product-products"(productid) ON DELETE RESTRICT;
--
-- Name: product-stockproducts product-stockproducts_priceid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-stockproducts"
ADD CONSTRAINT "product-stockproducts_priceid_fkey" FOREIGN KEY (priceid) REFERENCES public."product-stockprices"(priceid) ON DELETE RESTRICT;
--
-- Name: product-stockproducts product-stockproducts_productid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."product-stockproducts"
ADD CONSTRAINT "product-stockproducts_productid_fkey" FOREIGN KEY (productid) REFERENCES public."product-products"(productid) ON DELETE RESTRICT;
--
-- Name: product_blacklist product_blacklist_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_blacklist
ADD CONSTRAINT product_blacklist_group_id_fkey FOREIGN KEY (group_id) REFERENCES public."product-groups"(groupid);
--
-- Name: product_blacklist product_blacklist_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_blacklist
ADD CONSTRAINT product_blacklist_product_id_fkey FOREIGN KEY (product_id) REFERENCES public."product-products"(productid);
--
-- Name: product_category product_category_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_category
ADD CONSTRAINT product_category_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.categories(id);
--
-- Name: product_category product_category_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_category
ADD CONSTRAINT product_category_product_id_fkey FOREIGN KEY (product_id) REFERENCES public."product-products"(productid);
--
-- Name: product_keyword product_keyword_keyword_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_keyword
ADD CONSTRAINT product_keyword_keyword_id_fkey FOREIGN KEY (keyword_id) REFERENCES public.keywords(id);
--
-- Name: product_keyword product_keyword_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_keyword
ADD CONSTRAINT product_keyword_product_id_fkey FOREIGN KEY (product_id) REFERENCES public."product-products"(productid);
--
-- Name: collections_products products_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections_products
ADD CONSTRAINT products_fkey FOREIGN KEY (product_id) REFERENCES public."product-products"(productid);
--
-- Name: rooms room_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.rooms
ADD CONSTRAINT room_type_id_fkey FOREIGN KEY (room_type_id) REFERENCES public.room_types(id);
--
-- Name: samples samples_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.samples
ADD CONSTRAINT samples_order_id_fkey FOREIGN KEY (order_id) REFERENCES public.orders(id);
--
-- Name: samples samples_order_row_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.samples
ADD CONSTRAINT samples_order_row_id_fkey FOREIGN KEY (order_row_id) REFERENCES public.order_rows(id);
--
-- Name: slideshow_slides slideshow_slides_market_locale_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.slideshow_slides
ADD CONSTRAINT slideshow_slides_market_locale_id_fkey FOREIGN KEY (market_locale_id) REFERENCES public.market_locales(id);
--
-- Name: stock-stock stock-stock_itemid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock"
ADD CONSTRAINT "stock-stock_itemid_fkey" FOREIGN KEY (itemid) REFERENCES public."stock-items"(itemid) ON DELETE RESTRICT;
--
-- Name: stock-stock stock-stock_placeid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock"
ADD CONSTRAINT "stock-stock_placeid_fkey" FOREIGN KEY (placeid) REFERENCES public."stock-places"(placeid) ON DELETE RESTRICT;
--
-- Name: stock-stock_data stockidtostockstockid; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."stock-stock_data"
ADD CONSTRAINT stockidtostockstockid FOREIGN KEY (stockid) REFERENCES public."stock-stock"(stockid) ON DELETE RESTRICT;
--
-- Name: flyers territory_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.flyers
ADD CONSTRAINT territory_fkey FOREIGN KEY (territory) REFERENCES public."i18n-territories"(iso2char);
--
-- Name: designers wallpaper_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.designers
ADD CONSTRAINT wallpaper_image_fk FOREIGN KEY (wallpaper_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: collections wallpaper_image_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.collections
ADD CONSTRAINT wallpaper_image_fk FOREIGN KEY (wallpaper_image_id) REFERENCES public.teaser_images(id) ON DELETE
SET NULL;
--
-- Name: product_wallpapertypes wallpapertypes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.product_wallpapertypes
ADD CONSTRAINT wallpapertypes_id_fkey FOREIGN KEY (wallpapertype_id) REFERENCES public.wallpapertypes(id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--