sql/schéma.sql
author František Kučera <franta-hg@frantovo.cz>
Mon, 05 Apr 2010 22:21:01 +0200
changeset 89 59ba044de164
parent 72 81c64c582a26
child 115 b278b6b2d552
permissions -rw-r--r--
Články – metody pro REST API.
franta-hg@18
     1
--
franta-hg@18
     2
-- PostgreSQL database dump
franta-hg@18
     3
--
franta-hg@18
     4
franta-hg@72
     5
-- Started on 2010-03-16 14:32:22 CET
franta-hg@18
     6
franta-hg@18
     7
SET statement_timeout = 0;
franta-hg@18
     8
SET client_encoding = 'UTF8';
franta-hg@18
     9
SET standard_conforming_strings = off;
franta-hg@18
    10
SET check_function_bodies = false;
franta-hg@18
    11
SET client_min_messages = warning;
franta-hg@18
    12
SET escape_string_warning = off;
franta-hg@18
    13
franta-hg@18
    14
--
franta-hg@18
    15
-- TOC entry 10 (class 2615 OID 35015)
franta-hg@18
    16
-- Name: nekurak; Type: SCHEMA; Schema: -; Owner: nekurak
franta-hg@18
    17
--
franta-hg@18
    18
franta-hg@18
    19
CREATE SCHEMA nekurak;
franta-hg@18
    20
franta-hg@18
    21
franta-hg@18
    22
ALTER SCHEMA nekurak OWNER TO nekurak;
franta-hg@18
    23
franta-hg@18
    24
SET search_path = nekurak, pg_catalog;
franta-hg@18
    25
franta-hg@18
    26
--
franta-hg@71
    27
-- TOC entry 368 (class 1247 OID 35086)
franta-hg@71
    28
-- Dependencies: 369 10
franta-hg@62
    29
-- Name: email; Type: DOMAIN; Schema: nekurak; Owner: nekurak
franta-hg@62
    30
--
franta-hg@62
    31
franta-hg@62
    32
CREATE DOMAIN email AS character varying(255)
franta-hg@62
    33
	CONSTRAINT email_regexp CHECK (((VALUE)::text ~ '^[_a-zA-Z0-9\\.\\-]+@[_a-zA-Z0-9\\.\\-]+\\.[a-zA-Z]{2,4}$'::text));
franta-hg@62
    34
franta-hg@62
    35
franta-hg@62
    36
ALTER DOMAIN nekurak.email OWNER TO nekurak;
franta-hg@62
    37
franta-hg@62
    38
--
franta-hg@72
    39
-- TOC entry 1894 (class 0 OID 0)
franta-hg@71
    40
-- Dependencies: 368
franta-hg@62
    41
-- Name: DOMAIN email; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@62
    42
--
franta-hg@62
    43
franta-hg@62
    44
COMMENT ON DOMAIN email IS 'e-mailová adresa';
franta-hg@62
    45
franta-hg@62
    46
franta-hg@62
    47
--
franta-hg@62
    48
-- TOC entry 65 (class 1255 OID 35124)
franta-hg@72
    49
-- Dependencies: 10 395
franta-hg@62
    50
-- Name: bezny_uzivatel(); Type: FUNCTION; Schema: nekurak; Owner: nekurak
franta-hg@62
    51
--
franta-hg@62
    52
franta-hg@62
    53
CREATE FUNCTION bezny_uzivatel() RETURNS trigger
franta-hg@62
    54
    LANGUAGE plpgsql
franta-hg@62
    55
    AS $$BEGIN
franta-hg@62
    56
INSERT INTO uzivatel_role 
franta-hg@62
    57
(role, prezdivka) 
franta-hg@62
    58
VALUES
franta-hg@62
    59
('bezny', new.prezdivka);
franta-hg@62
    60
RETURN new;
franta-hg@62
    61
END;$$;
franta-hg@62
    62
franta-hg@62
    63
franta-hg@62
    64
