1--
2-- PostgreSQL database dump
3--
4
5
6SET client_encoding = 'UTF8';
7SET standard_conforming_strings = off;
8SET check_function_bodies = false;
9SET client_min_messages = warning;
10SET escape_string_warning = off;
11
12drop database if exists thundersnarf;
13DROP ROLE IF EXISTS thundersnarf;
14
15CREATE ROLE thundersnarf PASSWORD 'thundercachesnarf' CREATEDB VALID UNTIL 'infinity' LOGIN;
16create database thundersnarf owner thundersnarf;
17
18\connect thundersnarf pgsql;
19
20--
21-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: pgsql
22--
23
24COMMENT ON SCHEMA public IS 'Standard public schema';
25
26
27--
28-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: pgsql
29--
30
31CREATE PROCEDURAL LANGUAGE plpgsql;
32
33
34SET search_path = public, pg_catalog;
35
36--
37-- Name: insertfile(integer, character varying, character varying, bigint, bigint, character varying, character varying, character varying, character varying, boolean, boolean, character varying); Type: FUNCTION; Schema: public; Owner: thundersnarf
38--
39
40CREATE FUNCTION insertfile(integer, character varying, character varying, bigint, bigint, character varying, character varying, character varying, character varying, boolean, boolean, character varying) RETURNS boolean
41    AS $_$DECLARE d record; f record; e record; i record; di record; dt record; timestamp_1 integer; ip_2 character varying; response_3 character varying; filesize_4 bigint; transfered_5 bigint; type_of_request_6 character varying; url_7 character varying; domain_8 character varying; file_9 character varying; static_10 bool; hit_11 bool; extension_12 character varying; incrementa_static integer;
42 BEGIN
43    timestamp_1 = $1;
44    ip_2 = $2;
45    response_3 = $3;
46    filesize_4 = $4;
47    transfered_5 = $5;
48    type_of_request_6 = $6;
49    url_7 = $7;
50    domain_8 = $8;
51    file_9 = $9;
52    static_10 = $10;
53    hit_11 = $11;
54    extension_12 = $12;
55    SELECT INTO d id
56    FROM thundersnarf_domain
57    WHERE domain = domain_8;
58    IF not found THEN
59        BEGIN
60            INSERT INTO thundersnarf_domain(domain, last_requested) values(domain_8, timestamp_1) RETURNING id INTO d;
61            EXCEPTION WHEN unique_violation THEN
62                SELECT into d id
63                FROM thundersnarf_domain
64                WHERE domain = domain_8;
65        END;
66    END IF;
67    SELECT INTO f id
68    FROM thundersnarf_file
69    WHERE domain_id = d.id AND file = file_9;
70    IF not found THEN
71        BEGIN
72            INSERT INTO thundersnarf_file(domain_id, url, file, size, extension, downloaded, last_requested) values(d.id, url_7, file_9, filesize_4, extension_12, timestamp_1, timestamp_1) RETURNING id INTO f;
73            EXCEPTION WHEN unique_violation THEN
74                SELECT INTO f id
75                FROM thundersnarf_file
76                WHERE domain_id = d AND file = file_9;
77        END;
78    END IF;
79    SELECT INTO e id
80    FROM thundersnarf_extension
81    WHERE extension = extension_12;
82    IF not found THEN
83        BEGIN
84            INSERT INTO thundersnarf_extension(extension, last_requested) values(extension_12, timestamp_1) RETURNING id INTO e;
85            EXCEPTION WHEN unique_violation THEN
86                SELECT INTO e id
87                FROM thundersnarf_extension
88                WHERE extension = extension_12;
89        END;
90    END IF;
91    SELECT INTO i id
92    FROM thundersnarf_ip
93    WHERE ip = ip_2;
94    IF not found THEN
95        BEGIN
96            INSERT INTO thundersnarf_ip(ip, last_requested) values(ip_2, timestamp_1) RETURNING id INTO i;
97            EXCEPTION WHEN unique_violation THEN
98                SELECT INTO i id
99                FROM thundersnarf_ip
100                WHERE ip = ip_2;
101        END;
102    END IF;
103    SELECT INTO di domain_id
104    FROM thundersnarf_domainip
105    WHERE domain_id = d.id AND ip_id = i.id;
106    IF not found THEN
107        BEGIN
108            INSERT INTO thundersnarf_domainip(domain_id,ip_id, last_requested) values(d.id, i.id, timestamp_1) RETURNING domain_id INTO di;
109            EXCEPTION WHEN unique_violation THEN
110                SELECT INTO di domain_id
111                FROM thundersnarf_domainip
112                WHERE domain_id = d.id AND ip_id = i.id;
113        END;
114    END IF;
115    SELECT INTO dt id_data
116    FROM thundersnarf_data
117    WHERE id_data = to_number(to_char(to_timestamp(timestamp_1),'yyyymmdd'),'99999999');
118    IF not found THEN
119        BEGIN
120            INSERT INTO thundersnarf_data(id_data) values(to_number(to_char(to_timestamp(timestamp_1),'yyyymmdd'),'99999999')) RETURNING id_data INTO dt;
121            EXCEPTION WHEN unique_violation THEN
122                SELECT INTO dt id_data
123                FROM thundersnarf_data
124                WHERE id_data = to_number(to_char(to_timestamp(timestamp_1),'yyyymmdd'),'99999999');
125        END;
126    END IF;
127    IF static_10 THEN
128        IF hit_11 THEN
129            UPDATE thundersnarf_domain SET requested=requested+1, last_requested=timestamp_1, cache_static=cache_static+transfered_5, hit_static=hit_static+1 WHERE id=d.id;
130            UPDATE thundersnarf_extension SET requested=requested+1, last_requested=timestamp_1, cache_static=cache_static+transfered_5, hit_static=hit_static+1, last_url=url_7 WHERE id=e.id;
131            UPDATE thundersnarf_ip SET requested=requested+1, last_requested=timestamp_1, cache_static=cache_static+transfered_5, hit_static=hit_static+1 WHERE id=i.id;
132            UPDATE thundersnarf_domainip SET requested=requested+1, last_requested=timestamp_1, cache_static=cache_static+transfered_5, hit_static=hit_static+1 WHERE domain_id=d.id AND ip_id = i.id;
133            UPDATE thundersnarf_data SET requested=requested+1, cache_static=cache_static+transfered_5, hit_static=hit_static+1 WHERE id_data=dt.id_data;
134            UPDATE thundersnarf_file SET requested=requested+1, size=filesize_4, last_requested=timestamp_1, cache_static=cache_static+transfered_5, hit_static=hit_static+1 WHERE id=f.id;
135        ELSE
136            UPDATE thundersnarf_domain SET requested=requested+1, last_requested=timestamp_1, traffic_static=traffic_static+transfered_5, miss_static=miss_static+1 WHERE id=d.id;
137            UPDATE thundersnarf_extension SET requested=requested+1, last_requested=timestamp_1, traffic_static=traffic_static+transfered_5, miss_static=miss_static+1, last_url=url_7  WHERE id=e.id;
138            UPDATE thundersnarf_ip SET requested=requested+1, last_requested=timestamp_1, traffic_static=traffic_static+transfered_5, miss_static=miss_static+1  WHERE id=i.id;
139            UPDATE thundersnarf_domainip SET requested=requested+1, last_requested=timestamp_1, traffic_static=traffic_static+transfered_5, miss_static=miss_static+1  WHERE domain_id=d.id AND ip_id = i.id;
140            UPDATE thundersnarf_data SET requested=requested+1, traffic_static=traffic_static+transfered_5, miss_static=miss_static+1  WHERE id_data=dt.id_data;
141            UPDATE thundersnarf_file SET requested=requested+1, size=filesize_4, last_requested=timestamp_1, traffic_static=traffic_static+transfered_5, miss_static=miss_static+1 WHERE id=f.id;
142        END IF;
143    ELSE
144        IF hit_11 THEN
145            UPDATE thundersnarf_domain SET requested=requested+1, last_requested=timestamp_1, cache_dynamic=cache_dynamic+transfered_5, hit_dynamic=hit_dynamic+1 WHERE id=d.id;
146            UPDATE thundersnarf_extension SET requested=requested+1, last_requested=timestamp_1, cache_dynamic=cache_dynamic+transfered_5, hit_dynamic=hit_dynamic+1, last_url=url_7 WHERE id=e.id;
147            UPDATE thundersnarf_ip SET requested=requested+1, last_requested=timestamp_1, cache_dynamic=cache_dynamic+transfered_5, hit_dynamic=hit_dynamic+1 WHERE id=i.id;
148            UPDATE thundersnarf_domainip SET requested=requested+1, last_requested=timestamp_1, cache_dynamic=cache_dynamic+transfered_5, hit_dynamic=hit_dynamic+1 WHERE domain_id=d.id AND ip_id = i.id;
149            UPDATE thundersnarf_data SET requested=requested+1, cache_dynamic=cache_dynamic+transfered_5, hit_dynamic=hit_dynamic+1 WHERE id_data=dt.id_data;
150            UPDATE thundersnarf_file SET requested=requested+1, size=filesize_4, last_requested=timestamp_1, cache_dynamic=cache_dynamic+transfered_5, hit_dynamic=hit_dynamic+1 WHERE id=f.id;
151        ELSE
152            UPDATE thundersnarf_domain SET requested=requested+1, last_requested=timestamp_1, traffic_dynamic=traffic_dynamic+transfered_5, miss_dynamic=miss_dynamic+1 WHERE id=d.id;
153            UPDATE thundersnarf_extension SET requested=requested+1, last_requested=timestamp_1, traffic_dynamic=traffic_dynamic+transfered_5, miss_dynamic=miss_dynamic+1, last_url=url_7  WHERE id=e.id;
154            UPDATE thundersnarf_ip SET requested=requested+1, last_requested=timestamp_1, traffic_dynamic=traffic_dynamic+transfered_5, miss_dynamic=miss_dynamic+1  WHERE id=i.id;
155            UPDATE thundersnarf_domainip SET requested=requested+1, last_requested=timestamp_1, traffic_dynamic=traffic_dynamic+transfered_5, miss_dynamic=miss_dynamic+1  WHERE domain_id=d.id AND ip_id = i.id;
156            UPDATE thundersnarf_data SET requested=requested+1, traffic_dynamic=traffic_dynamic+transfered_5, miss_dynamic=miss_dynamic+1  WHERE id_data=dt.id_data;
157            UPDATE thundersnarf_file SET requested=requested+1, size=filesize_4, last_requested=timestamp_1, traffic_dynamic=traffic_dynamic+transfered_5, miss_dynamic=miss_dynamic+1 WHERE id=f.id;
158        END IF;
159    END IF;
160    return true;
161 end;$_$
162    LANGUAGE plpgsql;
163
164
165ALTER FUNCTION public.insertfile(integer, character varying, character varying, bigint, bigint, character varying, character varying, character varying, character varying, boolean, boolean, character varying) OWNER TO thundersnarf;
166
167SET default_tablespace = '';
168
169SET default_with_oids = false;
170
171--
172-- Name: thundersnarf_domain; Type: TABLE; Schema: public; Owner: thundersnarf; Tablespace:
173--
174
175CREATE TABLE thundersnarf_domain (
176    id integer NOT NULL,
177    "domain" character varying(300) NOT NULL,
178    createdate timestamp with time zone DEFAULT now() NOT NULL,
179    cache_static bigint DEFAULT 0 NOT NULL,
180    cache_dynamic bigint DEFAULT 0 NOT NULL,
181    traffic_static bigint DEFAULT 0 NOT NULL,
182    traffic_dynamic bigint DEFAULT 0 NOT NULL,
183    hit_static bigint DEFAULT 0 NOT NULL,
184    hit_dynamic bigint DEFAULT 0 NOT NULL,
185    miss_static bigint DEFAULT 0 NOT NULL,
186    miss_dynamic bigint DEFAULT 0 NOT NULL,
187    last_requested integer DEFAULT 0 NOT NULL,
188    requested bigint DEFAULT 0 NOT NULL
189);
190
191
192ALTER TABLE public.thundersnarf_domain OWNER TO thundersnarf;
193
194--
195-- Name: thunder_domain_id_seq; Type: SEQUENCE; Schema: public; Owner: thundersnarf
196--
197
198CREATE SEQUENCE thunder_domain_id_seq
199    INCREMENT BY 1
200    NO MAXVALUE
201    NO MINVALUE
202    CACHE 1;
203
204
205ALTER TABLE public.thunder_domain_id_seq OWNER TO thundersnarf;
206
207--
208-- Name: thunder_domain_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: thundersnarf
209--
210
211ALTER SEQUENCE thunder_domain_id_seq OWNED BY thundersnarf_domain.id;
212
213
214--
215-- Name: thundersnarf_extension; Type: TABLE; Schema: public; Owner: thundersnarf; Tablespace:
216--
217
218CREATE TABLE thundersnarf_extension (
219    id integer NOT NULL,
220    extension character(5),
221    cache_static bigint DEFAULT 0 NOT NULL,
222    cache_dynamic bigint DEFAULT 0 NOT NULL,
223    traffic_static bigint DEFAULT 0 NOT NULL,
224    traffic_dynamic bigint DEFAULT 0 NOT NULL,
225    hit_static bigint DEFAULT 0 NOT NULL,
226    hit_dynamic bigint DEFAULT 0 NOT NULL,
227    miss_static bigint DEFAULT 0 NOT NULL,
228    miss_dynamic bigint DEFAULT 0 NOT NULL,
229    last_requested integer DEFAULT 0 NOT NULL,
230    requested bigint DEFAULT 0 NOT NULL,
231    last_url character varying(4000)
232);
233
234
235ALTER TABLE public.thundersnarf_extension OWNER TO thundersnarf;
236
237--
238-- Name: thunder_extension_id_seq; Type: SEQUENCE; Schema: public; Owner: thundersnarf
239--
240
241CREATE SEQUENCE thunder_extension_id_seq
242    INCREMENT BY 1
243    NO MAXVALUE
244    NO MINVALUE
245    CACHE 1;
246
247
248ALTER TABLE public.thunder_extension_id_seq OWNER TO thundersnarf;
249
250--
251-- Name: thunder_extension_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: thundersnarf
252--
253
254ALTER SEQUENCE thunder_extension_id_seq OWNED BY thundersnarf_extension.id;
255
256
257--
258-- Name: thundersnarf_file; Type: TABLE; Schema: public; Owner: thundersnarf; Tablespace:
259--
260
261CREATE TABLE thundersnarf_file (
262    id integer NOT NULL,
263    domain_id bigint NOT NULL,
264    file character varying(300) NOT NULL,
265    size bigint NOT NULL,
266    requested integer DEFAULT 0 NOT NULL,
267    extension character varying(5),
268    last_requested integer DEFAULT 0 NOT NULL,
269    downloaded integer NOT NULL,
270    url character varying(4000),
271    cache_static bigint DEFAULT 0 NOT NULL,
272    cache_dynamic bigint DEFAULT 0 NOT NULL,
273    traffic_static bigint DEFAULT 0 NOT NULL,
274    traffic_dynamic bigint DEFAULT 0 NOT NULL,
275    hit_static bigint DEFAULT 0 NOT NULL,
276    hit_dynamic bigint DEFAULT 0 NOT NULL,
277    miss_static bigint DEFAULT 0 NOT NULL,
278    miss_dynamic bigint DEFAULT 0 NOT NULL
279);
280
281
282ALTER TABLE public.thundersnarf_file OWNER TO thundersnarf;
283
284--
285-- Name: thunder_file_id_seq; Type: SEQUENCE; Schema: public; Owner: thundersnarf
286--
287
288CREATE SEQUENCE thunder_file_id_seq
289    INCREMENT BY 1
290    NO MAXVALUE
291    NO MINVALUE
292    CACHE 1;
293
294
295ALTER TABLE public.thunder_file_id_seq OWNER TO thundersnarf;
296
297--
298-- Name: thunder_file_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: thundersnarf
299--
300
301ALTER SEQUENCE thunder_file_id_seq OWNED BY thundersnarf_file.id;
302
303
304--
305-- Name: thundersnarf_ip; Type: TABLE; Schema: public; Owner: thundersnarf; Tablespace:
306--
307
308CREATE TABLE thundersnarf_ip (
309    id integer NOT NULL,
310    ip character(15),
311    cache_static bigint DEFAULT 0 NOT NULL,
312    cache_dynamic bigint DEFAULT 0 NOT NULL,
313    traffic_static bigint DEFAULT 0 NOT NULL,
314    traffic_dynamic bigint DEFAULT 0 NOT NULL,
315    hit_static bigint DEFAULT 0 NOT NULL,
316    hit_dynamic bigint DEFAULT 0 NOT NULL,
317    miss_static bigint DEFAULT 0 NOT NULL,
318    miss_dynamic bigint DEFAULT 0 NOT NULL,
319    last_requested integer DEFAULT 0 NOT NULL,
320    requested bigint DEFAULT 0 NOT NULL
321);
322
323
324ALTER TABLE public.thundersnarf_ip OWNER TO thundersnarf;
325
326--
327-- Name: thunder_ip_id_seq; Type: SEQUENCE; Schema: public; Owner: thundersnarf
328--
329
330CREATE SEQUENCE thunder_ip_id_seq
331    INCREMENT BY 1
332    NO MAXVALUE
333    NO MINVALUE
334    CACHE 1;
335
336
337ALTER TABLE public.thunder_ip_id_seq OWNER TO thundersnarf;
338
339--
340-- Name: thunder_ip_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: thundersnarf
341--
342
343ALTER SEQUENCE thunder_ip_id_seq OWNED BY thundersnarf_ip.id;
344
345
346--
347-- Name: thundersnarf_data; Type: TABLE; Schema: public; Owner: thundersnarf; Tablespace:
348--
349
350CREATE TABLE thundersnarf_data (
351    id_data integer NOT NULL,
352    cache_static bigint DEFAULT 0 NOT NULL,
353    cache_dynamic bigint DEFAULT 0 NOT NULL,
354    traffic_static bigint DEFAULT 0 NOT NULL,
355    traffic_dynamic bigint DEFAULT 0 NOT NULL,
356    hit_static bigint DEFAULT 0 NOT NULL,
357    hit_dynamic bigint DEFAULT 0 NOT NULL,
358    miss_static bigint DEFAULT 0 NOT NULL,
359    miss_dynamic bigint DEFAULT 0 NOT NULL,
360    requested bigint DEFAULT 0 NOT NULL
361);
362
363
364ALTER TABLE public.thundersnarf_data OWNER TO thundersnarf;
365
366--
367-- Name: thundersnarf_domainip; Type: TABLE; Schema: public; Owner: thundersnarf; Tablespace:
368--
369
370CREATE TABLE thundersnarf_domainip (
371    domain_id bigint NOT NULL,
372    ip_id bigint NOT NULL,
373    cache_static bigint DEFAULT 0 NOT NULL,
374    cache_dynamic bigint DEFAULT 0 NOT NULL,
375    traffic_static bigint DEFAULT 0 NOT NULL,
376    traffic_dynamic bigint DEFAULT 0 NOT NULL,
377    hit_static bigint DEFAULT 0 NOT NULL,
378    hit_dynamic bigint DEFAULT 0 NOT NULL,
379    miss_static bigint DEFAULT 0 NOT NULL,
380    miss_dynamic bigint DEFAULT 0 NOT NULL,
381    last_requested integer DEFAULT 0 NOT NULL,
382    requested bigint DEFAULT 0 NOT NULL
383);
384
385
386ALTER TABLE public.thundersnarf_domainip OWNER TO thundersnarf;
387
388--
389-- Name: thundersnarf_user; Type: TABLE; Schema: public; Owner: thundersnarf; Tablespace:
390--
391
392CREATE TABLE thundersnarf_user (
393    id integer NOT NULL,
394    username character varying(128) NOT NULL,
395    "password" character varying(128) NOT NULL,
396    email character varying(128) NOT NULL,
397    profile text,
398    last_acess integer,
399    last_ip character varying(15)
400);
401
402ALTER TABLE public.thundersnarf_user OWNER TO thundersnarf;
403
404--
405-- Name: thundersnarf_user_id_seq; Type: SEQUENCE; Schema: public; Owner: thundersnarf
406--
407
408CREATE SEQUENCE thundersnarf_user_id_seq
409    INCREMENT BY 1
410    NO MAXVALUE
411    NO MINVALUE
412    CACHE 1;
413
414
415ALTER TABLE public.thundersnarf_user_id_seq OWNER TO thundersnarf;
416
417--
418-- Name: thundersnarf_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: thundersnarf
419--
420
421ALTER SEQUENCE thundersnarf_user_id_seq OWNED BY thundersnarf_user.id;
422
423
424--
425-- Name: id; Type: DEFAULT; Schema: public; Owner: thundersnarf
426--
427
428ALTER TABLE thundersnarf_user ALTER COLUMN id SET DEFAULT nextval('thundersnarf_user_id_seq'::regclass);
429
430
431--
432-- Name: thundersnarf_user_pkey; Type: CONSTRAINT; Schema: public; Owner: thundersnarf; Tablespace:
433--
434
435ALTER TABLE ONLY thundersnarf_user
436    ADD CONSTRAINT thundersnarf_user_pkey PRIMARY KEY (id);
437
438--
439-- Name: thundersnarf_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: thundersnarf
440--
441
442--
443-- Cadastro do usuario padrao:
444-- USUSARIO: admin
445-- SENHA: admin
446--
447
448SELECT pg_catalog.setval('thundersnarf_user_id_seq', 2, true);
449
450INSERT INTO thundersnarf_user VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'modifiqueoemail@modifiqueoemail.com.br', 'Usuario cadastrado na instalacao', 1274126219, '127.0.0.1');
451INSERT INTO thundersnarf_user VALUES (2, 'freebsdbrasil', '21232f297a57a5a743894a0e4a801fc3', 'consultoria@freebsdbrasil.com.br', 'FreeBSD Brasil Ltda');
452
453
454
455--
456-- Name: id; Type: DEFAULT; Schema: public; Owner: thundersnarf
457--
458
459ALTER TABLE thundersnarf_domain ALTER COLUMN id SET DEFAULT nextval('thunder_domain_id_seq'::regclass);
460
461
462--
463-- Name: id; Type: DEFAULT; Schema: public; Owner: thundersnarf
464--
465
466ALTER TABLE thundersnarf_extension ALTER COLUMN id SET DEFAULT nextval('thunder_extension_id_seq'::regclass);
467
468
469--
470-- Name: id; Type: DEFAULT; Schema: public; Owner: thundersnarf
471--
472
473ALTER TABLE thundersnarf_file ALTER COLUMN id SET DEFAULT nextval('thunder_file_id_seq'::regclass);
474
475
476--
477-- Name: id; Type: DEFAULT; Schema: public; Owner: thundersnarf
478--
479
480ALTER TABLE thundersnarf_ip ALTER COLUMN id SET DEFAULT nextval('thunder_ip_id_seq'::regclass);
481
482
483--
484-- Name: thunder_data_pkey; Type: CONSTRAINT; Schema: public; Owner: thundersnarf; Tablespace:
485--
486
487ALTER TABLE ONLY thundersnarf_data
488    ADD CONSTRAINT thunder_data_pkey PRIMARY KEY (id_data);
489
490
491--
492-- Name: thunder_domain_pkey; Type: CONSTRAINT; Schema: public; Owner: thundersnarf; Tablespace:
493--
494
495ALTER TABLE ONLY thundersnarf_domain
496    ADD CONSTRAINT thunder_domain_pkey PRIMARY KEY (id);
497
498
499--
500-- Name: thunder_domainip_pkey; Type: CONSTRAINT; Schema: public; Owner: thundersnarf; Tablespace:
501--
502
503ALTER TABLE ONLY thundersnarf_domainip
504    ADD CONSTRAINT thunder_domainip_pkey PRIMARY KEY (domain_id, ip_id);
505
506
507--
508-- Name: thunder_extension_pkey; Type: CONSTRAINT; Schema: public; Owner: thundersnarf; Tablespace:
509--
510
511ALTER TABLE ONLY thundersnarf_extension
512    ADD CONSTRAINT thunder_extension_pkey PRIMARY KEY (id);
513
514
515--
516-- Name: thunder_file_pkey; Type: CONSTRAINT; Schema: public; Owner: thundersnarf; Tablespace:
517--
518
519ALTER TABLE ONLY thundersnarf_file
520    ADD CONSTRAINT thunder_file_pkey PRIMARY KEY (id);
521
522
523--
524-- Name: thunder_ip_pkey; Type: CONSTRAINT; Schema: public; Owner: thundersnarf; Tablespace:
525--
526
527ALTER TABLE ONLY thundersnarf_ip
528    ADD CONSTRAINT thunder_ip_pkey PRIMARY KEY (id);
529
530
531--
532-- Name: domain_id; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
533--
534
535CREATE INDEX domain_id ON thundersnarf_domainip USING btree (domain_id);
536
537
538--
539-- Name: extension_index; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
540--
541
542CREATE INDEX extension_index ON thundersnarf_extension USING btree (extension);
543
544
545--
546-- Name: file_index; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
547--
548
549CREATE INDEX file_index ON thundersnarf_file USING btree (file);
550
551
552--
553-- Name: indice_domain; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
554--
555
556CREATE UNIQUE INDEX indice_domain ON thundersnarf_domain USING btree ("domain");
557
558
559--
560-- Name: indice_id_domain; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
561--
562
563CREATE UNIQUE INDEX indice_id_domain ON thundersnarf_domain USING btree (id);
564
565
566--
567-- Name: indice_id_file; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
568--
569
570CREATE UNIQUE INDEX indice_id_file ON thundersnarf_file USING btree (id);
571
572
573--
574-- Name: ip_id; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
575--
576
577CREATE INDEX ip_id ON thundersnarf_domainip USING btree (ip_id);
578
579
580--
581-- Name: ip_index; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
582--
583
584CREATE INDEX ip_index ON thundersnarf_ip USING btree (ip);
585
586
587--
588-- Name: url_index; Type: INDEX; Schema: public; Owner: thundersnarf; Tablespace:
589--
590
591CREATE INDEX url_index ON thundersnarf_file USING btree (url);
592
593
594--
595-- Name: thunder_domainip_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: thundersnarf
596--
597
598ALTER TABLE ONLY thundersnarf_domainip
599    ADD CONSTRAINT thunder_domainip_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES thundersnarf_domain(id) ON DELETE CASCADE;
600
601
602--
603-- Name: thunder_domainip_ip_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: thundersnarf
604--
605
606ALTER TABLE ONLY thundersnarf_domainip
607    ADD CONSTRAINT thunder_domainip_ip_id_fkey FOREIGN KEY (ip_id) REFERENCES thundersnarf_ip(id) ON DELETE CASCADE;
608
609
610--
611-- Name: thunder_file_domain_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: thundersnarf
612--
613
614ALTER TABLE ONLY thundersnarf_file
615    ADD CONSTRAINT thunder_file_domain_id_fkey FOREIGN KEY (domain_id) REFERENCES thundersnarf_domain(id) ON DELETE CASCADE;
616
617
618--
619-- Name: public; Type: ACL; Schema: -; Owner: pgsql
620--
621
622--
623-- PostgreSQL database dump complete
624--
625
626