franta-hg@0
|
1 |
--
|
franta-hg@0
|
2 |
-- PostgreSQL database dump
|
franta-hg@0
|
3 |
--
|
franta-hg@0
|
4 |
|
franta-hg@0
|
5 |
-- Started on 2009-04-28 21:06:29 CEST
|
franta-hg@0
|
6 |
|
franta-hg@0
|
7 |
SET client_encoding = 'UTF8';
|
franta-hg@0
|
8 |
SET standard_conforming_strings = off;
|
franta-hg@0
|
9 |
SET check_function_bodies = false;
|
franta-hg@0
|
10 |
SET client_min_messages = warning;
|
franta-hg@0
|
11 |
SET escape_string_warning = off;
|
franta-hg@0
|
12 |
|
franta-hg@0
|
13 |
--
|
franta-hg@0
|
14 |
-- TOC entry 6 (class 2615 OID 16386)
|
franta-hg@0
|
15 |
-- Name: miniobchod; Type: SCHEMA; Schema: -; Owner: miniobchod
|
franta-hg@0
|
16 |
--
|
franta-hg@0
|
17 |
|
franta-hg@0
|
18 |
CREATE SCHEMA miniobchod;
|
franta-hg@0
|
19 |
|
franta-hg@0
|
20 |
|
franta-hg@0
|
21 |
ALTER SCHEMA miniobchod OWNER TO miniobchod;
|
franta-hg@0
|
22 |
|
franta-hg@0
|
23 |
SET search_path = miniobchod, pg_catalog;
|
franta-hg@0
|
24 |
|
franta-hg@0
|
25 |
--
|
franta-hg@0
|
26 |
-- TOC entry 332 (class 1247 OID 16398)
|
franta-hg@0
|
27 |
-- Dependencies: 333 6
|
franta-hg@0
|
28 |
-- Name: email; Type: DOMAIN; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
29 |
--
|
franta-hg@0
|
30 |
|
franta-hg@0
|
31 |
CREATE DOMAIN email AS character varying(255) NOT NULL
|
franta-hg@0
|
32 |
CONSTRAINT email_regexp CHECK (((VALUE)::text ~ '^[_a-zA-Z0-9\\.\\-]+@[_a-zA-Z0-9\\.\\-]+\\.[a-zA-Z]{2,4}$'::text));
|
franta-hg@0
|
33 |
|
franta-hg@0
|
34 |
|
franta-hg@0
|
35 |
ALTER DOMAIN miniobchod.email OWNER TO miniobchod;
|
franta-hg@0
|
36 |
|
franta-hg@0
|
37 |
--
|
franta-hg@0
|
38 |
-- TOC entry 1821 (class 0 OID 0)
|
franta-hg@0
|
39 |
-- Dependencies: 332
|
franta-hg@0
|
40 |
-- Name: DOMAIN email; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
41 |
--
|
franta-hg@0
|
42 |
|
franta-hg@0
|
43 |
COMMENT ON DOMAIN email IS 'e-mailová adresa';
|
franta-hg@0
|
44 |
|
franta-hg@0
|
45 |
|
franta-hg@0
|
46 |
--
|
franta-hg@0
|
47 |
-- TOC entry 344 (class 1247 OID 16566)
|
franta-hg@0
|
48 |
-- Dependencies: 345 6
|
franta-hg@0
|
49 |
-- Name: psc; Type: DOMAIN; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
50 |
--
|
franta-hg@0
|
51 |
|
franta-hg@0
|
52 |
CREATE DOMAIN psc AS character varying(255) NOT NULL
|
franta-hg@0
|
53 |
CONSTRAINT psc_regexp CHECK (((VALUE)::text ~ '^\\d{3} ?\\d{2}$'::text));
|
franta-hg@0
|
54 |
|
franta-hg@0
|
55 |
|
franta-hg@0
|
56 |
ALTER DOMAIN miniobchod.psc OWNER TO miniobchod;
|
franta-hg@0
|
57 |
|
franta-hg@0
|
58 |
--
|
franta-hg@0
|
59 |
-- TOC entry 1822 (class 0 OID 0)
|
franta-hg@0
|
60 |
-- Dependencies: 344
|
franta-hg@0
|
61 |
-- Name: DOMAIN psc; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
62 |
--
|
franta-hg@0
|
63 |
|
franta-hg@0
|
64 |
COMMENT ON DOMAIN psc IS 'Poštovní směrovací číslo';
|
franta-hg@0
|
65 |
|
franta-hg@0
|
66 |
|
franta-hg@0
|
67 |
--
|
franta-hg@0
|
68 |
-- TOC entry 55 (class 1255 OID 16459)
|
franta-hg@0
|
69 |
-- Dependencies: 6
|
franta-hg@0
|
70 |
-- Name: nahodne_heslo(); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
71 |
--
|
franta-hg@0
|
72 |
|
franta-hg@0
|
73 |
CREATE FUNCTION nahodne_heslo() RETURNS character
|
franta-hg@0
|
74 |
AS $$select sha512(random()::text || random()::text || random()::text);$$
|
franta-hg@0
|
75 |
LANGUAGE sql;
|
franta-hg@0
|
76 |
|
franta-hg@0
|
77 |
|
franta-hg@0
|
78 |
ALTER FUNCTION miniobchod.nahodne_heslo() OWNER TO miniobchod;
|
franta-hg@0
|
79 |
|
franta-hg@0
|
80 |
--
|
franta-hg@0
|
81 |
-- TOC entry 56 (class 1255 OID 16460)
|
franta-hg@0
|
82 |
-- Dependencies: 6
|
franta-hg@0
|
83 |
-- Name: sha1(text); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
84 |
--
|
franta-hg@0
|
85 |
|
franta-hg@0
|
86 |
CREATE FUNCTION sha1(text) RETURNS text
|
franta-hg@0
|
87 |
AS $_$
|
franta-hg@0
|
88 |
SELECT encode(digest(decode($1,'escape'::text),'sha1'::text),'hex');
|
franta-hg@0
|
89 |
$_$
|
franta-hg@0
|
90 |
LANGUAGE sql IMMUTABLE STRICT;
|
franta-hg@0
|
91 |
|
franta-hg@0
|
92 |
|
franta-hg@0
|
93 |
ALTER FUNCTION miniobchod.sha1(text) OWNER TO miniobchod;
|
franta-hg@0
|
94 |
|
franta-hg@0
|
95 |
--
|
franta-hg@0
|
96 |
-- TOC entry 57 (class 1255 OID 16461)
|
franta-hg@0
|
97 |
-- Dependencies: 6
|
franta-hg@0
|
98 |
-- Name: sha256(text); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
99 |
--
|
franta-hg@0
|
100 |
|
franta-hg@0
|
101 |
CREATE FUNCTION sha256(text) RETURNS text
|
franta-hg@0
|
102 |
AS $_$
|
franta-hg@0
|
103 |
SELECT encode(digest(decode($1,'escape'::text),'sha256'::text),'hex');
|
franta-hg@0
|
104 |
$_$
|
franta-hg@0
|
105 |
LANGUAGE sql IMMUTABLE STRICT;
|
franta-hg@0
|
106 |
|
franta-hg@0
|
107 |
|
franta-hg@0
|
108 |
ALTER FUNCTION miniobchod.sha256(text) OWNER TO miniobchod;
|
franta-hg@0
|
109 |
|
franta-hg@0
|
110 |
--
|
franta-hg@0
|
111 |
-- TOC entry 54 (class 1255 OID 16458)
|
franta-hg@0
|
112 |
-- Dependencies: 6
|
franta-hg@0
|
113 |
-- Name: sha512(text); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
114 |
--
|
franta-hg@0
|
115 |
|
franta-hg@0
|
116 |
CREATE FUNCTION sha512(text) RETURNS text
|
franta-hg@0
|
117 |
AS $_$
|
franta-hg@0
|
118 |
SELECT encode(digest(decode($1,'escape'::text),'sha512'::text),'hex');
|
franta-hg@0
|
119 |
$_$
|
franta-hg@0
|
120 |
LANGUAGE sql IMMUTABLE STRICT;
|
franta-hg@0
|
121 |
|
franta-hg@0
|
122 |
|
franta-hg@0
|
123 |
ALTER FUNCTION miniobchod.sha512(text) OWNER TO miniobchod;
|
franta-hg@0
|
124 |
|
franta-hg@0
|
125 |
--
|
franta-hg@0
|
126 |
-- TOC entry 58 (class 1255 OID 16608)
|
franta-hg@0
|
127 |
-- Dependencies: 350 6
|
franta-hg@0
|
128 |
-- Name: vyjimka(character varying); Type: FUNCTION; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
129 |
--
|
franta-hg@0
|
130 |
|
franta-hg@0
|
131 |
CREATE FUNCTION vyjimka(chyba character varying) RETURNS void
|
franta-hg@0
|
132 |
AS $$BEGIN
|
franta-hg@0
|
133 |
RAISE EXCEPTION '%', chyba;
|
franta-hg@0
|
134 |
END;$$
|
franta-hg@0
|
135 |
LANGUAGE plpgsql;
|
franta-hg@0
|
136 |
|
franta-hg@0
|
137 |
|
franta-hg@0
|
138 |
ALTER FUNCTION miniobchod.vyjimka(chyba character varying) OWNER TO miniobchod;
|
franta-hg@0
|
139 |
|
franta-hg@0
|
140 |
--
|
franta-hg@0
|
141 |
-- TOC entry 1823 (class 0 OID 0)
|
franta-hg@0
|
142 |
-- Dependencies: 58
|
franta-hg@0
|
143 |
-- Name: FUNCTION vyjimka(chyba character varying); Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
144 |
--
|
franta-hg@0
|
145 |
|
franta-hg@0
|
146 |
COMMENT ON FUNCTION vyjimka(chyba character varying) IS 'Vyhodí výjimku';
|
franta-hg@0
|
147 |
|
franta-hg@0
|
148 |
|
franta-hg@0
|
149 |
--
|
franta-hg@0
|
150 |
-- TOC entry 1528 (class 1259 OID 16575)
|
franta-hg@0
|
151 |
-- Dependencies: 6
|
franta-hg@0
|
152 |
-- Name: adresa_seq; Type: SEQUENCE; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
153 |
--
|
franta-hg@0
|
154 |
|
franta-hg@0
|
155 |
CREATE SEQUENCE adresa_seq
|
franta-hg@0
|
156 |
INCREMENT BY 1
|
franta-hg@0
|
157 |
NO MAXVALUE
|
franta-hg@0
|
158 |
NO MINVALUE
|
franta-hg@0
|
159 |
CACHE 1;
|
franta-hg@0
|
160 |
|
franta-hg@0
|
161 |
|
franta-hg@0
|
162 |
ALTER TABLE miniobchod.adresa_seq OWNER TO miniobchod;
|
franta-hg@0
|
163 |
|
franta-hg@0
|
164 |
SET default_tablespace = '';
|
franta-hg@0
|
165 |
|
franta-hg@0
|
166 |
SET default_with_oids = false;
|
franta-hg@0
|
167 |
|
franta-hg@0
|
168 |
--
|
franta-hg@0
|
169 |
-- TOC entry 1529 (class 1259 OID 16578)
|
franta-hg@0
|
170 |
-- Dependencies: 1804 332 344 6
|
franta-hg@0
|
171 |
-- Name: adresa; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
172 |
--
|
franta-hg@0
|
173 |
|
franta-hg@0
|
174 |
CREATE TABLE adresa (
|
franta-hg@0
|
175 |
id bigint DEFAULT nextval('adresa_seq'::regclass) NOT NULL,
|
franta-hg@0
|
176 |
uzivatel email,
|
franta-hg@0
|
177 |
jmeno character varying(255),
|
franta-hg@0
|
178 |
ulice character varying(255),
|
franta-hg@0
|
179 |
cp smallint,
|
franta-hg@0
|
180 |
mesto character varying(255),
|
franta-hg@0
|
181 |
psc psc
|
franta-hg@0
|
182 |
);
|
franta-hg@0
|
183 |
|
franta-hg@0
|
184 |
|
franta-hg@0
|
185 |
ALTER TABLE miniobchod.adresa OWNER TO miniobchod;
|
franta-hg@0
|
186 |
|
franta-hg@0
|
187 |
--
|
franta-hg@0
|
188 |
-- TOC entry 1824 (class 0 OID 0)
|
franta-hg@0
|
189 |
-- Dependencies: 1529
|
franta-hg@0
|
190 |
-- Name: TABLE adresa; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
191 |
--
|
franta-hg@0
|
192 |
|
franta-hg@0
|
193 |
COMMENT ON TABLE adresa IS 'Poštovní adresa';
|
franta-hg@0
|
194 |
|
franta-hg@0
|
195 |
|
franta-hg@0
|
196 |
--
|
franta-hg@0
|
197 |
-- TOC entry 1825 (class 0 OID 0)
|
franta-hg@0
|
198 |
-- Dependencies: 1529
|
franta-hg@0
|
199 |
-- Name: COLUMN adresa.jmeno; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
200 |
--
|
franta-hg@0
|
201 |
|
franta-hg@0
|
202 |
COMMENT ON COLUMN adresa.jmeno IS 'Jméno příjemce';
|
franta-hg@0
|
203 |
|
franta-hg@0
|
204 |
|
franta-hg@0
|
205 |
--
|
franta-hg@0
|
206 |
-- TOC entry 1826 (class 0 OID 0)
|
franta-hg@0
|
207 |
-- Dependencies: 1529
|
franta-hg@0
|
208 |
-- Name: COLUMN adresa.cp; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
209 |
--
|
franta-hg@0
|
210 |
|
franta-hg@0
|
211 |
COMMENT ON COLUMN adresa.cp IS 'Číslo popisné';
|
franta-hg@0
|
212 |
|
franta-hg@0
|
213 |
|
franta-hg@0
|
214 |
--
|
franta-hg@0
|
215 |
-- TOC entry 1827 (class 0 OID 0)
|
franta-hg@0
|
216 |
-- Dependencies: 1529
|
franta-hg@0
|
217 |
-- Name: COLUMN adresa.psc; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
218 |
--
|
franta-hg@0
|
219 |
|
franta-hg@0
|
220 |
COMMENT ON COLUMN adresa.psc IS 'Poštovní směrovací číslo';
|
franta-hg@0
|
221 |
|
franta-hg@0
|
222 |
|
franta-hg@0
|
223 |
--
|
franta-hg@0
|
224 |
-- TOC entry 1527 (class 1259 OID 16540)
|
franta-hg@0
|
225 |
-- Dependencies: 1803 6
|
franta-hg@0
|
226 |
-- Name: objednane_zbozi; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
227 |
--
|
franta-hg@0
|
228 |
|
franta-hg@0
|
229 |
CREATE TABLE objednane_zbozi (
|
franta-hg@0
|
230 |
objednavka bigint NOT NULL,
|
franta-hg@0
|
231 |
zbozi bit varying NOT NULL,
|
franta-hg@0
|
232 |
mnozstvi smallint DEFAULT 1 NOT NULL
|
franta-hg@0
|
233 |
);
|
franta-hg@0
|
234 |
|
franta-hg@0
|
235 |
|
franta-hg@0
|
236 |
ALTER TABLE miniobchod.objednane_zbozi OWNER TO miniobchod;
|
franta-hg@0
|
237 |
|
franta-hg@0
|
238 |
--
|
franta-hg@0
|
239 |
-- TOC entry 1828 (class 0 OID 0)
|
franta-hg@0
|
240 |
-- Dependencies: 1527
|
franta-hg@0
|
241 |
-- Name: TABLE objednane_zbozi; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
242 |
--
|
franta-hg@0
|
243 |
|
franta-hg@0
|
244 |
COMMENT ON TABLE objednane_zbozi IS 'Vazební tabulka, která definuje obsah objednávky – objednané zboží';
|
franta-hg@0
|
245 |
|
franta-hg@0
|
246 |
|
franta-hg@0
|
247 |
--
|
franta-hg@0
|
248 |
-- TOC entry 1525 (class 1259 OID 16408)
|
franta-hg@0
|
249 |
-- Dependencies: 6
|
franta-hg@0
|
250 |
-- Name: objednavka_seq; Type: SEQUENCE; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
251 |
--
|
franta-hg@0
|
252 |
|
franta-hg@0
|
253 |
CREATE SEQUENCE objednavka_seq
|
franta-hg@0
|
254 |
INCREMENT BY 1
|
franta-hg@0
|
255 |
NO MAXVALUE
|
franta-hg@0
|
256 |
NO MINVALUE
|
franta-hg@0
|
257 |
CACHE 1;
|
franta-hg@0
|
258 |
|
franta-hg@0
|
259 |
|
franta-hg@0
|
260 |
ALTER TABLE miniobchod.objednavka_seq OWNER TO miniobchod;
|
franta-hg@0
|
261 |
|
franta-hg@0
|
262 |
--
|
franta-hg@0
|
263 |
-- TOC entry 1526 (class 1259 OID 16410)
|
franta-hg@0
|
264 |
-- Dependencies: 1800 1801 1802 6 332
|
franta-hg@0
|
265 |
-- Name: objednavka; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
266 |
--
|
franta-hg@0
|
267 |
|
franta-hg@0
|
268 |
CREATE TABLE objednavka (
|
franta-hg@0
|
269 |
id bigint DEFAULT nextval('objednavka_seq'::regclass) NOT NULL,
|
franta-hg@0
|
270 |
kod character varying DEFAULT nahodne_heslo() NOT NULL,
|
franta-hg@0
|
271 |
uzivatel email,
|
franta-hg@0
|
272 |
podano timestamp with time zone DEFAULT now() NOT NULL,
|
franta-hg@0
|
273 |
adresa bigint
|
franta-hg@0
|
274 |
);
|
franta-hg@0
|
275 |
|
franta-hg@0
|
276 |
|
franta-hg@0
|
277 |
ALTER TABLE miniobchod.objednavka OWNER TO miniobchod;
|
franta-hg@0
|
278 |
|
franta-hg@0
|
279 |
--
|
franta-hg@0
|
280 |
-- TOC entry 1829 (class 0 OID 0)
|
franta-hg@0
|
281 |
-- Dependencies: 1526
|
franta-hg@0
|
282 |
-- Name: TABLE objednavka; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
283 |
--
|
franta-hg@0
|
284 |
|
franta-hg@0
|
285 |
COMMENT ON TABLE objednavka IS 'Objednávka zboží';
|
franta-hg@0
|
286 |
|
franta-hg@0
|
287 |
|
franta-hg@0
|
288 |
--
|
franta-hg@0
|
289 |
-- TOC entry 1830 (class 0 OID 0)
|
franta-hg@0
|
290 |
-- Dependencies: 1526
|
franta-hg@0
|
291 |
-- Name: COLUMN objednavka.id; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
292 |
--
|
franta-hg@0
|
293 |
|
franta-hg@0
|
294 |
COMMENT ON COLUMN objednavka.id IS 'Číslo objednávky je zároveň variabilním symbolem';
|
franta-hg@0
|
295 |
|
franta-hg@0
|
296 |
|
franta-hg@0
|
297 |
--
|
franta-hg@0
|
298 |
-- TOC entry 1831 (class 0 OID 0)
|
franta-hg@0
|
299 |
-- Dependencies: 1526
|
franta-hg@0
|
300 |
-- Name: COLUMN objednavka.kod; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
301 |
--
|
franta-hg@0
|
302 |
|
franta-hg@0
|
303 |
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
|
304 |
|
franta-hg@0
|
305 |
|
franta-hg@0
|
306 |
--
|
franta-hg@0
|
307 |
-- TOC entry 1832 (class 0 OID 0)
|
franta-hg@0
|
308 |
-- Dependencies: 1526
|
franta-hg@0
|
309 |
-- Name: COLUMN objednavka.uzivatel; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
310 |
--
|
franta-hg@0
|
311 |
|
franta-hg@0
|
312 |
COMMENT ON COLUMN objednavka.uzivatel IS 'Kdo si objednal';
|
franta-hg@0
|
313 |
|
franta-hg@0
|
314 |
|
franta-hg@0
|
315 |
--
|
franta-hg@0
|
316 |
-- TOC entry 1833 (class 0 OID 0)
|
franta-hg@0
|
317 |
-- Dependencies: 1526
|
franta-hg@0
|
318 |
-- Name: COLUMN objednavka.podano; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
319 |
--
|
franta-hg@0
|
320 |
|
franta-hg@0
|
321 |
COMMENT ON COLUMN objednavka.podano IS 'Datum a čas podání objednávky';
|
franta-hg@0
|
322 |
|
franta-hg@0
|
323 |
|
franta-hg@0
|
324 |
--
|
franta-hg@0
|
325 |
-- TOC entry 1834 (class 0 OID 0)
|
franta-hg@0
|
326 |
-- Dependencies: 1526
|
franta-hg@0
|
327 |
-- Name: COLUMN objednavka.adresa; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
328 |
--
|
franta-hg@0
|
329 |
|
franta-hg@0
|
330 |
COMMENT ON COLUMN objednavka.adresa IS 'Kam se má objednávka doručit';
|
franta-hg@0
|
331 |
|
franta-hg@0
|
332 |
|
franta-hg@0
|
333 |
--
|
franta-hg@0
|
334 |
-- TOC entry 1524 (class 1259 OID 16400)
|
franta-hg@0
|
335 |
-- Dependencies: 1798 1799 6 332
|
franta-hg@0
|
336 |
-- Name: uzivatel; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
337 |
--
|
franta-hg@0
|
338 |
|
franta-hg@0
|
339 |
CREATE TABLE uzivatel (
|
franta-hg@0
|
340 |
email email NOT NULL,
|
franta-hg@0
|
341 |
heslo character varying DEFAULT nahodne_heslo() NOT NULL,
|
franta-hg@0
|
342 |
zalozen timestamp with time zone DEFAULT now()
|
franta-hg@0
|
343 |
);
|
franta-hg@0
|
344 |
|
franta-hg@0
|
345 |
|
franta-hg@0
|
346 |
ALTER TABLE miniobchod.uzivatel OWNER TO miniobchod;
|
franta-hg@0
|
347 |
|
franta-hg@0
|
348 |
--
|
franta-hg@0
|
349 |
-- TOC entry 1835 (class 0 OID 0)
|
franta-hg@0
|
350 |
-- Dependencies: 1524
|
franta-hg@0
|
351 |
-- Name: TABLE uzivatel; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
352 |
--
|
franta-hg@0
|
353 |
|
franta-hg@0
|
354 |
COMMENT ON TABLE uzivatel IS 'Zákazník';
|
franta-hg@0
|
355 |
|
franta-hg@0
|
356 |
|
franta-hg@0
|
357 |
--
|
franta-hg@0
|
358 |
-- TOC entry 1836 (class 0 OID 0)
|
franta-hg@0
|
359 |
-- Dependencies: 1524
|
franta-hg@0
|
360 |
-- Name: COLUMN uzivatel.email; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
361 |
--
|
franta-hg@0
|
362 |
|
franta-hg@0
|
363 |
COMMENT ON COLUMN uzivatel.email IS 'Uživatel je identifikovaný pomocí své e-mailové adresy';
|
franta-hg@0
|
364 |
|
franta-hg@0
|
365 |
|
franta-hg@0
|
366 |
--
|
franta-hg@0
|
367 |
-- TOC entry 1837 (class 0 OID 0)
|
franta-hg@0
|
368 |
-- Dependencies: 1524
|
franta-hg@0
|
369 |
-- Name: COLUMN uzivatel.heslo; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
370 |
--
|
franta-hg@0
|
371 |
|
franta-hg@0
|
372 |
COMMENT ON COLUMN uzivatel.heslo IS 'Vygenerované heslo, kterým se uživatel prokazuje (pošle se mu na e-mail)';
|
franta-hg@0
|
373 |
|
franta-hg@0
|
374 |
|
franta-hg@0
|
375 |
--
|
franta-hg@0
|
376 |
-- TOC entry 1838 (class 0 OID 0)
|
franta-hg@0
|
377 |
-- Dependencies: 1524
|
franta-hg@0
|
378 |
-- Name: COLUMN uzivatel.zalozen; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
379 |
--
|
franta-hg@0
|
380 |
|
franta-hg@0
|
381 |
COMMENT ON COLUMN uzivatel.zalozen IS 'Datum a čas registrace zákazníka';
|
franta-hg@0
|
382 |
|
franta-hg@0
|
383 |
|
franta-hg@0
|
384 |
--
|
franta-hg@0
|
385 |
-- TOC entry 1522 (class 1259 OID 16387)
|
franta-hg@0
|
386 |
-- Dependencies: 6
|
franta-hg@0
|
387 |
-- Name: zbozi_seq; Type: SEQUENCE; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
388 |
--
|
franta-hg@0
|
389 |
|
franta-hg@0
|
390 |
CREATE SEQUENCE zbozi_seq
|
franta-hg@0
|
391 |
INCREMENT BY 1
|
franta-hg@0
|
392 |
NO MAXVALUE
|
franta-hg@0
|
393 |
NO MINVALUE
|
franta-hg@0
|
394 |
CACHE 1;
|
franta-hg@0
|
395 |
|
franta-hg@0
|
396 |
|
franta-hg@0
|
397 |
ALTER TABLE miniobchod.zbozi_seq OWNER TO miniobchod;
|
franta-hg@0
|
398 |
|
franta-hg@0
|
399 |
--
|
franta-hg@0
|
400 |
-- TOC entry 1523 (class 1259 OID 16389)
|
franta-hg@0
|
401 |
-- Dependencies: 1797 6
|
franta-hg@0
|
402 |
-- Name: zbozi; Type: TABLE; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
403 |
--
|
franta-hg@0
|
404 |
|
franta-hg@0
|
405 |
CREATE TABLE zbozi (
|
franta-hg@0
|
406 |
id bigint DEFAULT nextval('zbozi_seq'::regclass) NOT NULL,
|
franta-hg@0
|
407 |
nazev character varying(255),
|
franta-hg@0
|
408 |
popis text
|
franta-hg@0
|
409 |
);
|
franta-hg@0
|
410 |
|
franta-hg@0
|
411 |
|
franta-hg@0
|
412 |
ALTER TABLE miniobchod.zbozi OWNER TO miniobchod;
|
franta-hg@0
|
413 |
|
franta-hg@0
|
414 |
--
|
franta-hg@0
|
415 |
-- TOC entry 1839 (class 0 OID 0)
|
franta-hg@0
|
416 |
-- Dependencies: 1523
|
franta-hg@0
|
417 |
-- Name: TABLE zbozi; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
418 |
--
|
franta-hg@0
|
419 |
|
franta-hg@0
|
420 |
COMMENT ON TABLE zbozi IS 'Položka katalogu';
|
franta-hg@0
|
421 |
|
franta-hg@0
|
422 |
|
franta-hg@0
|
423 |
--
|
franta-hg@0
|
424 |
-- TOC entry 1840 (class 0 OID 0)
|
franta-hg@0
|
425 |
-- Dependencies: 1523
|
franta-hg@0
|
426 |
-- Name: COLUMN zbozi.id; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
427 |
--
|
franta-hg@0
|
428 |
|
franta-hg@0
|
429 |
COMMENT ON COLUMN zbozi.id IS 'Číslo zboží';
|
franta-hg@0
|
430 |
|
franta-hg@0
|
431 |
|
franta-hg@0
|
432 |
--
|
franta-hg@0
|
433 |
-- TOC entry 1841 (class 0 OID 0)
|
franta-hg@0
|
434 |
-- Dependencies: 1523
|
franta-hg@0
|
435 |
-- Name: COLUMN zbozi.nazev; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
436 |
--
|
franta-hg@0
|
437 |
|
franta-hg@0
|
438 |
COMMENT ON COLUMN zbozi.nazev IS 'Název zboží';
|
franta-hg@0
|
439 |
|
franta-hg@0
|
440 |
|
franta-hg@0
|
441 |
--
|
franta-hg@0
|
442 |
-- TOC entry 1842 (class 0 OID 0)
|
franta-hg@0
|
443 |
-- Dependencies: 1523
|
franta-hg@0
|
444 |
-- Name: COLUMN zbozi.popis; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
445 |
--
|
franta-hg@0
|
446 |
|
franta-hg@0
|
447 |
COMMENT ON COLUMN zbozi.popis IS 'Popis zboží';
|
franta-hg@0
|
448 |
|
franta-hg@0
|
449 |
|
franta-hg@0
|
450 |
--
|
franta-hg@0
|
451 |
-- TOC entry 1815 (class 2606 OID 16586)
|
franta-hg@0
|
452 |
-- Dependencies: 1529 1529
|
franta-hg@0
|
453 |
-- Name: adresa_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
454 |
--
|
franta-hg@0
|
455 |
|
franta-hg@0
|
456 |
ALTER TABLE ONLY adresa
|
franta-hg@0
|
457 |
ADD CONSTRAINT adresa_pk PRIMARY KEY (id);
|
franta-hg@0
|
458 |
|
franta-hg@0
|
459 |
|
franta-hg@0
|
460 |
--
|
franta-hg@0
|
461 |
-- TOC entry 1813 (class 2606 OID 16548)
|
franta-hg@0
|
462 |
-- Dependencies: 1527 1527 1527
|
franta-hg@0
|
463 |
-- Name: objednane_zbozi_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
464 |
--
|
franta-hg@0
|
465 |
|
franta-hg@0
|
466 |
ALTER TABLE ONLY objednane_zbozi
|
franta-hg@0
|
467 |
ADD CONSTRAINT objednane_zbozi_pk PRIMARY KEY (objednavka, zbozi);
|
franta-hg@0
|
468 |
|
franta-hg@0
|
469 |
|
franta-hg@0
|
470 |
--
|
franta-hg@0
|
471 |
-- TOC entry 1811 (class 2606 OID 16415)
|
franta-hg@0
|
472 |
-- Dependencies: 1526 1526
|
franta-hg@0
|
473 |
-- Name: objednavka_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
474 |
--
|
franta-hg@0
|
475 |
|
franta-hg@0
|
476 |
ALTER TABLE ONLY objednavka
|
franta-hg@0
|
477 |
ADD CONSTRAINT objednavka_pk PRIMARY KEY (id);
|
franta-hg@0
|
478 |
|
franta-hg@0
|
479 |
|
franta-hg@0
|
480 |
--
|
franta-hg@0
|
481 |
-- TOC entry 1808 (class 2606 OID 16407)
|
franta-hg@0
|
482 |
-- Dependencies: 1524 1524
|
franta-hg@0
|
483 |
-- Name: uzivatel_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
484 |
--
|
franta-hg@0
|
485 |
|
franta-hg@0
|
486 |
ALTER TABLE ONLY uzivatel
|
franta-hg@0
|
487 |
ADD CONSTRAINT uzivatel_pk PRIMARY KEY (email);
|
franta-hg@0
|
488 |
|
franta-hg@0
|
489 |
|
franta-hg@0
|
490 |
--
|
franta-hg@0
|
491 |
-- TOC entry 1806 (class 2606 OID 16397)
|
franta-hg@0
|
492 |
-- Dependencies: 1523 1523
|
franta-hg@0
|
493 |
-- Name: zbozi_pk; Type: CONSTRAINT; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
494 |
--
|
franta-hg@0
|
495 |
|
franta-hg@0
|
496 |
ALTER TABLE ONLY zbozi
|
franta-hg@0
|
497 |
ADD CONSTRAINT zbozi_pk PRIMARY KEY (id);
|
franta-hg@0
|
498 |
|
franta-hg@0
|
499 |
|
franta-hg@0
|
500 |
--
|
franta-hg@0
|
501 |
-- TOC entry 1809 (class 1259 OID 16597)
|
franta-hg@0
|
502 |
-- Dependencies: 1526
|
franta-hg@0
|
503 |
-- Name: fki_objednavka_adresa_fk; Type: INDEX; Schema: miniobchod; Owner: miniobchod; Tablespace:
|
franta-hg@0
|
504 |
--
|
franta-hg@0
|
505 |
|
franta-hg@0
|
506 |
CREATE INDEX fki_objednavka_adresa_fk ON objednavka USING btree (adresa);
|
franta-hg@0
|
507 |
|
franta-hg@0
|
508 |
|
franta-hg@0
|
509 |
--
|
franta-hg@0
|
510 |
-- TOC entry 1605 (class 2618 OID 16598)
|
franta-hg@0
|
511 |
-- Dependencies: 1526 1529 1526 58 1526 1526 1526 1529
|
franta-hg@0
|
512 |
-- Name: objednavka_adresa_uzivatel; Type: RULE; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
513 |
--
|
franta-hg@0
|
514 |
|
franta-hg@0
|
515 |
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
|
516 |
|
franta-hg@0
|
517 |
|
franta-hg@0
|
518 |
--
|
franta-hg@0
|
519 |
-- TOC entry 1843 (class 0 OID 0)
|
franta-hg@0
|
520 |
-- Dependencies: 1605
|
franta-hg@0
|
521 |
-- Name: RULE objednavka_adresa_uzivatel ON objednavka; Type: COMMENT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
522 |
--
|
franta-hg@0
|
523 |
|
franta-hg@0
|
524 |
COMMENT ON RULE objednavka_adresa_uzivatel ON objednavka IS 'Uživatel může objednat zboží jen na svoji adresu';
|
franta-hg@0
|
525 |
|
franta-hg@0
|
526 |
|
franta-hg@0
|
527 |
--
|
franta-hg@0
|
528 |
-- TOC entry 1818 (class 2606 OID 16587)
|
franta-hg@0
|
529 |
-- Dependencies: 1807 1529 1524
|
franta-hg@0
|
530 |
-- Name: adresa_uzivatel_fk; Type: FK CONSTRAINT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
531 |
--
|
franta-hg@0
|
532 |
|
franta-hg@0
|
533 |
ALTER TABLE ONLY adresa
|
franta-hg@0
|
534 |
ADD CONSTRAINT adresa_uzivatel_fk FOREIGN KEY (uzivatel) REFERENCES uzivatel(email);
|
franta-hg@0
|
535 |
|
franta-hg@0
|
536 |
|
franta-hg@0
|
537 |
--
|
franta-hg@0
|
538 |
-- TOC entry 1817 (class 2606 OID 16592)
|
franta-hg@0
|
539 |
-- Dependencies: 1814 1529 1526
|
franta-hg@0
|
540 |
-- Name: objednavka_adresa_fk; Type: FK CONSTRAINT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
541 |
--
|
franta-hg@0
|
542 |
|
franta-hg@0
|
543 |
ALTER TABLE ONLY objednavka
|
franta-hg@0
|
544 |
ADD CONSTRAINT objednavka_adresa_fk FOREIGN KEY (adresa) REFERENCES adresa(id);
|
franta-hg@0
|
545 |
|
franta-hg@0
|
546 |
|
franta-hg@0
|
547 |
--
|
franta-hg@0
|
548 |
-- TOC entry 1816 (class 2606 OID 16493)
|
franta-hg@0
|
549 |
-- Dependencies: 1807 1524 1526
|
franta-hg@0
|
550 |
-- Name: objednavka_uzivatel_fk; Type: FK CONSTRAINT; Schema: miniobchod; Owner: miniobchod
|
franta-hg@0
|
551 |
--
|
franta-hg@0
|
552 |
|
franta-hg@0
|
553 |
ALTER TABLE ONLY objednavka
|
franta-hg@0
|
554 |
ADD CONSTRAINT objednavka_uzivatel_fk FOREIGN KEY (uzivatel) REFERENCES uzivatel(email);
|
franta-hg@0
|
555 |
|
franta-hg@0
|
556 |
|
franta-hg@0
|
557 |
-- Completed on 2009-04-28 21:06:38 CEST
|
franta-hg@0
|
558 |
|
franta-hg@0
|
559 |
--
|
franta-hg@0
|
560 |
-- PostgreSQL database dump complete
|
franta-hg@0
|
561 |
--
|
franta-hg@0
|
562 |
|