sql/schéma.sql
author František Kučera <franta-hg@frantovo.cz>
Sun, 09 Jan 2011 16:27:44 +0100
changeset 158 e1ac3efcd140
parent 154 bf21a4abea9b
child 163 5f0d5e1305b3
permissions -rw-r--r--
vylepšen detail podniku, modularizace, značky, css
     1 --
     2 -- PostgreSQL database dump
     3 --
     4 
     5 -- Started on 2011-01-08 19:54:48 CET
     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 1941 (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: 411 10
    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 1942 (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 1610 (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 1609 (class 1259 OID 35205)
    96 -- Dependencies: 1896 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 1944 (class 0 OID 0)
   111 -- Dependencies: 1609
   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 (XHTML).';
   116 
   117 
   118 --
   119 -- TOC entry 1607 (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 1608 (class 1259 OID 35185)
   136 -- Dependencies: 1894 1895 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 1947 (class 0 OID 0)
   152 -- Dependencies: 1608
   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 1948 (class 0 OID 0)
   161 -- Dependencies: 1608
   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 1612 (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 1613 (class 1259 OID 35278)
   185 -- Dependencies: 1897 1898 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 1951 (class 0 OID 0)
   202 -- Dependencies: 1613
   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 1952 (class 0 OID 0)
   213 -- Dependencies: 1613
   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 1616 (class 1259 OID 35396)
   224 -- Dependencies: 10
   225 -- Name: kategorie_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   226 --
   227 
   228 CREATE SEQUENCE kategorie_seq
   229     INCREMENT BY 1
   230     NO MAXVALUE
   231     NO MINVALUE
   232     CACHE 1;
   233 
   234 
   235 ALTER TABLE nekurak.kategorie_seq OWNER TO nekurak;
   236 
   237 --
   238 -- TOC entry 1617 (class 1259 OID 35398)
   239 -- Dependencies: 1901 10
   240 -- Name: kategorie; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   241 --
   242 
   243 CREATE TABLE kategorie (
   244     id integer DEFAULT nextval('kategorie_seq'::regclass) NOT NULL,
   245     nazev character varying(32) NOT NULL,
   246     popis character varying(255)
   247 );
   248 
   249 
   250 ALTER TABLE nekurak.kategorie OWNER TO nekurak;
   251 
   252 --
   253 -- TOC entry 1955 (class 0 OID 0)
   254 -- Dependencies: 1617
   255 -- Name: TABLE kategorie; Type: COMMENT; Schema: nekurak; Owner: nekurak
   256 --
   257 
   258 COMMENT ON TABLE kategorie IS 'Kategorie podniku';
   259 
   260 
   261 --
   262 -- TOC entry 1614 (class 1259 OID 35333)
   263 -- Dependencies: 10
   264 -- Name: komentar_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   265 --
   266 
   267 CREATE SEQUENCE komentar_seq
   268     INCREMENT BY 1
   269     NO MAXVALUE
   270     NO MINVALUE
   271     CACHE 1;
   272 
   273 
   274 ALTER TABLE nekurak.komentar_seq OWNER TO nekurak;
   275 
   276 --
   277 -- TOC entry 1615 (class 1259 OID 35376)
   278 -- Dependencies: 1899 1900 10
   279 -- Name: komentar; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   280 --
   281 
   282 CREATE TABLE komentar (
   283     id integer DEFAULT nextval('komentar_seq'::regclass) NOT NULL,
   284     podnik integer NOT NULL,
   285     uzivatel character varying(64) NOT NULL,
   286     datum timestamp with time zone DEFAULT now() NOT NULL,
   287     nadpis character varying(255),
   288     komentar text NOT NULL
   289 );
   290 
   291 
   292 ALTER TABLE nekurak.komentar OWNER TO nekurak;
   293 
   294 --
   295 -- TOC entry 1958 (class 0 OID 0)
   296 -- Dependencies: 1615
   297 -- Name: TABLE komentar; Type: COMMENT; Schema: nekurak; Owner: nekurak
   298 --
   299 
   300 COMMENT ON TABLE komentar IS 'Komentář k podniku';
   301 
   302 
   303 --
   304 -- TOC entry 1959 (class 0 OID 0)
   305 -- Dependencies: 1615
   306 -- Name: COLUMN komentar.nadpis; Type: COMMENT; Schema: nekurak; Owner: nekurak
   307 --
   308 
   309 COMMENT ON COLUMN komentar.nadpis IS 'vždy jen prostý text';
   310 
   311 
   312 --
   313 -- TOC entry 1960 (class 0 OID 0)
   314 -- Dependencies: 1615
   315 -- Name: COLUMN komentar.komentar; Type: COMMENT; Schema: nekurak; Owner: nekurak
   316 --
   317 
   318 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.
   319 Jedná se o kus validního XML – má kořenový element <div/>';
   320 
   321 
   322 --
   323 -- TOC entry 1601 (class 1259 OID 35019)
   324 -- Dependencies: 10
   325 -- Name: podnik_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   326 --
   327 
   328 CREATE SEQUENCE podnik_seq
   329     INCREMENT BY 1
   330     NO MAXVALUE
   331     NO MINVALUE
   332     CACHE 1;
   333 
   334 
   335 ALTER TABLE nekurak.podnik_seq OWNER TO nekurak;
   336 
   337 --
   338 -- TOC entry 1602 (class 1259 OID 35049)
   339 -- Dependencies: 1890 1891 10
   340 -- Name: podnik; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   341 --
   342 
   343 CREATE TABLE podnik (
   344     id integer DEFAULT nextval('podnik_seq'::regclass) NOT NULL,
   345     nazev character varying(255) NOT NULL,
   346     popis character varying(255),
   347     url character varying(255),
   348     datum timestamp with time zone DEFAULT now(),
   349     ulice character varying(64),
   350     cislo_popisne integer,
   351     mesto character varying(64),
   352     spravce character varying(64),
   353     sirka double precision,
   354     delka double precision
   355 );
   356 
   357 
   358 ALTER TABLE nekurak.podnik OWNER TO nekurak;
   359 
   360 --
   361 -- TOC entry 1963 (class 0 OID 0)
   362 -- Dependencies: 1602
   363 -- Name: COLUMN podnik.spravce; Type: COMMENT; Schema: nekurak; Owner: nekurak
   364 --
   365 
   366 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)';
   367 
   368 
   369 --
   370 -- TOC entry 1618 (class 1259 OID 35404)
   371 -- Dependencies: 10
   372 -- Name: podnik_kategorie; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   373 --
   374 
   375 CREATE TABLE podnik_kategorie (
   376     podnik integer NOT NULL,
   377     kategorie integer NOT NULL
   378 );
   379 
   380 
   381 ALTER TABLE nekurak.podnik_kategorie OWNER TO nekurak;
   382 
   383 --
   384 -- TOC entry 1605 (class 1259 OID 35101)
   385 -- Dependencies: 10
   386 -- Name: role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   387 --
   388 
   389 CREATE TABLE role (
   390     kod character varying(16) NOT NULL,
   391     popis character varying(255)
   392 );
   393 
   394 
   395 ALTER TABLE nekurak.role OWNER TO nekurak;
   396 
   397 --
   398 -- TOC entry 1966 (class 0 OID 0)
   399 -- Dependencies: 1605
   400 -- Name: TABLE role; Type: COMMENT; Schema: nekurak; Owner: nekurak
   401 --
   402 
   403 COMMENT ON TABLE role IS 'Role (skupiny) uživatelů ~ oprávnění';
   404 
   405 
   406 --
   407 -- TOC entry 1603 (class 1259 OID 35080)
   408 -- Dependencies: 10
   409 -- Name: uzivatel_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
   410 --
   411 
   412 CREATE SEQUENCE uzivatel_seq
   413     INCREMENT BY 1
   414     NO MAXVALUE
   415     NO MINVALUE
   416     CACHE 1;
   417 
   418 
   419 ALTER TABLE nekurak.uzivatel_seq OWNER TO nekurak;
   420 
   421 --
   422 -- TOC entry 1604 (class 1259 OID 35091)
   423 -- Dependencies: 1892 1893 10
   424 -- Name: uzivatel; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   425 --
   426 
   427 CREATE TABLE uzivatel (
   428     id integer DEFAULT nextval('uzivatel_seq'::regclass) NOT NULL,
   429     prezdivka character varying(64) NOT NULL,
   430     heslo character varying(512) NOT NULL,
   431     jmeno character varying(64),
   432     prijmeni character varying(64),
   433     email character varying(255),
   434     datum timestamp with time zone DEFAULT now() NOT NULL
   435 );
   436 
   437 
   438 ALTER TABLE nekurak.uzivatel OWNER TO nekurak;
   439 
   440 --
   441 -- TOC entry 1969 (class 0 OID 0)
   442 -- Dependencies: 1604
   443 -- Name: COLUMN uzivatel.prezdivka; Type: COMMENT; Schema: nekurak; Owner: nekurak
   444 --
   445 
   446 COMMENT ON COLUMN uzivatel.prezdivka IS 'Uživatelské jméno';
   447 
   448 
   449 --
   450 -- TOC entry 1606 (class 1259 OID 35106)
   451 -- Dependencies: 10
   452 -- Name: uzivatel_role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
   453 --
   454 
   455 CREATE TABLE uzivatel_role (
   456     role character varying(16) NOT NULL,
   457     prezdivka character varying(64) NOT NULL
   458 );
   459 
   460 
   461 ALTER TABLE nekurak.uzivatel_role OWNER TO nekurak;
   462 
   463 --
   464 -- TOC entry 1971 (class 0 OID 0)
   465 -- Dependencies: 1606
   466 -- Name: TABLE uzivatel_role; Type: COMMENT; Schema: nekurak; Owner: nekurak
   467 --
   468 
   469 COMMENT ON TABLE uzivatel_role IS 'Přiřazení uživatelských rolí (skupin).';
   470 
   471 
   472 --
   473 -- TOC entry 1917 (class 2606 OID 35227)
   474 -- Dependencies: 1609 1609
   475 -- Name: clanek_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   476 --
   477 
   478 ALTER TABLE ONLY clanek
   479     ADD CONSTRAINT clanek_pk PRIMARY KEY (id);
   480 
   481 
   482 --
   483 -- TOC entry 1913 (class 2606 OID 35190)
   484 -- Dependencies: 1608 1608
   485 -- Name: fotka_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   486 --
   487 
   488 ALTER TABLE ONLY fotka
   489     ADD CONSTRAINT fotka_pk PRIMARY KEY (id);
   490 
   491 
   492 --
   493 -- TOC entry 1915 (class 2606 OID 35204)
   494 -- Dependencies: 1608 1608 1608
   495 -- Name: fotka_poradi_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   496 --
   497 
   498 ALTER TABLE ONLY fotka
   499     ADD CONSTRAINT fotka_poradi_uq UNIQUE (popis, poradi);
   500 
   501 
   502 --
   503 -- TOC entry 1920 (class 2606 OID 35284)
   504 -- Dependencies: 1613 1613
   505 -- Name: hlasovani_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   506 --
   507 
   508 ALTER TABLE ONLY hlasovani
   509     ADD CONSTRAINT hlasovani_pk PRIMARY KEY (id);
   510 
   511 
   512 --
   513 -- TOC entry 1925 (class 2606 OID 35403)
   514 -- Dependencies: 1617 1617
   515 -- Name: kategorie_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   516 --
   517 
   518 ALTER TABLE ONLY kategorie
   519     ADD CONSTRAINT kategorie_pk PRIMARY KEY (id);
   520 
   521 
   522 --
   523 -- TOC entry 1923 (class 2606 OID 35385)
   524 -- Dependencies: 1615 1615
   525 -- Name: komentar_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   526 --
   527 
   528 ALTER TABLE ONLY komentar
   529     ADD CONSTRAINT komentar_pk PRIMARY KEY (id);
   530 
   531 
   532 --
   533 -- TOC entry 1927 (class 2606 OID 35408)
   534 -- Dependencies: 1618 1618 1618
   535 -- Name: podnik_kategorie_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   536 --
   537 
   538 ALTER TABLE ONLY podnik_kategorie
   539     ADD CONSTRAINT podnik_kategorie_pk PRIMARY KEY (podnik, kategorie);
   540 
   541 
   542 --
   543 -- TOC entry 1903 (class 2606 OID 35058)
   544 -- Dependencies: 1602 1602
   545 -- Name: podnik_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   546 --
   547 
   548 ALTER TABLE ONLY podnik
   549     ADD CONSTRAINT podnik_pk PRIMARY KEY (id);
   550 
   551 
   552 --
   553 -- TOC entry 1909 (class 2606 OID 35105)
   554 -- Dependencies: 1605 1605
   555 -- Name: skupina_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   556 --
   557 
   558 ALTER TABLE ONLY role
   559     ADD CONSTRAINT skupina_pk PRIMARY KEY (kod);
   560 
   561 
   562 --
   563 -- TOC entry 1905 (class 2606 OID 35098)
   564 -- Dependencies: 1604 1604
   565 -- Name: uzivatel_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   566 --
   567 
   568 ALTER TABLE ONLY uzivatel
   569     ADD CONSTRAINT uzivatel_pk PRIMARY KEY (id);
   570 
   571 
   572 --
   573 -- TOC entry 1907 (class 2606 OID 35100)
   574 -- Dependencies: 1604 1604
   575 -- Name: uzivatel_prezdivka_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   576 --
   577 
   578 ALTER TABLE ONLY uzivatel
   579     ADD CONSTRAINT uzivatel_prezdivka_uq UNIQUE (prezdivka);
   580 
   581 
   582 --
   583 -- TOC entry 1911 (class 2606 OID 35137)
   584 -- Dependencies: 1606 1606 1606
   585 -- Name: uzivatel_role_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
   586 --
   587 
   588 ALTER TABLE ONLY uzivatel_role
   589     ADD CONSTRAINT uzivatel_role_pk PRIMARY KEY (role, prezdivka);
   590 
   591 
   592 --
   593 -- TOC entry 1918 (class 1259 OID 35291)
   594 -- Dependencies: 1613
   595 -- Name: hlasovani_ip_idx; Type: INDEX; Schema: nekurak; Owner: nekurak; Tablespace: 
   596 --
   597 
   598 CREATE INDEX hlasovani_ip_idx ON hlasovani USING btree (ip_adresa);
   599 
   600 
   601 --
   602 -- TOC entry 1921 (class 1259 OID 35309)
   603 -- Dependencies: 1613
   604 -- Name: hlsovani_datum_idx; Type: INDEX; Schema: nekurak; Owner: nekurak; Tablespace: 
   605 --
   606 
   607 CREATE INDEX hlsovani_datum_idx ON hlasovani USING btree (date(datum));
   608 
   609 
   610 --
   611 -- TOC entry 1937 (class 2620 OID 35125)
   612 -- Dependencies: 1604 65
   613 -- Name: uzivatel_insert; Type: TRIGGER; Schema: nekurak; Owner: nekurak
   614 --
   615 
   616 CREATE TRIGGER uzivatel_insert
   617     AFTER INSERT ON uzivatel
   618     FOR EACH ROW
   619     EXECUTE PROCEDURE bezny_uzivatel();
   620 
   621 
   622 --
   623 -- TOC entry 1931 (class 2606 OID 35191)
   624 -- Dependencies: 1608 1602 1902
   625 -- Name: fotka_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   626 --
   627 
   628 ALTER TABLE ONLY fotka
   629     ADD CONSTRAINT fotka_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
   630 
   631 
   632 --
   633 -- TOC entry 1932 (class 2606 OID 35285)
   634 -- Dependencies: 1602 1902 1613
   635 -- Name: hlasovani_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   636 --
   637 
   638 ALTER TABLE ONLY hlasovani
   639     ADD CONSTRAINT hlasovani_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
   640 
   641 
   642 --
   643 -- TOC entry 1933 (class 2606 OID 35386)
   644 -- Dependencies: 1615 1602 1902
   645 -- Name: komentar_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   646 --
   647 
   648 ALTER TABLE ONLY komentar
   649     ADD CONSTRAINT komentar_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id);
   650 
   651 
   652 --
   653 -- TOC entry 1934 (class 2606 OID 35391)
   654 -- Dependencies: 1615 1906 1604
   655 -- Name: komentar_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   656 --
   657 
   658 ALTER TABLE ONLY komentar
   659     ADD CONSTRAINT komentar_uzivatel_fk FOREIGN KEY (uzivatel) REFERENCES uzivatel(prezdivka);
   660 
   661 
   662 --
   663 -- TOC entry 1936 (class 2606 OID 35414)
   664 -- Dependencies: 1924 1618 1617
   665 -- Name: podnik_kategorie_kategorie_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   666 --
   667 
   668 ALTER TABLE ONLY podnik_kategorie
   669     ADD CONSTRAINT podnik_kategorie_kategorie_fk FOREIGN KEY (kategorie) REFERENCES kategorie(id) ON DELETE CASCADE;
   670 
   671 
   672 --
   673 -- TOC entry 1935 (class 2606 OID 35409)
   674 -- Dependencies: 1618 1902 1602
   675 -- Name: podnik_kategorie_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   676 --
   677 
   678 ALTER TABLE ONLY podnik_kategorie
   679     ADD CONSTRAINT podnik_kategorie_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
   680 
   681 
   682 --
   683 -- TOC entry 1928 (class 2606 OID 35178)
   684 -- Dependencies: 1602 1604 1906
   685 -- Name: podnik_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   686 --
   687 
   688 ALTER TABLE ONLY podnik
   689     ADD CONSTRAINT podnik_uzivatel_fk FOREIGN KEY (spravce) REFERENCES uzivatel(prezdivka) ON DELETE SET NULL;
   690 
   691 
   692 --
   693 -- TOC entry 1929 (class 2606 OID 35138)
   694 -- Dependencies: 1605 1908 1606
   695 -- Name: uzivatel_role_role_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   696 --
   697 
   698 ALTER TABLE ONLY uzivatel_role
   699     ADD CONSTRAINT uzivatel_role_role_fk FOREIGN KEY (role) REFERENCES role(kod) ON UPDATE CASCADE ON DELETE CASCADE;
   700 
   701 
   702 --
   703 -- TOC entry 1930 (class 2606 OID 35143)
   704 -- Dependencies: 1604 1606 1906
   705 -- Name: uzivatel_role_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
   706 --
   707 
   708 ALTER TABLE ONLY uzivatel_role
   709     ADD CONSTRAINT uzivatel_role_uzivatel_fk FOREIGN KEY (prezdivka) REFERENCES uzivatel(prezdivka) ON UPDATE CASCADE ON DELETE CASCADE;
   710 
   711 
   712 --
   713 -- TOC entry 1940 (class 0 OID 0)
   714 -- Dependencies: 10
   715 -- Name: nekurak; Type: ACL; Schema: -; Owner: nekurak
   716 --
   717 
   718 REVOKE ALL ON SCHEMA nekurak FROM PUBLIC;
   719 REVOKE ALL ON SCHEMA nekurak FROM nekurak;
   720 GRANT ALL ON SCHEMA nekurak TO nekurak;
   721 GRANT USAGE ON SCHEMA nekurak TO nekurak_web;
   722 
   723 
   724 --
   725 -- TOC entry 1943 (class 0 OID 0)
   726 -- Dependencies: 1610
   727 -- Name: clanek_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   728 --
   729 
   730 REVOKE ALL ON SEQUENCE clanek_seq FROM PUBLIC;
   731 REVOKE ALL ON SEQUENCE clanek_seq FROM nekurak;
   732 GRANT ALL ON SEQUENCE clanek_seq TO nekurak;
   733 GRANT USAGE ON SEQUENCE clanek_seq TO nekurak_web;
   734 
   735 
   736 --
   737 -- TOC entry 1945 (class 0 OID 0)
   738 -- Dependencies: 1609
   739 -- Name: clanek; Type: ACL; Schema: nekurak; Owner: nekurak
   740 --
   741 
   742 REVOKE ALL ON TABLE clanek FROM PUBLIC;
   743 REVOKE ALL ON TABLE clanek FROM nekurak;
   744 GRANT ALL ON TABLE clanek TO nekurak;
   745 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE clanek TO nekurak_web;
   746 
   747 
   748 --
   749 -- TOC entry 1946 (class 0 OID 0)
   750 -- Dependencies: 1607
   751 -- Name: fotka_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   752 --
   753 
   754 REVOKE ALL ON SEQUENCE fotka_seq FROM PUBLIC;
   755 REVOKE ALL ON SEQUENCE fotka_seq FROM nekurak;
   756 GRANT ALL ON SEQUENCE fotka_seq TO nekurak;
   757 GRANT USAGE ON SEQUENCE fotka_seq TO nekurak_web;
   758 
   759 
   760 --
   761 -- TOC entry 1949 (class 0 OID 0)
   762 -- Dependencies: 1608
   763 -- Name: fotka; Type: ACL; Schema: nekurak; Owner: nekurak
   764 --
   765 
   766 REVOKE ALL ON TABLE fotka FROM PUBLIC;
   767 REVOKE ALL ON TABLE fotka FROM nekurak;
   768 GRANT ALL ON TABLE fotka TO nekurak;
   769 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE fotka TO nekurak_web;
   770 
   771 
   772 --
   773 -- TOC entry 1950 (class 0 OID 0)
   774 -- Dependencies: 1612
   775 -- Name: hlasovani_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   776 --
   777 
   778 REVOKE ALL ON SEQUENCE hlasovani_seq FROM PUBLIC;
   779 REVOKE ALL ON SEQUENCE hlasovani_seq FROM nekurak;
   780 GRANT ALL ON SEQUENCE hlasovani_seq TO nekurak;
   781 GRANT USAGE ON SEQUENCE hlasovani_seq TO nekurak_web;
   782 
   783 
   784 --
   785 -- TOC entry 1953 (class 0 OID 0)
   786 -- Dependencies: 1613
   787 -- Name: hlasovani; Type: ACL; Schema: nekurak; Owner: nekurak
   788 --
   789 
   790 REVOKE ALL ON TABLE hlasovani FROM PUBLIC;
   791 REVOKE ALL ON TABLE hlasovani FROM nekurak;
   792 GRANT ALL ON TABLE hlasovani TO nekurak;
   793 GRANT SELECT,INSERT ON TABLE hlasovani TO nekurak_web;
   794 
   795 
   796 --
   797 -- TOC entry 1954 (class 0 OID 0)
   798 -- Dependencies: 1616
   799 -- Name: kategorie_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   800 --
   801 
   802 REVOKE ALL ON SEQUENCE kategorie_seq FROM PUBLIC;
   803 REVOKE ALL ON SEQUENCE kategorie_seq FROM nekurak;
   804 GRANT ALL ON SEQUENCE kategorie_seq TO nekurak;
   805 GRANT USAGE ON SEQUENCE kategorie_seq TO nekurak_web;
   806 
   807 
   808 --
   809 -- TOC entry 1956 (class 0 OID 0)
   810 -- Dependencies: 1617
   811 -- Name: kategorie; Type: ACL; Schema: nekurak; Owner: nekurak
   812 --
   813 
   814 REVOKE ALL ON TABLE kategorie FROM PUBLIC;
   815 REVOKE ALL ON TABLE kategorie FROM nekurak;
   816 GRANT ALL ON TABLE kategorie TO nekurak;
   817 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE kategorie TO nekurak_web;
   818 
   819 
   820 --
   821 -- TOC entry 1957 (class 0 OID 0)
   822 -- Dependencies: 1614
   823 -- Name: komentar_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   824 --
   825 
   826 REVOKE ALL ON SEQUENCE komentar_seq FROM PUBLIC;
   827 REVOKE ALL ON SEQUENCE komentar_seq FROM nekurak;
   828 GRANT ALL ON SEQUENCE komentar_seq TO nekurak;
   829 GRANT USAGE ON SEQUENCE komentar_seq TO nekurak_web;
   830 
   831 
   832 --
   833 -- TOC entry 1961 (class 0 OID 0)
   834 -- Dependencies: 1615
   835 -- Name: komentar; Type: ACL; Schema: nekurak; Owner: nekurak
   836 --
   837 
   838 REVOKE ALL ON TABLE komentar FROM PUBLIC;
   839 REVOKE ALL ON TABLE komentar FROM nekurak;
   840 GRANT ALL ON TABLE komentar TO nekurak;
   841 GRANT SELECT,INSERT ON TABLE komentar TO nekurak_web;
   842 
   843 
   844 --
   845 -- TOC entry 1962 (class 0 OID 0)
   846 -- Dependencies: 1601
   847 -- Name: podnik_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   848 --
   849 
   850 REVOKE ALL ON SEQUENCE podnik_seq FROM PUBLIC;
   851 REVOKE ALL ON SEQUENCE podnik_seq FROM nekurak;
   852 GRANT ALL ON SEQUENCE podnik_seq TO nekurak;
   853 GRANT USAGE ON SEQUENCE podnik_seq TO nekurak_web;
   854 
   855 
   856 --
   857 -- TOC entry 1964 (class 0 OID 0)
   858 -- Dependencies: 1602
   859 -- Name: podnik; Type: ACL; Schema: nekurak; Owner: nekurak
   860 --
   861 
   862 REVOKE ALL ON TABLE podnik FROM PUBLIC;
   863 REVOKE ALL ON TABLE podnik FROM nekurak;
   864 GRANT ALL ON TABLE podnik TO nekurak;
   865 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE podnik TO nekurak_web;
   866 
   867 
   868 --
   869 -- TOC entry 1965 (class 0 OID 0)
   870 -- Dependencies: 1618
   871 -- Name: podnik_kategorie; Type: ACL; Schema: nekurak; Owner: nekurak
   872 --
   873 
   874 REVOKE ALL ON TABLE podnik_kategorie FROM PUBLIC;
   875 REVOKE ALL ON TABLE podnik_kategorie FROM nekurak;
   876 GRANT ALL ON TABLE podnik_kategorie TO nekurak;
   877 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE podnik_kategorie TO nekurak_web;
   878 
   879 
   880 --
   881 -- TOC entry 1967 (class 0 OID 0)
   882 -- Dependencies: 1605
   883 -- Name: role; Type: ACL; Schema: nekurak; Owner: nekurak
   884 --
   885 
   886 REVOKE ALL ON TABLE role FROM PUBLIC;
   887 REVOKE ALL ON TABLE role FROM nekurak;
   888 GRANT ALL ON TABLE role TO nekurak;
   889 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE role TO nekurak_web;
   890 
   891 
   892 --
   893 -- TOC entry 1968 (class 0 OID 0)
   894 -- Dependencies: 1603
   895 -- Name: uzivatel_seq; Type: ACL; Schema: nekurak; Owner: nekurak
   896 --
   897 
   898 REVOKE ALL ON SEQUENCE uzivatel_seq FROM PUBLIC;
   899 REVOKE ALL ON SEQUENCE uzivatel_seq FROM nekurak;
   900 GRANT ALL ON SEQUENCE uzivatel_seq TO nekurak;
   901 GRANT USAGE ON SEQUENCE uzivatel_seq TO nekurak_web;
   902 
   903 
   904 --
   905 -- TOC entry 1970 (class 0 OID 0)
   906 -- Dependencies: 1604
   907 -- Name: uzivatel; Type: ACL; Schema: nekurak; Owner: nekurak
   908 --
   909 
   910 REVOKE ALL ON TABLE uzivatel FROM PUBLIC;
   911 REVOKE ALL ON TABLE uzivatel FROM nekurak;
   912 GRANT ALL ON TABLE uzivatel TO nekurak;
   913 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel TO nekurak_web;
   914 
   915 
   916 --
   917 -- TOC entry 1972 (class 0 OID 0)
   918 -- Dependencies: 1606
   919 -- Name: uzivatel_role; Type: ACL; Schema: nekurak; Owner: nekurak
   920 --
   921 
   922 REVOKE ALL ON TABLE uzivatel_role FROM PUBLIC;
   923 REVOKE ALL ON TABLE uzivatel_role FROM nekurak;
   924 GRANT ALL ON TABLE uzivatel_role TO nekurak;
   925 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel_role TO nekurak_web;
   926 
   927 
   928 -- Completed on 2011-01-08 19:54:50 CET
   929 
   930 --
   931 -- PostgreSQL database dump complete
   932 --
   933