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