ALTER FUNCTION nekurak.bezny_uzivatel() OWNER TO nekurak;
franta-hg@62
    65
franta-hg@62
    66
--
franta-hg@72
    67
-- TOC entry 1895 (class 0 OID 0)
franta-hg@62
    68
-- Dependencies: 65
franta-hg@62
    69
-- Name: FUNCTION bezny_uzivatel(); Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@62
    70
--
franta-hg@62
    71
franta-hg@62
    72
COMMENT ON FUNCTION bezny_uzivatel() IS 'Každému novému uživateli dáme automaticky roli „bezny“.';
franta-hg@62
    73
franta-hg@62
    74
franta-hg@71
    75
--
franta-hg@71
    76
-- TOC entry 1592 (class 1259 OID 35183)
franta-hg@71
    77
-- Dependencies: 10
franta-hg@71
    78
-- Name: fotka_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
franta-hg@71
    79
--
franta-hg@71
    80
franta-hg@71
    81
CREATE SEQUENCE fotka_seq
franta-hg@71
    82
    START WITH 1
franta-hg@71
    83
    INCREMENT BY 1
franta-hg@71
    84
    NO MAXVALUE
franta-hg@71
    85
    NO MINVALUE
franta-hg@71
    86
    CACHE 1;
franta-hg@71
    87
franta-hg@71
    88
franta-hg@71
    89
ALTER TABLE nekurak.fotka_seq OWNER TO nekurak;
franta-hg@71
    90
franta-hg@62
    91
SET default_tablespace = '';
franta-hg@62
    92
franta-hg@71
    93
SET default_with_oids = false;
franta-hg@71
    94
franta-hg@71
    95
--
franta-hg@71
    96
-- TOC entry 1593 (class 1259 OID 35185)
franta-hg@71
    97
-- Dependencies: 1869 1870 10
franta-hg@71
    98
-- Name: fotka; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@71
    99
--
franta-hg@71
   100
franta-hg@71
   101
CREATE TABLE fotka (
franta-hg@71
   102
    id integer DEFAULT nextval('fotka_seq'::regclass) NOT NULL,
franta-hg@71
   103
    podnik integer NOT NULL,
franta-hg@71
   104
    popis character varying(255),
franta-hg@71
   105
    poradi integer DEFAULT 0 NOT NULL
franta-hg@71
   106
);
franta-hg@71
   107
franta-hg@71
   108
franta-hg@71
   109
ALTER TABLE nekurak.fotka OWNER TO nekurak;
franta-hg@71
   110
franta-hg@71
   111
--
franta-hg@72
   112
-- TOC entry 1897 (class 0 OID 0)
franta-hg@71
   113
-- Dependencies: 1593
franta-hg@71
   114
-- Name: TABLE fotka; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@71
   115
--
franta-hg@71
   116
franta-hg@71
   117
COMMENT ON TABLE fotka IS 'Fotka podniku.';
franta-hg@71
   118
franta-hg@71
   119
franta-hg@71
   120
--
franta-hg@72
   121
-- TOC entry 1898 (class 0 OID 0)
franta-hg@71
   122
-- Dependencies: 1593
franta-hg@71
   123
-- Name: COLUMN fotka.poradi; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@71
   124
--
franta-hg@71
   125
franta-hg@71
   126
COMMENT ON COLUMN fotka.poradi IS 'Pořadí fotky v rámci daného podniku.';
franta-hg@71
   127
franta-hg@71
   128
franta-hg@62
   129
SET default_with_oids = true;
franta-hg@62
   130
franta-hg@62
   131
--
franta-hg@71
   132
-- TOC entry 1587 (class 1259 OID 35068)
franta-hg@71
   133
-- Dependencies: 1866 10
franta-hg@62
   134
-- Name: hlasovani; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@62
   135
--
franta-hg@62
   136
franta-hg@62
   137
