sql/schéma.sql
author František Kučera <franta-hg@frantovo.cz>
Wed Jun 09 18:34:13 2010 +0200 (2010-06-09)
changeset 139 b876839f1989
parent 118 1c52b1a4a18a
child 154 bf21a4abea9b
permissions -rw-r--r--
Doplněno explicitní kódování pro data přijímaná od Texy služby,
abychom se nemuseli spoléhat na proměnné prostředí.
     1 --
     2 -- PostgreSQL database dump
     3 --
     4 
     5 -- Started on 2010-06-09 15:52:26 CEST
     6 
     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;
    13 
    14 --
    15 -- TOC entry 10 (class 2615 OID 35015)
    16 -- Name: nekurak; Type: SCHEMA; Schema: -; Owner: nekurak
    17 --
    18 
    19 CREATE SCHEMA nekurak;
    20 
    21 
    22 ALTER SCHEMA nekurak OWNER TO nekurak;
    23 
    24 SET search_path = nekurak, pg_catalog;
    25 
    26 --
    27 -- TOC entry 366 (class 1247 OID 35086)
    28 -- Dependencies: 367 10
    29 -- Name: email; Type: DOMAIN; Schema: nekurak; Owner: nekurak
    30 --
    31 
    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));
    34 
    35 
    36 ALTER DOMAIN nekurak.email OWNER TO nekurak;
    37 
    38 --
    39 -- TOC entry 1926 (class 0 OID 0)
    40 -- Dependencies: 366
    41 -- Name: DOMAIN email; Type: COMMENT; Schema: nekurak; Owner: nekurak
    42 --
    43 
    44 COMMENT ON DOMAIN email IS 'e-mailová adresa';
    45 
    46 
    47 --
    48 -- TOC entry 65 (class 1255 OID 35124)
    49 -- Dependencies: 10 406
    50 -- Name: bezny_uzivatel(); Type: FUNCTION; Schema: nekurak; Owner: nekurak
    51 --
    52 
    53 CREATE FUNCTION bezny_uzivatel() RETURNS trigger
    54     LANGUAGE plpgsql
    55     AS $$BEGIN
    56 INSERT INTO uzivatel_role 
    57 (role, prezdivka) 
    58 VALUES
    59 ('bezny', new.prezdivka);
    60 RETURN new;
    61 END;$$;
    62 
    63 
    64 ALTER FUNCTION nekurak.bezny_uzivatel() OWNER TO nekurak;
    65 
    66 --
    67 -- TOC entry 1927 (class 0 OID 0)
    68 -- Dependencies: 65
    69 -- Name: FUNCTION bezny_uzivatel(); Type: COMMENT; Schema: nekurak; Owner: nekurak
    70 --
    71 
    72 COMMENT ON FUNCTION bezny_uzivatel() IS 'Každému novému uživateli dáme automaticky roli „bezny“.';
    73 
    74 
    75 --
    76 -- TOC entry 1605 (class 1259 OID 35223)
    77 -- Dependencies: 10
    78 -- Name: clanek_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
    79 --
    80 
    81 CREATE SEQUENCE clanek_seq
    82     INCREMENT BY 1
    83     NO MAXVALUE
    84     NO MINVALUE
    85     CACHE 1;
    86 
    87 
    88 ALTER TABLE nekurak.clanek_seq OWNER TO nekurak;
    89 
    90 SET default_tablespace = '';
    91 
    92 SET default_with_oids = false;
    93 
    94 --
    95 -- TOC entry 1604 (class 1259 OID 35205)
    96 -- Dependencies: 1888 10
    97 -- Name: clanek; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
    98 --
    99 
   100 CREATE TABLE clanek (
   101     id integer DEFAULT nextval('clanek_seq'::regclass) NOT NULL,
   102     nadpis character varying(255) NOT NULL,
   103     text text
   104 );
   105 
   106 
   107 ALTER TABLE nekurak.clanek OWNER TO nekurak;
   108 
   109 --
   110 -- TOC entry 1929 (class 0 OID 0)
   111 -- Dependencies: 1604
   112 -- Name: TABLE clanek; Type: COMMENT; Schema: nekurak; Owner: nekurak
   113 --
   114 
   115 COMMENT ON TABLE clanek IS 'Článek potažmo stránka – nějaký textový obsah, (XúHTML.';
   116 
   117 
   118 --
   119 -- TOC entry 1602 (class 1259 OID 35183)
   120 -- Dependencies: 10
   121 -- Name: fotka_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   122 --
   123 
   124 CREATE SEQUENCE fotka_seq
   125     START WITH 1
   126     INCREMENT BY 1
   127     NO MAXVALUE
   128     NO MINVALUE
   129     CACHE 1;
   130 
   131 
   132 ALTER TABLE nekurak.fotka_seq OWNER TO nekurak;
   133 
   134 --
   135 -- TOC entry 1603 (class 1259 OID 35185)
   136 -- Dependencies: 1886 1887 10
   137 -- Name: fotka; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   138 --
   139 
   140 CREATE TABLE fotka (
   141     id integer DEFAULT nextval('fotka_seq'::regclass) NOT NULL,
   142     podnik integer NOT NULL,
   143     popis character varying(255),
   144     poradi integer DEFAULT 0 NOT NULL
   145 );
   146 
   147 
   148 ALTER TABLE nekurak.fotka OWNER TO nekurak;
   149 
   150 --
   151 -- TOC entry 1932 (class 0 OID 0)
   152 -- Dependencies: 1603
   153 -- Name: TABLE fotka; Type: COMMENT; Schema: nekurak; Owner: nekurak
   154 --
   155 
   156 COMMENT ON TABLE fotka IS 'Fotka podniku.';
   157 
   158 
   159 --
   160 -- TOC entry 1933 (class 0 OID 0)
   161 -- Dependencies: 1603
   162 -- Name: COLUMN fotka.poradi; Type: COMMENT; Schema: nekurak; Owner: nekurak
   163 --
   164 
   165 COMMENT ON COLUMN fotka.poradi IS 'Pořadí fotky v rámci daného podniku.';
   166 
   167 
   168 --
   169 -- TOC entry 1607 (class 1259 OID 35250)
   170 -- Dependencies: 10
   171 -- Name: hlasovani_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   172 --
   173 
   174 CREATE SEQUENCE hlasovani_seq
   175     INCREMENT BY 1
   176     NO MAXVALUE
   177     NO MINVALUE
   178     CACHE 1;
   179 
   180 
   181 ALTER TABLE nekurak.hlasovani_seq OWNER TO nekurak;
   182 
   183 --
   184 -- TOC entry 1608 (class 1259 OID 35278)
   185 -- Dependencies: 1889 1890 10
   186 -- Name: hlasovani; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   187 --
   188 
   189 CREATE TABLE hlasovani (
   190     id integer DEFAULT nextval('hlasovani_seq'::regclass) NOT NULL,
   191     podnik integer NOT NULL,
   192     hlas boolean NOT NULL,
   193     datum timestamp without time zone DEFAULT now() NOT NULL,
   194     ip_adresa character varying(255) NOT NULL
   195 );
   196 
   197 
   198 ALTER TABLE nekurak.hlasovani OWNER TO nekurak;
   199 
   200 --
   201 -- TOC entry 1936 (class 0 OID 0)
   202 -- Dependencies: 1608
   203 -- Name: COLUMN hlasovani.id; Type: COMMENT; Schema: nekurak; Owner: nekurak
   204 --
   205 
   206 COMMENT ON COLUMN hlasovani.id IS 'V této tabulce v princupu ID nepotřebujeme,
   207 protože nebudeme adresovat konkrétní záznamy (a i kdyby, můžeme použít OID).
   208 Ale číselné ID se nám bude hodit pro rychlejší nalezení posledního hlasu od dané IP adresy.';
   209 
   210 
   211 --
   212 -- TOC entry 1937 (class 0 OID 0)
   213 -- Dependencies: 1608
   214 -- Name: COLUMN hlasovani.hlas; Type: COMMENT; Schema: nekurak; Owner: nekurak
   215 --
   216 
   217 COMMENT ON COLUMN hlasovani.hlas IS 'Má být tento podnik nekuřácký?
   218 true = nekuřácký
   219 false = kouření povoleno';
   220 
   221 
   222 --
   223 -- TOC entry 1609 (class 1259 OID 35333)
   224 -- Dependencies: 10
   225 -- Name: komentar_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   226 --
   227 
   228 CREATE SEQUENCE komentar_seq
   229     INCREMENT BY 1
   230     NO MAXVALUE
   231     NO MINVALUE
   232     CACHE 1;
   233 
   234 
   235 ALTER TABLE nekurak.komentar_seq OWNER TO nekurak;
   236 
   237 --
   238 -- TOC entry 1610 (class 1259 OID 35376)
   239 -- Dependencies: 1891 1892 10
   240 -- Name: komentar; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   241 --
   242 
   243 CREATE TABLE komentar (
   244     id integer DEFAULT nextval('komentar_seq'::regclass) NOT NULL,
   245     podnik integer NOT NULL,
   246     uzivatel character varying(64) NOT NULL,
   247     datum timestamp with time zone DEFAULT now() NOT NULL,
   248     nadpis character varying(255),
   249     komentar text NOT NULL
   250 );
   251 
   252 
   253 ALTER TABLE nekurak.komentar OWNER TO nekurak;
   254 
   255 --
   256 -- TOC entry 1940 (class 0 OID 0)
   257 -- Dependencies: 1610
   258 -- Name: TABLE komentar; Type: COMMENT; Schema: nekurak; Owner: nekurak
   259 --
   260 
   261 COMMENT ON TABLE komentar IS 'Komentář k podniku';
   262 
   263 
   264 --
   265 -- TOC entry 1941 (class 0 OID 0)
   266 -- Dependencies: 1610
   267 -- Name: COLUMN komentar.nadpis; Type: COMMENT; Schema: nekurak; Owner: nekurak
   268 --
   269 
   270 COMMENT ON COLUMN komentar.nadpis IS 'vždy jen prostý text';
   271 
   272 
   273 --
   274 -- TOC entry 1942 (class 0 OID 0)
   275 -- Dependencies: 1610
   276 -- Name: COLUMN komentar.komentar; Type: COMMENT; Schema: nekurak; Owner: nekurak
   277 --
   278 
   279 COMMENT ON COLUMN komentar.komentar IS 'Vlastní komentář. Vždy jen XHTML – převádíme na něj jak prostý text, tak Texy nebo cokoli jiného.
   280 Jedná se o kus validního XML – má kořenový element <div/>';
   281 
   282 
   283 --
   284 -- TOC entry 1596 (class 1259 OID 35019)
   285 -- Dependencies: 10
   286 -- Name: podnik_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   287 --
   288 
   289 CREATE SEQUENCE podnik_seq
   290     INCREMENT BY 1
   291     NO MAXVALUE
   292     NO MINVALUE
   293     CACHE 1;
   294 
   295 
   296 ALTER TABLE nekurak.podnik_seq OWNER TO nekurak;
   297 
   298 --
   299 -- TOC entry 1597 (class 1259 OID 35049)
   300 -- Dependencies: 1882 1883 10
   301 -- Name: podnik; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   302 --
   303 
   304 CREATE TABLE podnik (
   305     id integer DEFAULT nextval('podnik_seq'::regclass) NOT NULL,
   306     nazev character varying(255) NOT NULL,
   307     popis character varying(255),
   308     url character varying(255),
   309     datum timestamp with time zone DEFAULT now(),
   310     ulice character varying(64),
   311     cislo_popisne integer,
   312     mesto character varying(64),
   313     spravce character varying(64),
   314     sirka double precision,
   315     delka double precision
   316 );
   317 
   318 
   319 ALTER TABLE nekurak.podnik OWNER TO nekurak;
   320 
   321 --
   322 -- TOC entry 1945 (class 0 OID 0)
   323 -- Dependencies: 1597
   324 -- Name: COLUMN podnik.spravce; Type: COMMENT; Schema: nekurak; Owner: nekurak
   325 --
   326 
   327 COMMENT ON COLUMN podnik.spravce IS 'Přezdívka uživatele, který je správcem tohoto podniku (zadal ho do systému nebo správcovství později dostal)';
   328 
   329 
   330 --
   331 -- TOC entry 1600 (class 1259 OID 35101)
   332 -- Dependencies: 10
   333 -- Name: role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   334 --
   335 
   336 CREATE TABLE role (
   337     kod character varying(16) NOT NULL,
   338     popis character varying(255)
   339 );
   340 
   341 
   342 ALTER TABLE nekurak.role OWNER TO nekurak;
   343 
   344 --
   345 -- TOC entry 1947 (class 0 OID 0)
   346 -- Dependencies: 1600
   347 -- Name: TABLE role; Type: COMMENT; Schema: nekurak; Owner: nekurak
   348 --
   349 
   350 COMMENT ON TABLE role IS 'Role (skupiny) uživatelů ~ oprávnění';
   351 
   352 
   353 --
   354 -- TOC entry 1598 (class 1259 OID 35080)
   355 -- Dependencies: 10
   356 -- Name: uzivatel_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   357 --
   358 
   359 CREATE SEQUENCE uzivatel_seq
   360     INCREMENT BY 1
   361     NO MAXVALUE
   362     NO MINVALUE
   363     CACHE 1;
   364 
   365 
   366 ALTER TABLE nekurak.uzivatel_seq OWNER TO nekurak;
   367 
   368 --
   369 -- TOC entry 1599 (class 1259 OID 35091)
   370 -- Dependencies: 1884 1885 10
   371 -- Name: uzivatel; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   372 --
   373 
   374 CREATE TABLE uzivatel (
   375     id integer DEFAULT nextval('uzivatel_seq'::regclass) NOT NULL,
   376     prezdivka character varying(64) NOT NULL,
   377     heslo character varying(512) NOT NULL,
   378     jmeno character varying(64),
   379     prijmeni character varying(64),
   380     email character varying(255),
   381     datum timestamp with time zone DEFAULT now() NOT NULL
   382 );
   383 
   384 
   385 ALTER TABLE nekurak.uzivatel OWNER TO nekurak;
   386 
   387 --
   388 -- TOC entry 1950 (class 0 OID 0)
   389 -- Dependencies: 1599
   390 -- Name: COLUMN uzivatel.prezdivka; Type: COMMENT; Schema: nekurak; Owner: nekurak
   391 --
   392 
   393 COMMENT ON COLUMN uzivatel.prezdivka IS 'Uživatelské jméno';
   394 
   395 
   396 --
   397 -- TOC entry 1601 (class 1259 OID 35106)
   398 -- Dependencies: 10
   399 -- Name: uzivatel_role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   400 --
   401 
   402 CREATE TABLE uzivatel_role (
   403     role character varying(16) NOT NULL,
   404     prezdivka character varying(64) NOT NULL
   405 );
   406 
   407 
   408 ALTER TABLE nekurak.uzivatel_role OWNER TO nekurak;
   409 
   410 --
   411 -- TOC entry 1952 (class 0 OID 0)
   412 -- Dependencies: 1601
   413 -- Name: TABLE uzivatel_role; Type: COMMENT; Schema: nekurak; Owner: nekurak
   414 --
   415 
   416 COMMENT ON TABLE uzivatel_role IS 'Přiřazení uživatelských rolí (skupin).';
   417 
   418 
   419 --
   420 -- TOC entry 1908 (class 2606 OID 35227)
   421 -- Dependencies: 1604 1604
   422 -- Name: clanek_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   423 --
   424 
   425 ALTER TABLE ONLY clanek
   426     ADD CONSTRAINT clanek_pk PRIMARY KEY (id);
   427 
   428 
   429 --
   430 -- TOC entry 1904 (class 2606 OID 35190)
   431 -- Dependencies: 1603 1603
   432 -- Name: fotka_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   433 --
   434 
   435 ALTER TABLE ONLY fotka
   436     ADD CONSTRAINT fotka_pk PRIMARY KEY (id);
   437 
   438 
   439 --
   440 -- TOC entry 1906 (class 2606 OID 35204)
   441 -- Dependencies: 1603 1603 1603
   442 -- Name: fotka_poradi_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   443 --
   444 
   445 ALTER TABLE ONLY fotka
   446     ADD CONSTRAINT fotka_poradi_uq UNIQUE (popis, poradi);
   447 
   448 
   449 --
   450 -- TOC entry 1911 (class 2606 OID 35284)
   451 -- Dependencies: 1608 1608
   452 -- Name: hlasovani_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   453 --
   454 
   455 ALTER TABLE ONLY hlasovani
   456     ADD CONSTRAINT hlasovani_pk PRIMARY KEY (id);
   457 
   458 
   459 --
   460 -- TOC entry 1914 (class 2606 OID 35385)
   461 -- Dependencies: 1610 1610
   462 -- Name: komentar_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   463 --
   464 
   465 ALTER TABLE ONLY komentar
   466     ADD CONSTRAINT komentar_pk PRIMARY KEY (id);
   467 
   468 
   469 --
   470 -- TOC entry 1894 (class 2606 OID 35058)
   471 -- Dependencies: 1597 1597
   472 -- Name: podnik_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   473 --
   474 
   475 ALTER TABLE ONLY podnik
   476     ADD CONSTRAINT podnik_pk PRIMARY KEY (id);
   477 
   478 
   479 --
   480 -- TOC entry 1900 (class 2606 OID 35105)
   481 -- Dependencies: 1600 1600
   482 -- Name: skupina_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   483 --
   484 
   485 ALTER TABLE ONLY role
   486     ADD CONSTRAINT skupina_pk PRIMARY KEY (kod);
   487 
   488 
   489 --
   490 -- TOC entry 1896 (class 2606 OID 35098)
   491 -- Dependencies: 1599 1599
   492 -- Name: uzivatel_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   493 --
   494 
   495 ALTER TABLE ONLY uzivatel
   496     ADD CONSTRAINT uzivatel_pk PRIMARY KEY (id);
   497 
   498 
   499 --
   500 -- TOC entry 1898 (class 2606 OID 35100)
   501 -- Dependencies: 1599 1599
   502 -- Name: uzivatel_prezdivka_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   503 --
   504 
   505 ALTER TABLE ONLY uzivatel
   506     ADD CONSTRAINT uzivatel_prezdivka_uq UNIQUE (prezdivka);
   507 
   508 
   509 --
   510 -- TOC entry 1902 (class 2606 OID 35137)
   511 -- Dependencies: 1601 1601 1601
   512 -- Name: uzivatel_role_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   513 --
   514 
   515 ALTER TABLE ONLY uzivatel_role
   516     ADD CONSTRAINT uzivatel_role_pk PRIMARY KEY (role, prezdivka);
   517 
   518 
   519 --
   520 -- TOC entry 1909 (class 1259 OID 35291)
   521 -- Dependencies: 1608
   522 -- Name: hlasovani_ip_idx; Type: INDEX; Schema: nekurak; Owner: nekurak; Tablespace: 
   523 --
   524 
   525 CREATE INDEX hlasovani_ip_idx ON hlasovani USING btree (ip_adresa);
   526 
   527 
   528 --
   529 -- TOC entry 1912 (class 1259 OID 35309)
   530 -- Dependencies: 1608
   531 -- Name: hlsovani_datum_idx; Type: INDEX; Schema: nekurak; Owner: nekurak; Tablespace: 
   532 --
   533 
   534 CREATE INDEX hlsovani_datum_idx ON hlasovani USING btree (date(datum));
   535 
   536 
   537 --
   538 -- TOC entry 1922 (class 2620 OID 35125)
   539 -- Dependencies: 1599 65
   540 -- Name: uzivatel_insert; Type: TRIGGER; Schema: nekurak; Owner: nekurak
   541 --
   542 
   543 CREATE TRIGGER uzivatel_insert
   544     AFTER INSERT ON uzivatel
   545     FOR EACH ROW
   546     EXECUTE PROCEDURE bezny_uzivatel();
   547 
   548 
   549 --
   550 -- TOC entry 1918 (class 2606 OID 35191)
   551 -- Dependencies: 1893 1597 1603
   552 -- Name: fotka_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   553 --
   554 
   555 ALTER TABLE ONLY fotka
   556     ADD CONSTRAINT fotka_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
   557 
   558 
   559 --
   560 -- TOC entry 1919 (class 2606 OID 35285)
   561 -- Dependencies: 1597 1608 1893
   562 -- Name: hlasovani_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   563 --
   564 
   565 ALTER TABLE ONLY hlasovani
   566     ADD CONSTRAINT hlasovani_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
   567 
   568 
   569 --
   570 -- TOC entry 1920 (class 2606 OID 35386)
   571 -- Dependencies: 1610 1893 1597
   572 -- Name: komentar_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   573 --
   574 
   575 ALTER TABLE ONLY komentar
   576     ADD CONSTRAINT komentar_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id);
   577 
   578 
   579 --
   580 -- TOC entry 1921 (class 2606 OID 35391)
   581 -- Dependencies: 1599 1897 1610
   582 -- Name: komentar_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   583 --
   584 
   585 ALTER TABLE ONLY komentar
   586     ADD CONSTRAINT komentar_uzivatel_fk FOREIGN KEY (uzivatel) REFERENCES uzivatel(prezdivka);
   587 
   588 
   589 --
   590 -- TOC entry 1915 (class 2606 OID 35178)
   591 -- Dependencies: 1599 1897 1597
   592 -- Name: podnik_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   593 --
   594 
   595 ALTER TABLE ONLY podnik
   596     ADD CONSTRAINT podnik_uzivatel_fk FOREIGN KEY (spravce) REFERENCES uzivatel(prezdivka) ON DELETE SET NULL;
   597 
   598 
   599 --
   600 -- TOC entry 1916 (class 2606 OID 35138)
   601 -- Dependencies: 1600 1601 1899
   602 -- Name: uzivatel_role_role_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   603 --
   604 
   605 ALTER TABLE ONLY uzivatel_role
   606     ADD CONSTRAINT uzivatel_role_role_fk FOREIGN KEY (role) REFERENCES role(kod) ON UPDATE CASCADE ON DELETE CASCADE;
   607 
   608 
   609 --
   610 -- TOC entry 1917 (class 2606 OID 35143)
   611 -- Dependencies: 1599 1897 1601
   612 -- Name: uzivatel_role_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   613 --
   614 
   615 ALTER TABLE ONLY uzivatel_role
   616     ADD CONSTRAINT uzivatel_role_uzivatel_fk FOREIGN KEY (prezdivka) REFERENCES uzivatel(prezdivka) ON UPDATE CASCADE ON DELETE CASCADE;
   617 
   618 
   619 --
   620 -- TOC entry 1925 (class 0 OID 0)
   621 -- Dependencies: 10
   622 -- Name: nekurak; Type: ACL; Schema: -; Owner: nekurak
   623 --
   624 
   625 REVOKE ALL ON SCHEMA nekurak FROM PUBLIC;
   626 REVOKE ALL ON SCHEMA nekurak FROM nekurak;
   627 GRANT ALL ON SCHEMA nekurak TO nekurak;
   628 GRANT USAGE ON SCHEMA nekurak TO nekurak_web;
   629 
   630 
   631 --
   632 -- TOC entry 1928 (class 0 OID 0)
   633 -- Dependencies: 1605
   634 -- Name: clanek_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   635 --
   636 
   637 REVOKE ALL ON SEQUENCE clanek_seq FROM PUBLIC;
   638 REVOKE ALL ON SEQUENCE clanek_seq FROM nekurak;
   639 GRANT ALL ON SEQUENCE clanek_seq TO nekurak;
   640 GRANT USAGE ON SEQUENCE clanek_seq TO nekurak_web;
   641 
   642 
   643 --
   644 -- TOC entry 1930 (class 0 OID 0)
   645 -- Dependencies: 1604
   646 -- Name: clanek; Type: ACL; Schema: nekurak; Owner: nekurak
   647 --
   648 
   649 REVOKE ALL ON TABLE clanek FROM PUBLIC;
   650 REVOKE ALL ON TABLE clanek FROM nekurak;
   651 GRANT ALL ON TABLE clanek TO nekurak;
   652 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE clanek TO nekurak_web;
   653 
   654 
   655 --
   656 -- TOC entry 1931 (class 0 OID 0)
   657 -- Dependencies: 1602
   658 -- Name: fotka_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   659 --
   660 
   661 REVOKE ALL ON SEQUENCE fotka_seq FROM PUBLIC;
   662 REVOKE ALL ON SEQUENCE fotka_seq FROM nekurak;
   663 GRANT ALL ON SEQUENCE fotka_seq TO nekurak;
   664 GRANT USAGE ON SEQUENCE fotka_seq TO nekurak_web;
   665 
   666 
   667 --
   668 -- TOC entry 1934 (class 0 OID 0)
   669 -- Dependencies: 1603
   670 -- Name: fotka; Type: ACL; Schema: nekurak; Owner: nekurak
   671 --
   672 
   673 REVOKE ALL ON TABLE fotka FROM PUBLIC;
   674 REVOKE ALL ON TABLE fotka FROM nekurak;
   675 GRANT ALL ON TABLE fotka TO nekurak;
   676 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE fotka TO nekurak_web;
   677 
   678 
   679 --
   680 -- TOC entry 1935 (class 0 OID 0)
   681 -- Dependencies: 1607
   682 -- Name: hlasovani_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   683 --
   684 
   685 REVOKE ALL ON SEQUENCE hlasovani_seq FROM PUBLIC;
   686 REVOKE ALL ON SEQUENCE hlasovani_seq FROM nekurak;
   687 GRANT ALL ON SEQUENCE hlasovani_seq TO nekurak;
   688 GRANT USAGE ON SEQUENCE hlasovani_seq TO nekurak_web;
   689 
   690 
   691 --
   692 -- TOC entry 1938 (class 0 OID 0)
   693 -- Dependencies: 1608
   694 -- Name: hlasovani; Type: ACL; Schema: nekurak; Owner: nekurak
   695 --
   696 
   697 REVOKE ALL ON TABLE hlasovani FROM PUBLIC;
   698 REVOKE ALL ON TABLE hlasovani FROM nekurak;
   699 GRANT ALL ON TABLE hlasovani TO nekurak;
   700 GRANT SELECT,INSERT ON TABLE hlasovani TO nekurak_web;
   701 
   702 
   703 --
   704 -- TOC entry 1939 (class 0 OID 0)
   705 -- Dependencies: 1609
   706 -- Name: komentar_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   707 --
   708 
   709 REVOKE ALL ON SEQUENCE komentar_seq FROM PUBLIC;
   710 REVOKE ALL ON SEQUENCE komentar_seq FROM nekurak;
   711 GRANT ALL ON SEQUENCE komentar_seq TO nekurak;
   712 GRANT USAGE ON SEQUENCE komentar_seq TO nekurak_web;
   713 
   714 
   715 --
   716 -- TOC entry 1943 (class 0 OID 0)
   717 -- Dependencies: 1610
   718 -- Name: komentar; Type: ACL; Schema: nekurak; Owner: nekurak
   719 --
   720 
   721 REVOKE ALL ON TABLE komentar FROM PUBLIC;
   722 REVOKE ALL ON TABLE komentar FROM nekurak;
   723 GRANT ALL ON TABLE komentar TO nekurak;
   724 GRANT SELECT,INSERT ON TABLE komentar TO nekurak_web;
   725 
   726 
   727 --
   728 -- TOC entry 1944 (class 0 OID 0)
   729 -- Dependencies: 1596
   730 -- Name: podnik_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   731 --
   732 
   733 REVOKE ALL ON SEQUENCE podnik_seq FROM PUBLIC;
   734 REVOKE ALL ON SEQUENCE podnik_seq FROM nekurak;
   735 GRANT ALL ON SEQUENCE podnik_seq TO nekurak;
   736 GRANT USAGE ON SEQUENCE podnik_seq TO nekurak_web;
   737 
   738 
   739 --
   740 -- TOC entry 1946 (class 0 OID 0)
   741 -- Dependencies: 1597
   742 -- Name: podnik; Type: ACL; Schema: nekurak; Owner: nekurak
   743 --
   744 
   745 REVOKE ALL ON TABLE podnik FROM PUBLIC;
   746 REVOKE ALL ON TABLE podnik FROM nekurak;
   747 GRANT ALL ON TABLE podnik TO nekurak;
   748 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE podnik TO nekurak_web;
   749 
   750 
   751 --
   752 -- TOC entry 1948 (class 0 OID 0)
   753 -- Dependencies: 1600
   754 -- Name: role; Type: ACL; Schema: nekurak; Owner: nekurak
   755 --
   756 
   757 REVOKE ALL ON TABLE role FROM PUBLIC;
   758 REVOKE ALL ON TABLE role FROM nekurak;
   759 GRANT ALL ON TABLE role TO nekurak;
   760 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE role TO nekurak_web;
   761 
   762 
   763 --
   764 -- TOC entry 1949 (class 0 OID 0)
   765 -- Dependencies: 1598
   766 -- Name: uzivatel_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   767 --
   768 
   769 REVOKE ALL ON SEQUENCE uzivatel_seq FROM PUBLIC;
   770 REVOKE ALL ON SEQUENCE uzivatel_seq FROM nekurak;
   771 GRANT ALL ON SEQUENCE uzivatel_seq TO nekurak;
   772 GRANT USAGE ON SEQUENCE uzivatel_seq TO nekurak_web;
   773 
   774 
   775 --
   776 -- TOC entry 1951 (class 0 OID 0)
   777 -- Dependencies: 1599
   778 -- Name: uzivatel; Type: ACL; Schema: nekurak; Owner: nekurak
   779 --
   780 
   781 REVOKE ALL ON TABLE uzivatel FROM PUBLIC;
   782 REVOKE ALL ON TABLE uzivatel FROM nekurak;
   783 GRANT ALL ON TABLE uzivatel TO nekurak;
   784 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel TO nekurak_web;
   785 
   786 
   787 --
   788 -- TOC entry 1953 (class 0 OID 0)
   789 -- Dependencies: 1601
   790 -- Name: uzivatel_role; Type: ACL; Schema: nekurak; Owner: nekurak
   791 --
   792 
   793 REVOKE ALL ON TABLE uzivatel_role FROM PUBLIC;
   794 REVOKE ALL ON TABLE uzivatel_role FROM nekurak;
   795 GRANT ALL ON TABLE uzivatel_role TO nekurak;
   796 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel_role TO nekurak_web;
   797 
   798 
   799 -- Completed on 2010-06-09 15:52:28 CEST
   800 
   801 --
   802 -- PostgreSQL database dump complete
   803 --
   804