SLQ: aktualizace datového modelu.
1.1 --- a/sql/schéma.sql Tue Mar 16 13:32:42 2010 +0100
1.2 +++ b/sql/schéma.sql Tue Mar 16 14:13:14 2010 +0100
1.3 @@ -2,7 +2,7 @@
1.4 -- PostgreSQL database dump
1.5 --
1.6
1.7 --- Started on 2010-03-09 20:48:44 CET
1.8 +-- Started on 2010-03-16 14:11:16 CET
1.9
1.10 SET statement_timeout = 0;
1.11 SET client_encoding = 'UTF8';
1.12 @@ -24,8 +24,8 @@
1.13 SET search_path = nekurak, pg_catalog;
1.14
1.15 --
1.16 --- TOC entry 369 (class 1247 OID 35086)
1.17 --- Dependencies: 370 10
1.18 +-- TOC entry 368 (class 1247 OID 35086)
1.19 +-- Dependencies: 369 10
1.20 -- Name: email; Type: DOMAIN; Schema: nekurak; Owner: nekurak
1.21 --
1.22
1.23 @@ -36,8 +36,8 @@
1.24 ALTER DOMAIN nekurak.email OWNER TO nekurak;
1.25
1.26 --
1.27 --- TOC entry 1881 (class 0 OID 0)
1.28 --- Dependencies: 369
1.29 +-- TOC entry 1892 (class 0 OID 0)
1.30 +-- Dependencies: 368
1.31 -- Name: DOMAIN email; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.32 --
1.33
1.34 @@ -46,7 +46,7 @@
1.35
1.36 --
1.37 -- TOC entry 65 (class 1255 OID 35124)
1.38 --- Dependencies: 10 392
1.39 +-- Dependencies: 395 10
1.40 -- Name: bezny_uzivatel(); Type: FUNCTION; Schema: nekurak; Owner: nekurak
1.41 --
1.42
1.43 @@ -64,7 +64,7 @@
1.44 ALTER FUNCTION nekurak.bezny_uzivatel() OWNER TO nekurak;
1.45
1.46 --
1.47 --- TOC entry 1882 (class 0 OID 0)
1.48 +-- TOC entry 1893 (class 0 OID 0)
1.49 -- Dependencies: 65
1.50 -- Name: FUNCTION bezny_uzivatel(); Type: COMMENT; Schema: nekurak; Owner: nekurak
1.51 --
1.52 @@ -72,13 +72,65 @@
1.53 COMMENT ON FUNCTION bezny_uzivatel() IS 'Každému novému uživateli dáme automaticky roli „bezny“.';
1.54
1.55
1.56 +--
1.57 +-- TOC entry 1592 (class 1259 OID 35183)
1.58 +-- Dependencies: 10
1.59 +-- Name: fotka_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
1.60 +--
1.61 +
1.62 +CREATE SEQUENCE fotka_seq
1.63 + START WITH 1
1.64 + INCREMENT BY 1
1.65 + NO MAXVALUE
1.66 + NO MINVALUE
1.67 + CACHE 1;
1.68 +
1.69 +
1.70 +ALTER TABLE nekurak.fotka_seq OWNER TO nekurak;
1.71 +
1.72 SET default_tablespace = '';
1.73
1.74 +SET default_with_oids = false;
1.75 +
1.76 +--
1.77 +-- TOC entry 1593 (class 1259 OID 35185)
1.78 +-- Dependencies: 1869 1870 10
1.79 +-- Name: fotka; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
1.80 +--
1.81 +
1.82 +CREATE TABLE fotka (
1.83 + id integer DEFAULT nextval('fotka_seq'::regclass) NOT NULL,
1.84 + podnik integer NOT NULL,
1.85 + popis character varying(255),
1.86 + poradi integer DEFAULT 0 NOT NULL
1.87 +);
1.88 +
1.89 +
1.90 +ALTER TABLE nekurak.fotka OWNER TO nekurak;
1.91 +
1.92 +--
1.93 +-- TOC entry 1895 (class 0 OID 0)
1.94 +-- Dependencies: 1593
1.95 +-- Name: TABLE fotka; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.96 +--
1.97 +
1.98 +COMMENT ON TABLE fotka IS 'Fotka podniku.';
1.99 +
1.100 +
1.101 +--
1.102 +-- TOC entry 1896 (class 0 OID 0)
1.103 +-- Dependencies: 1593
1.104 +-- Name: COLUMN fotka.poradi; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.105 +--
1.106 +
1.107 +COMMENT ON COLUMN fotka.poradi IS 'Pořadí fotky v rámci daného podniku.';
1.108 +
1.109 +
1.110 SET default_with_oids = true;
1.111
1.112 --
1.113 --- TOC entry 1584 (class 1259 OID 35068)
1.114 --- Dependencies: 1861 10
1.115 +-- TOC entry 1587 (class 1259 OID 35068)
1.116 +-- Dependencies: 1866 10
1.117 -- Name: hlasovani; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
1.118 --
1.119
1.120 @@ -93,8 +145,8 @@
1.121 ALTER TABLE nekurak.hlasovani OWNER TO nekurak;
1.122
1.123 --
1.124 --- TOC entry 1883 (class 0 OID 0)
1.125 --- Dependencies: 1584
1.126 +-- TOC entry 1898 (class 0 OID 0)
1.127 +-- Dependencies: 1587
1.128 -- Name: COLUMN hlasovani.hlas; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.129 --
1.130
1.131 @@ -104,7 +156,7 @@
1.132
1.133
1.134 --
1.135 --- TOC entry 1582 (class 1259 OID 35019)
1.136 +-- TOC entry 1585 (class 1259 OID 35019)
1.137 -- Dependencies: 10
1.138 -- Name: podnik_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
1.139 --
1.140 @@ -121,8 +173,8 @@
1.141 SET default_with_oids = false;
1.142
1.143 --
1.144 --- TOC entry 1583 (class 1259 OID 35049)
1.145 --- Dependencies: 1859 1860 10
1.146 +-- TOC entry 1586 (class 1259 OID 35049)
1.147 +-- Dependencies: 1864 1865 10
1.148 -- Name: podnik; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
1.149 --
1.150
1.151 @@ -134,14 +186,24 @@
1.152 datum timestamp with time zone DEFAULT now(),
1.153 ulice character varying(64),
1.154 cislo_popisne integer,
1.155 - mesto character varying(64)
1.156 + mesto character varying(64),
1.157 + spravce character varying(64)
1.158 );
1.159
1.160
1.161 ALTER TABLE nekurak.podnik OWNER TO nekurak;
1.162
1.163 --
1.164 --- TOC entry 1587 (class 1259 OID 35101)
1.165 +-- TOC entry 1901 (class 0 OID 0)
1.166 +-- Dependencies: 1586
1.167 +-- Name: COLUMN podnik.spravce; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.168 +--
1.169 +
1.170 +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)';
1.171 +
1.172 +
1.173 +--
1.174 +-- TOC entry 1590 (class 1259 OID 35101)
1.175 -- Dependencies: 10
1.176 -- Name: role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
1.177 --
1.178 @@ -155,8 +217,8 @@
1.179 ALTER TABLE nekurak.role OWNER TO nekurak;
1.180
1.181 --
1.182 --- TOC entry 1887 (class 0 OID 0)
1.183 --- Dependencies: 1587
1.184 +-- TOC entry 1903 (class 0 OID 0)
1.185 +-- Dependencies: 1590
1.186 -- Name: TABLE role; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.187 --
1.188
1.189 @@ -164,7 +226,7 @@
1.190
1.191
1.192 --
1.193 --- TOC entry 1585 (class 1259 OID 35080)
1.194 +-- TOC entry 1588 (class 1259 OID 35080)
1.195 -- Dependencies: 10
1.196 -- Name: uzivatel_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
1.197 --
1.198 @@ -179,8 +241,8 @@
1.199 ALTER TABLE nekurak.uzivatel_seq OWNER TO nekurak;
1.200
1.201 --
1.202 --- TOC entry 1586 (class 1259 OID 35091)
1.203 --- Dependencies: 1862 1863 10
1.204 +-- TOC entry 1589 (class 1259 OID 35091)
1.205 +-- Dependencies: 1867 1868 10
1.206 -- Name: uzivatel; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
1.207 --
1.208
1.209 @@ -198,8 +260,8 @@
1.210 ALTER TABLE nekurak.uzivatel OWNER TO nekurak;
1.211
1.212 --
1.213 --- TOC entry 1890 (class 0 OID 0)
1.214 --- Dependencies: 1586
1.215 +-- TOC entry 1906 (class 0 OID 0)
1.216 +-- Dependencies: 1589
1.217 -- Name: COLUMN uzivatel.prezdivka; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.218 --
1.219
1.220 @@ -207,7 +269,7 @@
1.221
1.222
1.223 --
1.224 --- TOC entry 1588 (class 1259 OID 35106)
1.225 +-- TOC entry 1591 (class 1259 OID 35106)
1.226 -- Dependencies: 10
1.227 -- Name: uzivatel_role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace:
1.228 --
1.229 @@ -221,8 +283,8 @@
1.230 ALTER TABLE nekurak.uzivatel_role OWNER TO nekurak;
1.231
1.232 --
1.233 --- TOC entry 1892 (class 0 OID 0)
1.234 --- Dependencies: 1588
1.235 +-- TOC entry 1908 (class 0 OID 0)
1.236 +-- Dependencies: 1591
1.237 -- Name: TABLE uzivatel_role; Type: COMMENT; Schema: nekurak; Owner: nekurak
1.238 --
1.239
1.240 @@ -230,8 +292,18 @@
1.241
1.242
1.243 --
1.244 --- TOC entry 1865 (class 2606 OID 35058)
1.245 --- Dependencies: 1583 1583
1.246 +-- TOC entry 1882 (class 2606 OID 35190)
1.247 +-- Dependencies: 1593 1593
1.248 +-- Name: fotka_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
1.249 +--
1.250 +
1.251 +ALTER TABLE ONLY fotka
1.252 + ADD CONSTRAINT fotka_pk PRIMARY KEY (id);
1.253 +
1.254 +
1.255 +--
1.256 +-- TOC entry 1872 (class 2606 OID 35058)
1.257 +-- Dependencies: 1586 1586
1.258 -- Name: podnik_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
1.259 --
1.260
1.261 @@ -240,8 +312,8 @@
1.262
1.263
1.264 --
1.265 --- TOC entry 1871 (class 2606 OID 35105)
1.266 --- Dependencies: 1587 1587
1.267 +-- TOC entry 1878 (class 2606 OID 35105)
1.268 +-- Dependencies: 1590 1590
1.269 -- Name: skupina_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
1.270 --
1.271
1.272 @@ -250,8 +322,8 @@
1.273
1.274
1.275 --
1.276 --- TOC entry 1867 (class 2606 OID 35098)
1.277 --- Dependencies: 1586 1586
1.278 +-- TOC entry 1874 (class 2606 OID 35098)
1.279 +-- Dependencies: 1589 1589
1.280 -- Name: uzivatel_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
1.281 --
1.282
1.283 @@ -260,8 +332,8 @@
1.284
1.285
1.286 --
1.287 --- TOC entry 1869 (class 2606 OID 35100)
1.288 --- Dependencies: 1586 1586
1.289 +-- TOC entry 1876 (class 2606 OID 35100)
1.290 +-- Dependencies: 1589 1589
1.291 -- Name: uzivatel_prezdivka_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
1.292 --
1.293
1.294 @@ -270,8 +342,8 @@
1.295
1.296
1.297 --
1.298 --- TOC entry 1873 (class 2606 OID 35137)
1.299 --- Dependencies: 1588 1588 1588
1.300 +-- TOC entry 1880 (class 2606 OID 35137)
1.301 +-- Dependencies: 1591 1591 1591
1.302 -- Name: uzivatel_role_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace:
1.303 --
1.304
1.305 @@ -280,8 +352,8 @@
1.306
1.307
1.308 --
1.309 --- TOC entry 1877 (class 2620 OID 35125)
1.310 --- Dependencies: 65 1586
1.311 +-- TOC entry 1888 (class 2620 OID 35125)
1.312 +-- Dependencies: 65 1589
1.313 -- Name: uzivatel_insert; Type: TRIGGER; Schema: nekurak; Owner: nekurak
1.314 --
1.315
1.316 @@ -292,8 +364,18 @@
1.317
1.318
1.319 --
1.320 --- TOC entry 1874 (class 2606 OID 35072)
1.321 --- Dependencies: 1864 1583 1584
1.322 +-- TOC entry 1887 (class 2606 OID 35191)
1.323 +-- Dependencies: 1871 1593 1586
1.324 +-- Name: fotka_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
1.325 +--
1.326 +
1.327 +ALTER TABLE ONLY fotka
1.328 + ADD CONSTRAINT fotka_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
1.329 +
1.330 +
1.331 +--
1.332 +-- TOC entry 1884 (class 2606 OID 35072)
1.333 +-- Dependencies: 1871 1586 1587
1.334 -- Name: hlasovani_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
1.335 --
1.336
1.337 @@ -302,8 +384,18 @@
1.338
1.339
1.340 --
1.341 --- TOC entry 1875 (class 2606 OID 35138)
1.342 --- Dependencies: 1870 1587 1588
1.343 +-- TOC entry 1883 (class 2606 OID 35178)
1.344 +-- Dependencies: 1875 1589 1586
1.345 +-- Name: podnik_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
1.346 +--
1.347 +
1.348 +ALTER TABLE ONLY podnik
1.349 + ADD CONSTRAINT podnik_uzivatel_fk FOREIGN KEY (spravce) REFERENCES uzivatel(prezdivka) ON DELETE SET NULL;
1.350 +
1.351 +
1.352 +--
1.353 +-- TOC entry 1885 (class 2606 OID 35138)
1.354 +-- Dependencies: 1590 1591 1877
1.355 -- Name: uzivatel_role_role_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
1.356 --
1.357
1.358 @@ -312,8 +404,8 @@
1.359
1.360
1.361 --
1.362 --- TOC entry 1876 (class 2606 OID 35143)
1.363 --- Dependencies: 1868 1586 1588
1.364 +-- TOC entry 1886 (class 2606 OID 35143)
1.365 +-- Dependencies: 1591 1589 1875
1.366 -- Name: uzivatel_role_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
1.367 --
1.368
1.369 @@ -322,7 +414,7 @@
1.370
1.371
1.372 --
1.373 --- TOC entry 1880 (class 0 OID 0)
1.374 +-- TOC entry 1891 (class 0 OID 0)
1.375 -- Dependencies: 10
1.376 -- Name: nekurak; Type: ACL; Schema: -; Owner: nekurak
1.377 --
1.378 @@ -334,8 +426,32 @@
1.379
1.380
1.381 --
1.382 --- TOC entry 1884 (class 0 OID 0)
1.383 --- Dependencies: 1584
1.384 +-- TOC entry 1894 (class 0 OID 0)
1.385 +-- Dependencies: 1592
1.386 +-- Name: fotka_seq; Type: ACL; Schema: nekurak; Owner: nekurak
1.387 +--
1.388 +
1.389 +REVOKE ALL ON SEQUENCE fotka_seq FROM PUBLIC;
1.390 +REVOKE ALL ON SEQUENCE fotka_seq FROM nekurak;
1.391 +GRANT ALL ON SEQUENCE fotka_seq TO nekurak;
1.392 +GRANT USAGE ON SEQUENCE fotka_seq TO nekurak_web;
1.393 +
1.394 +
1.395 +--
1.396 +-- TOC entry 1897 (class 0 OID 0)
1.397 +-- Dependencies: 1593
1.398 +-- Name: fotka; Type: ACL; Schema: nekurak; Owner: nekurak
1.399 +--
1.400 +
1.401 +REVOKE ALL ON TABLE fotka FROM PUBLIC;
1.402 +REVOKE ALL ON TABLE fotka FROM nekurak;
1.403 +GRANT ALL ON TABLE fotka TO nekurak;
1.404 +GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE fotka TO nekurak_web;
1.405 +
1.406 +
1.407 +--
1.408 +-- TOC entry 1899 (class 0 OID 0)
1.409 +-- Dependencies: 1587
1.410 -- Name: hlasovani; Type: ACL; Schema: nekurak; Owner: nekurak
1.411 --
1.412
1.413 @@ -346,8 +462,8 @@
1.414
1.415
1.416 --
1.417 --- TOC entry 1885 (class 0 OID 0)
1.418 --- Dependencies: 1582
1.419 +-- TOC entry 1900 (class 0 OID 0)
1.420 +-- Dependencies: 1585
1.421 -- Name: podnik_seq; Type: ACL; Schema: nekurak; Owner: nekurak
1.422 --
1.423
1.424 @@ -358,8 +474,8 @@
1.425
1.426
1.427 --
1.428 --- TOC entry 1886 (class 0 OID 0)
1.429 --- Dependencies: 1583
1.430 +-- TOC entry 1902 (class 0 OID 0)
1.431 +-- Dependencies: 1586
1.432 -- Name: podnik; Type: ACL; Schema: nekurak; Owner: nekurak
1.433 --
1.434
1.435 @@ -370,8 +486,8 @@
1.436
1.437
1.438 --
1.439 --- TOC entry 1888 (class 0 OID 0)
1.440 --- Dependencies: 1587
1.441 +-- TOC entry 1904 (class 0 OID 0)
1.442 +-- Dependencies: 1590
1.443 -- Name: role; Type: ACL; Schema: nekurak; Owner: nekurak
1.444 --
1.445
1.446 @@ -382,8 +498,8 @@
1.447
1.448
1.449 --
1.450 --- TOC entry 1889 (class 0 OID 0)
1.451 --- Dependencies: 1585
1.452 +-- TOC entry 1905 (class 0 OID 0)
1.453 +-- Dependencies: 1588
1.454 -- Name: uzivatel_seq; Type: ACL; Schema: nekurak; Owner: nekurak
1.455 --
1.456
1.457 @@ -394,8 +510,8 @@
1.458
1.459
1.460 --
1.461 --- TOC entry 1891 (class 0 OID 0)
1.462 --- Dependencies: 1586
1.463 +-- TOC entry 1907 (class 0 OID 0)
1.464 +-- Dependencies: 1589
1.465 -- Name: uzivatel; Type: ACL; Schema: nekurak; Owner: nekurak
1.466 --
1.467
1.468 @@ -406,8 +522,8 @@
1.469
1.470
1.471 --
1.472 --- TOC entry 1893 (class 0 OID 0)
1.473 --- Dependencies: 1588
1.474 +-- TOC entry 1909 (class 0 OID 0)
1.475 +-- Dependencies: 1591
1.476 -- Name: uzivatel_role; Type: ACL; Schema: nekurak; Owner: nekurak
1.477 --
1.478
1.479 @@ -417,7 +533,7 @@
1.480 GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel_role TO nekurak_web;
1.481
1.482
1.483 --- Completed on 2010-03-09 20:48:46 CET
1.484 +-- Completed on 2010-03-16 14:11:18 CET
1.485
1.486 --
1.487 -- PostgreSQL database dump complete