CREATE TABLE hlasovani (
franta-hg@62
   138
    podnik integer NOT NULL,
franta-hg@62
   139
    hlas boolean NOT NULL,
franta-hg@62
   140
    datum date DEFAULT now() NOT NULL,
franta-hg@62
   141
    ip_adresa character varying(255)
franta-hg@62
   142
);
franta-hg@62
   143
franta-hg@62
   144
franta-hg@62
   145
ALTER TABLE nekurak.hlasovani OWNER TO nekurak;
franta-hg@62
   146
franta-hg@62
   147
--
franta-hg@72
   148
-- TOC entry 1900 (class 0 OID 0)
franta-hg@71
   149
-- Dependencies: 1587
franta-hg@62
   150
-- Name: COLUMN hlasovani.hlas; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@62
   151
--
franta-hg@62
   152
franta-hg@62
   153
COMMENT ON COLUMN hlasovani.hlas IS 'Má být tento podnik nekuřácký?
franta-hg@62
   154
true = nekuřácký
franta-hg@62
   155
false = kouření povoleno';
franta-hg@62
   156
franta-hg@62
   157
franta-hg@62
   158
--
franta-hg@71
   159
-- TOC entry 1585 (class 1259 OID 35019)
franta-hg@18
   160
-- Dependencies: 10
franta-hg@18
   161
-- Name: podnik_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
franta-hg@18
   162
--
franta-hg@18
   163
franta-hg@18
   164
CREATE SEQUENCE podnik_seq
franta-hg@18
   165
    INCREMENT BY 1
franta-hg@18
   166
    NO MAXVALUE
franta-hg@18
   167
    NO MINVALUE
franta-hg@18
   168
    CACHE 1;
franta-hg@18
   169
franta-hg@18
   170
franta-hg@18
   171
ALTER TABLE nekurak.podnik_seq OWNER TO nekurak;
franta-hg@18
   172
franta-hg@18
   173
SET default_with_oids = false;
franta-hg@18
   174
franta-hg@18
   175
--
franta-hg@71
   176
-- TOC entry 1586 (class 1259 OID 35049)
franta-hg@71
   177
-- Dependencies: 1864 1865 10
franta-hg@18
   178
-- Name: podnik; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@18
   179
--
franta-hg@18
   180
franta-hg@18
   181
CREATE TABLE podnik (
franta-hg@18
   182
    id integer DEFAULT nextval('podnik_seq'::regclass) NOT NULL,
franta-hg@18
   183
    nazev character varying(255) NOT NULL,
franta-hg@62
   184
    popis character varying(255),
franta-hg@62
   185
    url character varying(255),
franta-hg@62
   186
    datum timestamp with time zone DEFAULT now(),
franta-hg@62
   187
    ulice character varying(64),
franta-hg@62
   188
    cislo_popisne integer,
franta-hg@71
   189
    mesto character varying(64),
franta-hg@71
   190
    spravce character varying(64)
franta-hg@18
   191
);
franta-hg@18
   192
franta-hg@18
   193
franta-hg@18
   194
ALTER TABLE nekurak.podnik OWNER TO nekurak;
franta-hg@18
   195
franta-hg@18
   196
--
franta-hg@72
   197
-- TOC entry 1903 (class 0 OID 0)
franta-hg@71
   198
-- Dependencies: 1586
franta-hg@71
   199
-- Name: COLUMN podnik.spravce; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@71
   200
--
franta-hg@71
   201
franta-hg@71
   202
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)';
franta-hg@71
   203
franta-hg@71
   204
franta-hg@71
   205
--
franta-hg@71
   206
-- TOC entry 1590 (class 1259 OID 35101)
franta-hg@62
   207
-- Dependencies: 10
franta-hg@62
   208
-- Name: role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@18
   209
--
franta-hg@18
   210
franta-hg@62
   211
CREATE TABLE role (
franta-hg@62
   212
    kod character varying(16) NOT NULL,
franta-hg@62
   213
    popis character varying(255)
franta-hg@62
   214
);
franta-hg@18
   215
franta-hg@18
   216
franta-hg@62
   217
ALTER TABLE nekurak.role OWNER TO nekurak;
franta-hg@62
   218
franta-hg@18
   219
--
franta-hg@72
   220
-- TOC entry 1905 (class 0 OID 0)
franta-hg@71
   221
-- Dependencies: 1590
franta-hg@62
   222
-- Name: TABLE role; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@62
   223
--
franta-hg@62
   224
franta-hg@62
   225
COMMENT ON TABLE role IS 'Role (skupiny) uživatelů ~ oprávnění';
franta-hg@62
   226
franta-hg@62
   227
franta-hg@62
   228
--
franta-hg@71
   229
-- TOC entry 1588 (class 1259 OID 35080)
franta-hg@62
   230
-- Dependencies: 10
franta-hg@62
   231
-- Name: uzivatel_seq; Type: SEQUENCE; Schema: nekurak; Owner: nekurak
franta-hg@62
   232
--
franta-hg@62
   233
franta-hg@62
   234
CREATE SEQUENCE uzivatel_seq
franta-hg@62
   235
    INCREMENT BY 1
franta-hg@62
   236
    NO MAXVALUE
franta-hg@62
   237
    NO MINVALUE
franta-hg@62
   238
    CACHE 1;
franta-hg@62
   239
franta-hg@62
   240
franta-hg@62
   241
ALTER TABLE nekurak.uzivatel_seq OWNER TO nekurak;
franta-hg@62
   242
franta-hg@62
   243
--
franta-hg@71
   244
-- TOC entry 1589 (class 1259 OID 35091)
franta-hg@71
   245
-- Dependencies: 1867 1868 10
franta-hg@62
   246
-- Name: uzivatel; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@62
   247
--
franta-hg@62
   248
franta-hg@62
   249
CREATE TABLE uzivatel (
franta-hg@62
   250
    id integer DEFAULT nextval('uzivatel_seq'::regclass) NOT NULL,
franta-hg@62
   251
    prezdivka character varying(64) NOT NULL,
franta-hg@62
   252
    heslo character varying(512) NOT NULL,
franta-hg@62
   253
    jmeno character varying(64),
franta-hg@62
   254
    prijmeni character varying(64),
franta-hg@62
   255
    email character varying(255),
franta-hg@62
   256
    datum timestamp with time zone DEFAULT now() NOT NULL
franta-hg@62
   257
);
franta-hg@62
   258
franta-hg@62
   259
franta-hg@62
   260
ALTER TABLE nekurak.uzivatel OWNER TO nekurak;
franta-hg@62
   261
franta-hg@62
   262
--
franta-hg@72
   263
-- TOC entry 1908 (class 0 OID 0)
franta-hg@71
   264
-- Dependencies: 1589
franta-hg@62
   265
-- Name: COLUMN uzivatel.prezdivka; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@62
   266
--
franta-hg@62
   267
franta-hg@62
   268
COMMENT ON COLUMN uzivatel.prezdivka IS 'Uživatelské jméno';
franta-hg@62
   269
franta-hg@62
   270
franta-hg@62
   271
--
franta-hg@71
   272
-- TOC entry 1591 (class 1259 OID 35106)
franta-hg@62
   273
-- Dependencies: 10
franta-hg@62
   274
-- Name: uzivatel_role; Type: TABLE; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@62
   275
--
franta-hg@62
   276
franta-hg@62
   277
CREATE TABLE uzivatel_role (
franta-hg@62
   278
    role character varying(16) NOT NULL,
franta-hg@62
   279
    prezdivka character varying(64) NOT NULL
franta-hg@62
   280
);
franta-hg@62
   281
franta-hg@62
   282
franta-hg@62
   283
ALTER TABLE nekurak.uzivatel_role OWNER TO nekurak;
franta-hg@62
   284
franta-hg@62
   285
--
franta-hg@72
   286
-- TOC entry 1910 (class 0 OID 0)
franta-hg@71
   287
-- Dependencies: 1591
franta-hg@62
   288
