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