Hibernate: podniky budeme načítat včetně jejich fotek.
2 -- PostgreSQL database dump
5 -- Started on 2010-03-09 20:48:44 CET
7 SET statement_timeout = 0;
8 SET client_encoding = 'UTF8';
9 SET standard_conforming_strings = off;
10 SET check_function_bodies = false;
11 SET client_min_messages = warning;
12 SET escape_string_warning = off;
15 -- TOC entry 10 (class 2615 OID 35015)
16 -- Name: nekurak; Type: SCHEMA; Schema: -; Owner: nekurak
19 CREATE SCHEMA nekurak;
22 ALTER SCHEMA nekurak OWNER TO nekurak;
24 SET search_path = nekurak, pg_catalog;
27 -- TOC entry 369 (class 1247 OID 35086)
28 -- Dependencies: 370 10
29 -- Name: email; Type: DOMAIN; Schema: nekurak; Owner: nekurak
32 CREATE DOMAIN email AS character varying(255)
33 CONSTRAINT email_regexp CHECK (((VALUE)::text ~ '^[_a-zA-Z0-9\\.\\-]+@[_a-zA-Z0-9\\.\\-]+\\.[a-zA-Z]{2,4}$'::text));
36 ALTER DOMAIN nekurak.email OWNER TO nekurak;
39 -- TOC entry 1881 (class 0 OID 0)
41 -- Name: DOMAIN email; Type: COMMENT; Schema: nekurak; Owner: nekurak
44 COMMENT ON DOMAIN email IS 'e-mailová adresa';
48 -- TOC entry 65 (class 1255 OID 35124)
49 -- Dependencies: 10 392
50 -- Name: bezny_uzivatel(); Type: FUNCTION; Schema: nekurak; Owner: nekurak
53 CREATE FUNCTION bezny_uzivatel() RETURNS trigger
56 INSERT INTO uzivatel_role
59 ('bezny', new.prezdivka);
64 ALTER FUNCTION nekurak.bezny_uzivatel() OWNER TO nekurak;
67 -- TOC entry 1882 (class 0 OID 0)
69 -- Name: FUNCTION bezny_uzivatel(); Type: COMMENT; Schema: nekurak; Owner: nekurak
72 COMMENT ON FUNCTION bezny_uzivatel() IS 'Každému novému uživateli dáme automaticky roli „bezny“.';
75 SET default_tablespace = '';
77 SET default_with_oids = true;
80 -- TOC entry 1584 (class 1259 OID 35068)
81 -- Dependencies: 1861 10
82 -- Name: hlasovani; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
85 CREATE TABLE hlasovani (
86 podnik integer NOT NULL,
87 hlas boolean NOT NULL,
88 datum date DEFAULT now() NOT NULL,
89 ip_adresa character varying(255)
93 ALTER TABLE nekurak.hlasovani OWNER TO nekurak;
96 -- TOC entry 1883 (class 0 OID 0)
98 -- Name: COLUMN hlasovani.hlas; Type: COMMENT; Schema: nekurak; Owner: nekurak
101 COMMENT ON COLUMN hlasovani.hlas IS 'Má být tento podnik nekuřácký?
103 false = kouření povoleno';
107 -- TOC entry 1582 (class 1259 OID 35019)
109 -- Name: podnik_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
112 CREATE SEQUENCE podnik_seq
119 ALTER TABLE nekurak.podnik_seq OWNER TO nekurak;
121 SET default_with_oids = false;
124 -- TOC entry 1583 (class 1259 OID 35049)
125 -- Dependencies: 1859 1860 10
126 -- Name: podnik; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
129 CREATE TABLE podnik (
130 id integer DEFAULT nextval('podnik_seq'::regclass) NOT NULL,
131 nazev character varying(255) NOT NULL,
132 popis character varying(255),
133 url character varying(255),
134 datum timestamp with time zone DEFAULT now(),
135 ulice character varying(64),
136 cislo_popisne integer,
137 mesto character varying(64)
141 ALTER TABLE nekurak.podnik OWNER TO nekurak;
144 -- TOC entry 1587 (class 1259 OID 35101)
146 -- Name: role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
150 kod character varying(16) NOT NULL,
151 popis character varying(255)
155 ALTER TABLE nekurak.role OWNER TO nekurak;
158 -- TOC entry 1887 (class 0 OID 0)
159 -- Dependencies: 1587
160 -- Name: TABLE role; Type: COMMENT; Schema: nekurak; Owner: nekurak
163 COMMENT ON TABLE role IS 'Role (skupiny) uživatelů ~ oprávnění';
167 -- TOC entry 1585 (class 1259 OID 35080)
169 -- Name: uzivatel_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
172 CREATE SEQUENCE uzivatel_seq
179 ALTER TABLE nekurak.uzivatel_seq OWNER TO nekurak;
182 -- TOC entry 1586 (class 1259 OID 35091)
183 -- Dependencies: 1862 1863 10
184 -- Name: uzivatel; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
187 CREATE TABLE uzivatel (
188 id integer DEFAULT nextval('uzivatel_seq'::regclass) NOT NULL,
189 prezdivka character varying(64) NOT NULL,
190 heslo character varying(512) NOT NULL,
191 jmeno character varying(64),
192 prijmeni character varying(64),
193 email character varying(255),
194 datum timestamp with time zone DEFAULT now() NOT NULL
198 ALTER TABLE nekurak.uzivatel OWNER TO nekurak;
201 -- TOC entry 1890 (class 0 OID 0)
202 -- Dependencies: 1586
203 -- Name: COLUMN uzivatel.prezdivka; Type: COMMENT; Schema: nekurak; Owner: nekurak
206 COMMENT ON COLUMN uzivatel.prezdivka IS 'Uživatelské jméno';
210 -- TOC entry 1588 (class 1259 OID 35106)
212 -- Name: uzivatel_role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
215 CREATE TABLE uzivatel_role (
216 role character varying(16) NOT NULL,
217 prezdivka character varying(64) NOT NULL
221 ALTER TABLE nekurak.uzivatel_role OWNER TO nekurak;
224 -- TOC entry 1892 (class 0 OID 0)
225 -- Dependencies: 1588
226 -- Name: TABLE uzivatel_role; Type: COMMENT; Schema: nekurak; Owner: nekurak
229 COMMENT ON TABLE uzivatel_role IS 'Přiřazení uživatelských rolí (skupin).';
233 -- TOC entry 1865 (class 2606 OID 35058)
234 -- Dependencies: 1583 1583
235 -- Name: podnik_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
238 ALTER TABLE ONLY podnik
239 ADD CONSTRAINT podnik_pk PRIMARY KEY (id);
243 -- TOC entry 1871 (class 2606 OID 35105)
244 -- Dependencies: 1587 1587
245 -- Name: skupina_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
248 ALTER TABLE ONLY role
249 ADD CONSTRAINT skupina_pk PRIMARY KEY (kod);
253 -- TOC entry 1867 (class 2606 OID 35098)
254 -- Dependencies: 1586 1586
255 -- Name: uzivatel_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
258 ALTER TABLE ONLY uzivatel
259 ADD CONSTRAINT uzivatel_pk PRIMARY KEY (id);
263 -- TOC entry 1869 (class 2606 OID 35100)
264 -- Dependencies: 1586 1586
265 -- Name: uzivatel_prezdivka_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
268 ALTER TABLE ONLY uzivatel
269 ADD CONSTRAINT uzivatel_prezdivka_uq UNIQUE (prezdivka);
273 -- TOC entry 1873 (class 2606 OID 35137)
274 -- Dependencies: 1588 1588 1588
275 -- Name: uzivatel_role_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
278 ALTER TABLE ONLY uzivatel_role
279 ADD CONSTRAINT uzivatel_role_pk PRIMARY KEY (role, prezdivka);
283 -- TOC entry 1877 (class 2620 OID 35125)
284 -- Dependencies: 65 1586
285 -- Name: uzivatel_insert; Type: TRIGGER; Schema: nekurak; Owner: nekurak
288 CREATE TRIGGER uzivatel_insert
289 AFTER INSERT ON uzivatel
291 EXECUTE PROCEDURE bezny_uzivatel();
295 -- TOC entry 1874 (class 2606 OID 35072)
296 -- Dependencies: 1864 1583 1584
297 -- Name: hlasovani_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
300 ALTER TABLE ONLY hlasovani
301 ADD CONSTRAINT hlasovani_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
305 -- TOC entry 1875 (class 2606 OID 35138)
306 -- Dependencies: 1870 1587 1588
307 -- Name: uzivatel_role_role_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
310 ALTER TABLE ONLY uzivatel_role
311 ADD CONSTRAINT uzivatel_role_role_fk FOREIGN KEY (role) REFERENCES role(kod) ON UPDATE CASCADE ON DELETE CASCADE;
315 -- TOC entry 1876 (class 2606 OID 35143)
316 -- Dependencies: 1868 1586 1588
317 -- Name: uzivatel_role_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
320 ALTER TABLE ONLY uzivatel_role
321 ADD CONSTRAINT uzivatel_role_uzivatel_fk FOREIGN KEY (prezdivka) REFERENCES uzivatel(prezdivka) ON UPDATE CASCADE ON DELETE CASCADE;
325 -- TOC entry 1880 (class 0 OID 0)
327 -- Name: nekurak; Type: ACL; Schema: -; Owner: nekurak
330 REVOKE ALL ON SCHEMA nekurak FROM PUBLIC;
331 REVOKE ALL ON SCHEMA nekurak FROM nekurak;
332 GRANT ALL ON SCHEMA nekurak TO nekurak;
333 GRANT USAGE ON SCHEMA nekurak TO nekurak_web;
337 -- TOC entry 1884 (class 0 OID 0)
338 -- Dependencies: 1584
339 -- Name: hlasovani; Type: ACL; Schema: nekurak; Owner: nekurak
342 REVOKE ALL ON TABLE hlasovani FROM PUBLIC;
343 REVOKE ALL ON TABLE hlasovani FROM nekurak;
344 GRANT ALL ON TABLE hlasovani TO nekurak;
345 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE hlasovani TO nekurak_web;
349 -- TOC entry 1885 (class 0 OID 0)
350 -- Dependencies: 1582
351 -- Name: podnik_seq; Type: ACL; Schema: nekurak; Owner: nekurak
354 REVOKE ALL ON SEQUENCE podnik_seq FROM PUBLIC;
355 REVOKE ALL ON SEQUENCE podnik_seq FROM nekurak;
356 GRANT ALL ON SEQUENCE podnik_seq TO nekurak;
357 GRANT USAGE ON SEQUENCE podnik_seq TO nekurak_web;
361 -- TOC entry 1886 (class 0 OID 0)
362 -- Dependencies: 1583
363 -- Name: podnik; Type: ACL; Schema: nekurak; Owner: nekurak
366 REVOKE ALL ON TABLE podnik FROM PUBLIC;
367 REVOKE ALL ON TABLE podnik FROM nekurak;
368 GRANT ALL ON TABLE podnik TO nekurak;
369 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE podnik TO nekurak_web;
373 -- TOC entry 1888 (class 0 OID 0)
374 -- Dependencies: 1587
375 -- Name: role; Type: ACL; Schema: nekurak; Owner: nekurak
378 REVOKE ALL ON TABLE role FROM PUBLIC;
379 REVOKE ALL ON TABLE role FROM nekurak;
380 GRANT ALL ON TABLE role TO nekurak;
381 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE role TO nekurak_web;
385 -- TOC entry 1889 (class 0 OID 0)
386 -- Dependencies: 1585
387 -- Name: uzivatel_seq; Type: ACL; Schema: nekurak; Owner: nekurak
390 REVOKE ALL ON SEQUENCE uzivatel_seq FROM PUBLIC;
391 REVOKE ALL ON SEQUENCE uzivatel_seq FROM nekurak;
392 GRANT ALL ON SEQUENCE uzivatel_seq TO nekurak;
393 GRANT USAGE ON SEQUENCE uzivatel_seq TO nekurak_web;
397 -- TOC entry 1891 (class 0 OID 0)
398 -- Dependencies: 1586
399 -- Name: uzivatel; Type: ACL; Schema: nekurak; Owner: nekurak
402 REVOKE ALL ON TABLE uzivatel FROM PUBLIC;
403 REVOKE ALL ON TABLE uzivatel FROM nekurak;
404 GRANT ALL ON TABLE uzivatel TO nekurak;
405 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel TO nekurak_web;
409 -- TOC entry 1893 (class 0 OID 0)
410 -- Dependencies: 1588
411 -- Name: uzivatel_role; Type: ACL; Schema: nekurak; Owner: nekurak
414 REVOKE ALL ON TABLE uzivatel_role FROM PUBLIC;
415 REVOKE ALL ON TABLE uzivatel_role FROM nekurak;
416 GRANT ALL ON TABLE uzivatel_role TO nekurak;
417 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel_role TO nekurak_web;
420 -- Completed on 2010-03-09 20:48:46 CET
423 -- PostgreSQL database dump complete