-- Name: TABLE uzivatel_role; Type: COMMENT; Schema: nekurak; Owner: nekurak
franta-hg@62
   289
--
franta-hg@62
   290
franta-hg@62
   291
COMMENT ON TABLE uzivatel_role IS 'Přiřazení uživatelských rolí (skupin).';
franta-hg@62
   292
franta-hg@62
   293
franta-hg@62
   294
--
franta-hg@71
   295
-- TOC entry 1882 (class 2606 OID 35190)
franta-hg@71
   296
-- Dependencies: 1593 1593
franta-hg@71
   297
-- Name: fotka_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@71
   298
--
franta-hg@71
   299
franta-hg@71
   300
ALTER TABLE ONLY fotka
franta-hg@71
   301
    ADD CONSTRAINT fotka_pk PRIMARY KEY (id);
franta-hg@71
   302
franta-hg@71
   303
franta-hg@71
   304
--
franta-hg@72
   305
-- TOC entry 1884 (class 2606 OID 35204)
franta-hg@72
   306
-- Dependencies: 1593 1593 1593
franta-hg@72
   307
-- Name: fotka_poradi_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@72
   308
--
franta-hg@72
   309
franta-hg@72
   310
ALTER TABLE ONLY fotka
franta-hg@72
   311
    ADD CONSTRAINT fotka_poradi_uq UNIQUE (popis, poradi);
franta-hg@72
   312
franta-hg@72
   313
franta-hg@72
   314
--
franta-hg@71
   315
-- TOC entry 1872 (class 2606 OID 35058)
franta-hg@71
   316
-- Dependencies: 1586 1586
franta-hg@18
   317
-- Name: podnik_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@18
   318
--
franta-hg@18
   319
franta-hg@18
   320
ALTER TABLE ONLY podnik
franta-hg@18
   321
    ADD CONSTRAINT podnik_pk PRIMARY KEY (id);
franta-hg@18
   322
franta-hg@18
   323
franta-hg@19
   324
--
franta-hg@71
   325
-- TOC entry 1878 (class 2606 OID 35105)
franta-hg@71
   326
-- Dependencies: 1590 1590
franta-hg@62
   327
-- Name: skupina_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@62
   328
--
franta-hg@62
   329
franta-hg@62
   330
ALTER TABLE ONLY role
franta-hg@62
   331
    ADD CONSTRAINT skupina_pk PRIMARY KEY (kod);
franta-hg@62
   332
franta-hg@62
   333
franta-hg@62
   334
--
franta-hg@71
   335
-- TOC entry 1874 (class 2606 OID 35098)
franta-hg@71
   336
-- Dependencies: 1589 1589
franta-hg@62
   337
-- Name: uzivatel_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@62
   338
--
franta-hg@62
   339
franta-hg@62
   340
ALTER TABLE ONLY uzivatel
franta-hg@62
   341
    ADD CONSTRAINT uzivatel_pk PRIMARY KEY (id);
franta-hg@62
   342
franta-hg@62
   343
franta-hg@62
   344
--
franta-hg@71
   345
-- TOC entry 1876 (class 2606 OID 35100)
franta-hg@71
   346
-- Dependencies: 1589 1589
franta-hg@62
   347
-- Name: uzivatel_prezdivka_uq; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@62
   348
--
franta-hg@62
   349
franta-hg@62
   350
ALTER TABLE ONLY uzivatel
franta-hg@62
   351
    ADD CONSTRAINT uzivatel_prezdivka_uq UNIQUE (prezdivka);
franta-hg@62
   352
franta-hg@62
   353
franta-hg@62
   354
--
franta-hg@71
   355
-- TOC entry 1880 (class 2606 OID 35137)
franta-hg@71
   356
-- Dependencies: 1591 1591 1591
franta-hg@62
   357
-- Name: uzivatel_role_pk; Type: CONSTRAINT; Schema: nekurak; Owner: nekurak; Tablespace: 
franta-hg@62
   358
--
franta-hg@62
   359
franta-hg@62
   360
ALTER TABLE ONLY uzivatel_role
franta-hg@62
   361
    ADD CONSTRAINT uzivatel_role_pk PRIMARY KEY (role, prezdivka);
franta-hg@62
   362
franta-hg@62
   363
franta-hg@62
   364
--
franta-hg@72
   365
-- TOC entry 1890 (class 2620 OID 35125)
franta-hg@72
   366
-- Dependencies: 1589 65
franta-hg@62
   367
-- Name: uzivatel_insert; Type: TRIGGER; Schema: nekurak; Owner: nekurak
franta-hg@62
   368
--
franta-hg@62
   369
franta-hg@62
   370
CREATE TRIGGER uzivatel_insert
franta-hg@62
   371
    AFTER INSERT ON uzivatel
franta-hg@62
   372
    FOR EACH ROW
franta-hg@62
   373
    EXECUTE PROCEDURE bezny_uzivatel();
franta-hg@62
   374
franta-hg@62
   375
franta-hg@62
   376
--
franta-hg@72
   377
-- TOC entry 1889 (class 2606 OID 35191)
franta-hg@72
   378
-- Dependencies: 1871 1586 1593
franta-hg@71
   379
-- Name: fotka_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
franta-hg@71
   380
--
franta-hg@71
   381
franta-hg@71
   382
ALTER TABLE ONLY fotka
franta-hg@71
   383
    ADD CONSTRAINT fotka_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
franta-hg@71
   384
franta-hg@71
   385
franta-hg@71
   386
--
franta-hg@72
   387
-- TOC entry 1886 (class 2606 OID 35072)
franta-hg@72
   388
-- Dependencies: 1587 1871 1586
franta-hg@62
   389
-- Name: hlasovani_podnik_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
franta-hg@62
   390
--
franta-hg@62
   391
franta-hg@62
   392
ALTER TABLE ONLY hlasovani
franta-hg@62
   393
    ADD CONSTRAINT hlasovani_podnik_fk FOREIGN KEY (podnik) REFERENCES podnik(id) ON DELETE CASCADE;
franta-hg@62
   394
franta-hg@62
   395
franta-hg@62
   396
--
franta-hg@72
   397
-- TOC entry 1885 (class 2606 OID 35178)
franta-hg@71
   398
-- Dependencies: 1875 1589 1586
franta-hg@71
   399
-- Name: podnik_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
franta-hg@71
   400
--
franta-hg@71
   401
franta-hg@71
   402
ALTER TABLE ONLY podnik
franta-hg@71
   403
    ADD CONSTRAINT podnik_uzivatel_fk FOREIGN KEY (spravce) REFERENCES uzivatel(prezdivka) ON DELETE SET NULL;
franta-hg@71
   404
franta-hg@71
   405
franta-hg@71
   406
--
franta-hg@72
   407
-- TOC entry 1887 (class 2606 OID 35138)
franta-hg@71
   408
-- Dependencies: 1590 1591 1877
franta-hg@62
   409
-- Name: uzivatel_role_role_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
franta-hg@62
   410
--
franta-hg@62
   411
franta-hg@62
   412
ALTER TABLE ONLY uzivatel_role
franta-hg@62
   413
    ADD CONSTRAINT uzivatel_role_role_fk FOREIGN KEY (role) REFERENCES role(kod) ON UPDATE CASCADE ON DELETE CASCADE;
franta-hg@62
   414
franta-hg@62
   415
franta-hg@62
   416
--
franta-hg@72
   417
-- TOC entry 1888 (class 2606 OID 35143)
franta-hg@71
   418
-- Dependencies: 1591 1589 1875
franta-hg@62
   419
-- Name: uzivatel_role_uzivatel_fk; Type: FK CONSTRAINT; Schema: nekurak; Owner: nekurak
franta-hg@62
   420
--
franta-hg@62
   421
franta-hg@62
   422
ALTER TABLE ONLY uzivatel_role
franta-hg@62
   423
    ADD CONSTRAINT uzivatel_role_uzivatel_fk FOREIGN KEY (prezdivka) REFERENCES uzivatel(prezdivka) ON UPDATE CASCADE ON DELETE CASCADE;
franta-hg@62
   424
franta-hg@62
   425
franta-hg@62
   426
--
franta-hg@72
   427
-- TOC entry 1893 (class 0 OID 0)
franta-hg@19
   428
-- Dependencies: 10
franta-hg@19
   429
-- Name: nekurak; Type: ACL; Schema: -; Owner: nekurak
franta-hg@19
   430
--
franta-hg@19
   431
franta-hg@19
   432
REVOKE ALL ON SCHEMA nekurak FROM PUBLIC;
franta-hg@19
   433
REVOKE ALL ON SCHEMA nekurak FROM nekurak;
franta-hg@19
   434
GRANT ALL ON SCHEMA nekurak TO nekurak;
franta-hg@19
   435
GRANT USAGE ON SCHEMA nekurak TO nekurak_web;
franta-hg@19
   436
franta-hg@19
   437
franta-hg@19
   438
--
franta-hg@72
   439
-- TOC entry 1896 (class 0 OID 0)
franta-hg@71
   440
-- Dependencies: 1592
franta-hg@71
   441
-- Name: fotka_seq; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@71
   442
--
franta-hg@71
   443
franta-hg@71
   444
REVOKE ALL ON SEQUENCE fotka_seq FROM PUBLIC;
franta-hg@71
   445
REVOKE ALL ON SEQUENCE fotka_seq FROM nekurak;
franta-hg@71
   446
GRANT ALL ON SEQUENCE fotka_seq TO nekurak;
franta-hg@71
   447
GRANT USAGE ON SEQUENCE fotka_seq TO nekurak_web;
franta-hg@71
   448
franta-hg@71
   449
franta-hg@71
   450
--
franta-hg@72
   451
-- TOC entry 1899 (class 0 OID 0)
franta-hg@71
   452
-- Dependencies: 1593
franta-hg@71
   453
-- Name: fotka; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@71
   454
--
franta-hg@71
   455
franta-hg@71
   456
REVOKE ALL ON TABLE fotka FROM PUBLIC;
franta-hg@71
   457
REVOKE ALL ON TABLE fotka FROM nekurak;
franta-hg@71
   458
GRANT ALL ON TABLE fotka TO nekurak;
franta-hg@71
   459
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE fotka TO nekurak_web;
franta-hg@71
   460
franta-hg@71
   461
franta-hg@71
   462
--
franta-hg@72
   463
-- TOC entry 1901 (class 0 OID 0)
franta-hg@71
   464
-- Dependencies: 1587
franta-hg@62
   465
-- Name: hlasovani; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@62
   466
--
franta-hg@62
   467
franta-hg@62
   468
REVOKE ALL ON TABLE hlasovani FROM PUBLIC;
franta-hg@62
   469
REVOKE ALL ON TABLE hlasovani FROM nekurak;
franta-hg@62
   470
GRANT ALL ON TABLE hlasovani TO nekurak;
franta-hg@62
   471
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE hlasovani TO nekurak_web;
franta-hg@62
   472
franta-hg@62
   473
franta-hg@62
   474
--
franta-hg@72
   475
-- TOC entry 1902 (class 0 OID 0)
franta-hg@71
   476
-- Dependencies: 1585
franta-hg@19
   477
-- Name: podnik_seq; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@19
   478
--
franta-hg@19
   479
franta-hg@19
   480
REVOKE ALL ON SEQUENCE podnik_seq FROM PUBLIC;
franta-hg@19
   481
REVOKE ALL ON SEQUENCE podnik_seq FROM nekurak;
franta-hg@19
   482
GRANT ALL ON SEQUENCE podnik_seq TO nekurak;
franta-hg@19
   483
GRANT USAGE ON SEQUENCE podnik_seq TO nekurak_web;
franta-hg@19
   484
franta-hg@19
   485
franta-hg@19
   486
--
franta-hg@72
   487
-- TOC entry 1904 (class 0 OID 0)
franta-hg@71
   488
-- Dependencies: 1586
franta-hg@19
   489
-- Name: podnik; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@19
   490
--
franta-hg@19
   491
franta-hg@19
   492
REVOKE ALL ON TABLE podnik FROM PUBLIC;
franta-hg@19
   493
REVOKE ALL ON TABLE podnik FROM nekurak;
franta-hg@19
   494
GRANT ALL ON TABLE podnik TO nekurak;
franta-hg@19
   495
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE podnik TO nekurak_web;
franta-hg@19
   496
franta-hg@19
   497
franta-hg@62
   498
--
franta-hg@72
   499
-- TOC entry 1906 (class 0 OID 0)
franta-hg@71
   500
-- Dependencies: 1590
franta-hg@62
   501
-- Name: role; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@62
   502
--
franta-hg@62
   503
franta-hg@62
   504
REVOKE ALL ON TABLE role FROM PUBLIC;
franta-hg@62
   505
REVOKE ALL ON TABLE role FROM nekurak;
franta-hg@62
   506
GRANT ALL ON TABLE role TO nekurak;
franta-hg@62
   507
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE role TO nekurak_web;
franta-hg@62
   508
franta-hg@62
   509
franta-hg@62
   510
--
franta-hg@72
   511
-- TOC entry 1907 (class 0 OID 0)
franta-hg@71
   512
-- Dependencies: 1588
franta-hg@62
   513
-- Name: uzivatel_seq; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@62
   514
--
franta-hg@62
   515
franta-hg@62
   516
REVOKE ALL ON SEQUENCE uzivatel_seq FROM PUBLIC;
franta-hg@62
   517
REVOKE ALL ON SEQUENCE uzivatel_seq FROM nekurak;
franta-hg@62
   518
GRANT ALL ON SEQUENCE uzivatel_seq TO nekurak;
franta-hg@62
   519
GRANT USAGE ON SEQUENCE uzivatel_seq TO nekurak_web;
franta-hg@62
   520
franta-hg@62
   521
franta-hg@62
   522
--
franta-hg@72
   523
-- TOC entry 1909 (class 0 OID 0)
franta-hg@71
   524
-- Dependencies: 1589
franta-hg@62
   525
-- Name: uzivatel; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@62
   526
--
franta-hg@62
   527
franta-hg@62
   528
REVOKE ALL ON TABLE uzivatel FROM PUBLIC;
franta-hg@62
   529
REVOKE ALL ON TABLE uzivatel FROM nekurak;
franta-hg@62
   530
GRANT ALL ON TABLE uzivatel TO nekurak;
franta-hg@62
   531
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel TO nekurak_web;
franta-hg@62
   532
franta-hg@62
   533
franta-hg@62
   534
--
franta-hg@72
   535
-- TOC entry 1911 (class 0 OID 0)
franta-hg@71
   536
-- Dependencies: 1591
franta-hg@62
   537
-- Name: uzivatel_role; Type: ACL; Schema: nekurak; Owner: nekurak
franta-hg@62
   538
--
franta-hg@62
   539
franta-hg@62
   540
REVOKE ALL ON TABLE uzivatel_role FROM PUBLIC;
franta-hg@62
   541
REVOKE ALL ON TABLE uzivatel_role FROM nekurak;
franta-hg@62
   542
GRANT ALL ON TABLE uzivatel_role TO nekurak;
franta-hg@62
   543
GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE uzivatel_role TO nekurak_web;
franta-hg@62
   544
franta-hg@62
   545
franta-hg@72
   546
-- Completed on 2010-03-16 14:32:24 CET
franta-hg@18
   547
franta-hg@18
   548
--
franta-hg@18
   549
-- PostgreSQL database dump complete
franta-hg@18
   550
--
franta-hg@18
   551