franta-hg@0: -- franta-hg@0: -- PostgreSQL database dump franta-hg@0: -- franta-hg@0: franta-hg@0: -- Started on 2009-04-28 21:06:29 CEST franta-hg@0: franta-hg@0: SET client_encoding = 'UTF8'; franta-hg@0: SET standard_conforming_strings = off; franta-hg@0: SET check_function_bodies = false; franta-hg@0: SET client_min_messages = warning; franta-hg@0: SET escape_string_warning = off; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 6 (class 2615 OID 16386) franta-hg@0: -- Name: miniobchod; Type: SCHEMA; Schema: -; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE SCHEMA miniobchod; franta-hg@0: franta-hg@0: franta-hg@0: ALTER SCHEMA miniobchod OWNER TO miniobchod; franta-hg@0: franta-hg@0: SET search_path = miniobchod, pg_catalog; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 332 (class 1247 OID 16398) franta-hg@0: -- Dependencies: 333 6 franta-hg@0: -- Name: email; Type: DOMAIN; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE DOMAIN email AS character varying(255) NOT NULL franta-hg@0: CONSTRAINT email_regexp CHECK (((VALUE)::text ~ '^[_a-zA-Z0-9\\.\\-]+@[_a-zA-Z0-9\\.\\-]+\\.[a-zA-Z]{2,4}$'::text)); franta-hg@0: franta-hg@0: franta-hg@0: ALTER DOMAIN miniobchod.email OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1821 (class 0 OID 0) franta-hg@0: -- Dependencies: 332 franta-hg@0: -- Name: DOMAIN email; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON DOMAIN email IS 'e-mailová adresa'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 344 (class 1247 OID 16566) franta-hg@0: -- Dependencies: 345 6 franta-hg@0: -- Name: psc; Type: DOMAIN; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE DOMAIN psc AS character varying(255) NOT NULL franta-hg@0: CONSTRAINT psc_regexp CHECK (((VALUE)::text ~ '^\\d{3} ?\\d{2}$'::text)); franta-hg@0: franta-hg@0: franta-hg@0: ALTER DOMAIN miniobchod.psc OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1822 (class 0 OID 0) franta-hg@0: -- Dependencies: 344 franta-hg@0: -- Name: DOMAIN psc; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON DOMAIN psc IS 'Poštovní směrovací číslo'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 55 (class 1255 OID 16459) franta-hg@0: -- Dependencies: 6 franta-hg@0: -- Name: nahodne_heslo(); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE FUNCTION nahodne_heslo() RETURNS character franta-hg@0: AS $$select sha512(random()::text || random()::text || random()::text);$$ franta-hg@0: LANGUAGE sql; franta-hg@0: franta-hg@0: franta-hg@0: ALTER FUNCTION miniobchod.nahodne_heslo() OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 56 (class 1255 OID 16460) franta-hg@0: -- Dependencies: 6 franta-hg@0: -- Name: sha1(text); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE FUNCTION sha1(text) RETURNS text franta-hg@0: AS $_$ franta-hg@0: SELECT encode(digest(decode($1,'escape'::text),'sha1'::text),'hex'); franta-hg@0: $_$ franta-hg@0: LANGUAGE sql IMMUTABLE STRICT; franta-hg@0: franta-hg@0: franta-hg@0: ALTER FUNCTION miniobchod.sha1(text) OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 57 (class 1255 OID 16461) franta-hg@0: -- Dependencies: 6 franta-hg@0: -- Name: sha256(text); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE FUNCTION sha256(text) RETURNS text franta-hg@0: AS $_$ franta-hg@0: SELECT encode(digest(decode($1,'escape'::text),'sha256'::text),'hex'); franta-hg@0: $_$ franta-hg@0: LANGUAGE sql IMMUTABLE STRICT; franta-hg@0: franta-hg@0: franta-hg@0: ALTER FUNCTION miniobchod.sha256(text) OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 54 (class 1255 OID 16458) franta-hg@0: -- Dependencies: 6 franta-hg@0: -- Name: sha512(text); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE FUNCTION sha512(text) RETURNS text franta-hg@0: AS $_$ franta-hg@0: SELECT encode(digest(decode($1,'escape'::text),'sha512'::text),'hex'); franta-hg@0: $_$ franta-hg@0: LANGUAGE sql IMMUTABLE STRICT; franta-hg@0: franta-hg@0: franta-hg@0: ALTER FUNCTION miniobchod.sha512(text) OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 58 (class 1255 OID 16608) franta-hg@0: -- Dependencies: 350 6 franta-hg@0: -- Name: vyjimka(character varying); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE FUNCTION vyjimka(chyba character varying) RETURNS void franta-hg@0: AS $$BEGIN franta-hg@0: RAISE EXCEPTION '%', chyba; franta-hg@0: END;$$ franta-hg@0: LANGUAGE plpgsql; franta-hg@0: franta-hg@0: franta-hg@0: ALTER FUNCTION miniobchod.vyjimka(chyba character varying) OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1823 (class 0 OID 0) franta-hg@0: -- Dependencies: 58 franta-hg@0: -- Name: FUNCTION vyjimka(chyba character varying); Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON FUNCTION vyjimka(chyba character varying) IS 'Vyhodí výjimku'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1528 (class 1259 OID 16575) franta-hg@0: -- Dependencies: 6 franta-hg@0: -- Name: adresa_seq; Type: SEQUENCE; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE SEQUENCE adresa_seq franta-hg@0: INCREMENT BY 1 franta-hg@0: NO MAXVALUE franta-hg@0: NO MINVALUE franta-hg@0: CACHE 1; franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.adresa_seq OWNER TO miniobchod; franta-hg@0: franta-hg@0: SET default_tablespace = ''; franta-hg@0: franta-hg@0: SET default_with_oids = false; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1529 (class 1259 OID 16578) franta-hg@0: -- Dependencies: 1804 332 344 6 franta-hg@0: -- Name: adresa; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE TABLE adresa ( franta-hg@0: id bigint DEFAULT nextval('adresa_seq'::regclass) NOT NULL, franta-hg@0: uzivatel email, franta-hg@0: jmeno character varying(255), franta-hg@0: ulice character varying(255), franta-hg@0: cp smallint, franta-hg@0: mesto character varying(255), franta-hg@0: psc psc franta-hg@0: ); franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.adresa OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1824 (class 0 OID 0) franta-hg@0: -- Dependencies: 1529 franta-hg@0: -- Name: TABLE adresa; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON TABLE adresa IS 'Poštovní adresa'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1825 (class 0 OID 0) franta-hg@0: -- Dependencies: 1529 franta-hg@0: -- Name: COLUMN adresa.jmeno; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN adresa.jmeno IS 'Jméno příjemce'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1826 (class 0 OID 0) franta-hg@0: -- Dependencies: 1529 franta-hg@0: -- Name: COLUMN adresa.cp; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN adresa.cp IS 'Číslo popisné'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1827 (class 0 OID 0) franta-hg@0: -- Dependencies: 1529 franta-hg@0: -- Name: COLUMN adresa.psc; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN adresa.psc IS 'Poštovní směrovací číslo'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1527 (class 1259 OID 16540) franta-hg@0: -- Dependencies: 1803 6 franta-hg@0: -- Name: objednane_zbozi; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE TABLE objednane_zbozi ( franta-hg@0: objednavka bigint NOT NULL, franta-hg@0: zbozi bit varying NOT NULL, franta-hg@0: mnozstvi smallint DEFAULT 1 NOT NULL franta-hg@0: ); franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.objednane_zbozi OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1828 (class 0 OID 0) franta-hg@0: -- Dependencies: 1527 franta-hg@0: -- Name: TABLE objednane_zbozi; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON TABLE objednane_zbozi IS 'Vazební tabulka, která definuje obsah objednávky – objednané zboží'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1525 (class 1259 OID 16408) franta-hg@0: -- Dependencies: 6 franta-hg@0: -- Name: objednavka_seq; Type: SEQUENCE; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE SEQUENCE objednavka_seq franta-hg@0: INCREMENT BY 1 franta-hg@0: NO MAXVALUE franta-hg@0: NO MINVALUE franta-hg@0: CACHE 1; franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.objednavka_seq OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1526 (class 1259 OID 16410) franta-hg@0: -- Dependencies: 1800 1801 1802 6 332 franta-hg@0: -- Name: objednavka; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE TABLE objednavka ( franta-hg@0: id bigint DEFAULT nextval('objednavka_seq'::regclass) NOT NULL, franta-hg@0: kod character varying DEFAULT nahodne_heslo() NOT NULL, franta-hg@0: uzivatel email, franta-hg@0: podano timestamp with time zone DEFAULT now() NOT NULL, franta-hg@0: adresa bigint franta-hg@0: ); franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.objednavka OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1829 (class 0 OID 0) franta-hg@0: -- Dependencies: 1526 franta-hg@0: -- Name: TABLE objednavka; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON TABLE objednavka IS 'Objednávka zboží'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1830 (class 0 OID 0) franta-hg@0: -- Dependencies: 1526 franta-hg@0: -- Name: COLUMN objednavka.id; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN objednavka.id IS 'Číslo objednávky je zároveň variabilním symbolem'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1831 (class 0 OID 0) franta-hg@0: -- Dependencies: 1526 franta-hg@0: -- Name: COLUMN objednavka.kod; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN objednavka.kod IS 'Potvrzovací kód – pošle se zákazníkovi e-mailem a ten pomocí něj objednávku potvrdí.'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1832 (class 0 OID 0) franta-hg@0: -- Dependencies: 1526 franta-hg@0: -- Name: COLUMN objednavka.uzivatel; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN objednavka.uzivatel IS 'Kdo si objednal'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1833 (class 0 OID 0) franta-hg@0: -- Dependencies: 1526 franta-hg@0: -- Name: COLUMN objednavka.podano; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN objednavka.podano IS 'Datum a čas podání objednávky'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1834 (class 0 OID 0) franta-hg@0: -- Dependencies: 1526 franta-hg@0: -- Name: COLUMN objednavka.adresa; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN objednavka.adresa IS 'Kam se má objednávka doručit'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1524 (class 1259 OID 16400) franta-hg@0: -- Dependencies: 1798 1799 6 332 franta-hg@0: -- Name: uzivatel; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE TABLE uzivatel ( franta-hg@0: email email NOT NULL, franta-hg@0: heslo character varying DEFAULT nahodne_heslo() NOT NULL, franta-hg@0: zalozen timestamp with time zone DEFAULT now() franta-hg@0: ); franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.uzivatel OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1835 (class 0 OID 0) franta-hg@0: -- Dependencies: 1524 franta-hg@0: -- Name: TABLE uzivatel; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON TABLE uzivatel IS 'Zákazník'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1836 (class 0 OID 0) franta-hg@0: -- Dependencies: 1524 franta-hg@0: -- Name: COLUMN uzivatel.email; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN uzivatel.email IS 'Uživatel je identifikovaný pomocí své e-mailové adresy'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1837 (class 0 OID 0) franta-hg@0: -- Dependencies: 1524 franta-hg@0: -- Name: COLUMN uzivatel.heslo; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN uzivatel.heslo IS 'Vygenerované heslo, kterým se uživatel prokazuje (pošle se mu na e-mail)'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1838 (class 0 OID 0) franta-hg@0: -- Dependencies: 1524 franta-hg@0: -- Name: COLUMN uzivatel.zalozen; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN uzivatel.zalozen IS 'Datum a čas registrace zákazníka'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1522 (class 1259 OID 16387) franta-hg@0: -- Dependencies: 6 franta-hg@0: -- Name: zbozi_seq; Type: SEQUENCE; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE SEQUENCE zbozi_seq franta-hg@0: INCREMENT BY 1 franta-hg@0: NO MAXVALUE franta-hg@0: NO MINVALUE franta-hg@0: CACHE 1; franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.zbozi_seq OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1523 (class 1259 OID 16389) franta-hg@0: -- Dependencies: 1797 6 franta-hg@0: -- Name: zbozi; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE TABLE zbozi ( franta-hg@0: id bigint DEFAULT nextval('zbozi_seq'::regclass) NOT NULL, franta-hg@0: nazev character varying(255), franta-hg@0: popis text franta-hg@0: ); franta-hg@0: franta-hg@0: franta-hg@0: ALTER TABLE miniobchod.zbozi OWNER TO miniobchod; franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1839 (class 0 OID 0) franta-hg@0: -- Dependencies: 1523 franta-hg@0: -- Name: TABLE zbozi; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON TABLE zbozi IS 'Položka katalogu'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1840 (class 0 OID 0) franta-hg@0: -- Dependencies: 1523 franta-hg@0: -- Name: COLUMN zbozi.id; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN zbozi.id IS 'Číslo zboží'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1841 (class 0 OID 0) franta-hg@0: -- Dependencies: 1523 franta-hg@0: -- Name: COLUMN zbozi.nazev; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN zbozi.nazev IS 'Název zboží'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1842 (class 0 OID 0) franta-hg@0: -- Dependencies: 1523 franta-hg@0: -- Name: COLUMN zbozi.popis; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON COLUMN zbozi.popis IS 'Popis zboží'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1815 (class 2606 OID 16586) franta-hg@0: -- Dependencies: 1529 1529 franta-hg@0: -- Name: adresa_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY adresa franta-hg@0: ADD CONSTRAINT adresa_pk PRIMARY KEY (id); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1813 (class 2606 OID 16548) franta-hg@0: -- Dependencies: 1527 1527 1527 franta-hg@0: -- Name: objednane_zbozi_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY objednane_zbozi franta-hg@0: ADD CONSTRAINT objednane_zbozi_pk PRIMARY KEY (objednavka, zbozi); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1811 (class 2606 OID 16415) franta-hg@0: -- Dependencies: 1526 1526 franta-hg@0: -- Name: objednavka_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY objednavka franta-hg@0: ADD CONSTRAINT objednavka_pk PRIMARY KEY (id); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1808 (class 2606 OID 16407) franta-hg@0: -- Dependencies: 1524 1524 franta-hg@0: -- Name: uzivatel_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY uzivatel franta-hg@0: ADD CONSTRAINT uzivatel_pk PRIMARY KEY (email); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1806 (class 2606 OID 16397) franta-hg@0: -- Dependencies: 1523 1523 franta-hg@0: -- Name: zbozi_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY zbozi franta-hg@0: ADD CONSTRAINT zbozi_pk PRIMARY KEY (id); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1809 (class 1259 OID 16597) franta-hg@0: -- Dependencies: 1526 franta-hg@0: -- Name: fki_objednavka_adresa_fk; Type: INDEX; Schema: miniobchod; Owner: miniobchod; Tablespace: franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE INDEX fki_objednavka_adresa_fk ON objednavka USING btree (adresa); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1605 (class 2618 OID 16598) franta-hg@0: -- Dependencies: 1526 1529 1526 58 1526 1526 1526 1529 franta-hg@0: -- Name: objednavka_adresa_uzivatel; Type: RULE; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: CREATE RULE objednavka_adresa_uzivatel AS ON INSERT TO objednavka WHERE ((new.uzivatel)::text <> ((SELECT adresa.uzivatel FROM adresa WHERE (adresa.id = new.adresa)))::text) DO SELECT vyjimka('Uživatel může objednat zboží jen na svoji adresu'::character varying) AS vyjimka; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1843 (class 0 OID 0) franta-hg@0: -- Dependencies: 1605 franta-hg@0: -- Name: RULE objednavka_adresa_uzivatel ON objednavka; Type: COMMENT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: COMMENT ON RULE objednavka_adresa_uzivatel ON objednavka IS 'Uživatel může objednat zboží jen na svoji adresu'; franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1818 (class 2606 OID 16587) franta-hg@0: -- Dependencies: 1807 1529 1524 franta-hg@0: -- Name: adresa_uzivatel_fk; Type: FK CONSTRAINT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY adresa franta-hg@0: ADD CONSTRAINT adresa_uzivatel_fk FOREIGN KEY (uzivatel) REFERENCES uzivatel(email); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1817 (class 2606 OID 16592) franta-hg@0: -- Dependencies: 1814 1529 1526 franta-hg@0: -- Name: objednavka_adresa_fk; Type: FK CONSTRAINT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY objednavka franta-hg@0: ADD CONSTRAINT objednavka_adresa_fk FOREIGN KEY (adresa) REFERENCES adresa(id); franta-hg@0: franta-hg@0: franta-hg@0: -- franta-hg@0: -- TOC entry 1816 (class 2606 OID 16493) franta-hg@0: -- Dependencies: 1807 1524 1526 franta-hg@0: -- Name: objednavka_uzivatel_fk; Type: FK CONSTRAINT; Schema: miniobchod; Owner: miniobchod franta-hg@0: -- franta-hg@0: franta-hg@0: ALTER TABLE ONLY objednavka franta-hg@0: ADD CONSTRAINT objednavka_uzivatel_fk FOREIGN KEY (uzivatel) REFERENCES uzivatel(email); franta-hg@0: franta-hg@0: franta-hg@0: -- Completed on 2009-04-28 21:06:38 CEST franta-hg@0: franta-hg@0: -- franta-hg@0: -- PostgreSQL database dump complete franta-hg@0: -- franta-hg@0: