-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
302 lines (222 loc) · 8.56 KB
/
schema.sql
File metadata and controls
302 lines (222 loc) · 8.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
--
-- PostgreSQL database dump
--
-- Started on 2011-07-09 23:37:45 ART
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
--
-- TOC entry 1798 (class 1262 OID 16586)
-- Name: hackermash; Type: DATABASE; Schema: -; Owner: -
--
CREATE DATABASE hackermash WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.utf8';
\connect hackermash
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 1499 (class 1259 OID 16587)
-- Dependencies: 3
-- Name: category; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE category (
id character varying NOT NULL,
name character varying NOT NULL,
"position" integer NOT NULL
);
--
-- TOC entry 1503 (class 1259 OID 49154)
-- Dependencies: 3
-- Name: content; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE content (
id bigint NOT NULL,
categoryid character varying NOT NULL,
url character varying NOT NULL,
fetched boolean NOT NULL,
title character varying,
description character varying,
ignored boolean,
lastseen timestamp without time zone NOT NULL,
slug character varying,
comments character varying
);
--
-- TOC entry 1502 (class 1259 OID 49152)
-- Dependencies: 1503 3
-- Name: content_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE content_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 1801 (class 0 OID 0)
-- Dependencies: 1502
-- Name: content_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE content_id_seq OWNED BY content.id;
--
-- TOC entry 1802 (class 0 OID 0)
-- Dependencies: 1502
-- Name: content_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('content_id_seq', 14623, true);
--
-- TOC entry 1501 (class 1259 OID 24578)
-- Dependencies: 3
-- Name: source; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE source (
id bigint NOT NULL,
categoryid character varying NOT NULL,
url character varying NOT NULL,
parser character varying NOT NULL,
parser_params character varying NOT NULL
);
--
-- TOC entry 1500 (class 1259 OID 24576)
-- Dependencies: 3 1501
-- Name: source_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE source_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 1803 (class 0 OID 0)
-- Dependencies: 1500
-- Name: source_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE source_id_seq OWNED BY source.id;
--
-- TOC entry 1804 (class 0 OID 0)
-- Dependencies: 1500
-- Name: source_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--
SELECT pg_catalog.setval('source_id_seq', 18, true);
--
-- TOC entry 1782 (class 2604 OID 49157)
-- Dependencies: 1502 1503 1503
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE content ALTER COLUMN id SET DEFAULT nextval('content_id_seq'::regclass);
--
-- TOC entry 1781 (class 2604 OID 24581)
-- Dependencies: 1501 1500 1501
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE source ALTER COLUMN id SET DEFAULT nextval('source_id_seq'::regclass);
--
-- TOC entry 1793 (class 0 OID 16587)
-- Dependencies: 1499
-- Data for Name: category; Type: TABLE DATA; Schema: public; Owner: -
--
INSERT INTO category VALUES ('programming', 'Programming', 1);
INSERT INTO category VALUES ('technology', 'Technology', 2);
INSERT INTO category VALUES ('science', 'Science', 3);
INSERT INTO category VALUES ('linux', 'Linux', 4);
INSERT INTO category VALUES ('android', 'Android', 5);
INSERT INTO category VALUES ('gaming', 'Gaming', 6);
--
-- TOC entry 1795 (class 0 OID 49154)
-- Dependencies: 1503
-- Data for Name: content; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- TOC entry 1794 (class 0 OID 24578)
-- Dependencies: 1501
-- Data for Name: source; Type: TABLE DATA; Schema: public; Owner: -
--
INSERT INTO source VALUES (1, 'programming', 'http://www.reddit.com/r/programming/.rss', 'reddit', '[]');
INSERT INTO source VALUES (2, 'technology', 'http://www.reddit.com/r/technology/.rss', 'reddit', '[]');
INSERT INTO source VALUES (3, 'science', 'http://www.reddit.com/r/science/.rss', 'reddit', '[]');
INSERT INTO source VALUES (4, 'gaming', 'http://www.reddit.com/r/gaming/.rss', 'reddit', '[]');
INSERT INTO source VALUES (5, 'linux', 'http://www.reddit.com/r/linux/.rss', 'reddit', '[]');
INSERT INTO source VALUES (6, 'android', 'http://www.reddit.com/r/android.rss', 'reddit', '[]');
INSERT INTO source VALUES (7, 'programming', 'http://slashdot.org/tag/programming', 'slashdottag', '[]');
INSERT INTO source VALUES (8, 'technology', 'http://slashdot.org/tag/technology', 'slashdottag', '[]');
INSERT INTO source VALUES (9, 'science', 'http://science.slashdot.org/', 'slashdothome', '[]');
INSERT INTO source VALUES (10, 'gaming', 'http://games.slashdot.org/', 'slashdothome', '[]');
INSERT INTO source VALUES (11, 'linux', 'http://linux.slashdot.org/', 'slashdothome', '[]');
INSERT INTO source VALUES (12, 'android', 'http://slashdot.org/tag/android', 'slashdottag', '[]');
INSERT INTO source VALUES (13, 'programming', 'http://news.ycombinator.com/rss', 'ycombinator', '["python", "php", "java", "c#", "c\\\\+\\\\+", "objective-c", "postgres(ql)?", "mysql", "memcached", "ruby", "javascript", "haskell", "coding", "programming"]');
INSERT INTO source VALUES (14, 'technology', 'http://news.ycombinator.com/rss', 'ycombinator', '["technology", "ipad", "ipod", "iphone", "htc", "samsung", "motorola", "xoom", "apple"]');
INSERT INTO source VALUES (15, 'science', 'http://news.ycombinator.com/rss', 'ycombinator', '["science", "biology", "physics", "stud(ies|y)", "math", "nasa"]');
INSERT INTO source VALUES (16, 'gaming', 'http://news.ycombinator.com/rss', 'ycombinator', '["games?", "gaming", "ps3", "play ?station", "wii", "xbox", "nintendo"]');
INSERT INTO source VALUES (17, 'linux', 'http://news.ycombinator.com/rss', 'ycombinator', '["linux", "(k|x|ed)?ubuntu", "redhat", "centos", "suse", "opensuse", "fedora", "debian", "gentoo", "linus"]');
INSERT INTO source VALUES (18, 'android', 'http://news.ycombinator.com/rss', 'ycombinator', '["android", "cyanogen(mod)?"]');
--
-- TOC entry 1784 (class 2606 OID 16594)
-- Dependencies: 1499 1499
-- Name: pk_category; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY category
ADD CONSTRAINT pk_category PRIMARY KEY (id);
--
-- TOC entry 1790 (class 2606 OID 49162)
-- Dependencies: 1503 1503
-- Name: pk_content; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY content
ADD CONSTRAINT pk_content PRIMARY KEY (id);
--
-- TOC entry 1786 (class 2606 OID 24586)
-- Dependencies: 1501 1501
-- Name: pk_source; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY source
ADD CONSTRAINT pk_source PRIMARY KEY (id);
--
-- TOC entry 1787 (class 1259 OID 81945)
-- Dependencies: 1503
-- Name: idx_content_lastseen; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX idx_content_lastseen ON content USING btree (lastseen DESC);
ALTER TABLE content CLUSTER ON idx_content_lastseen;
--
-- TOC entry 1788 (class 1259 OID 81944)
-- Dependencies: 1503
-- Name: idx_content_slug; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX idx_content_slug ON content USING btree (slug);
--
-- TOC entry 1792 (class 2606 OID 49163)
-- Dependencies: 1499 1503 1783
-- Name: fk_content_category; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY content
ADD CONSTRAINT fk_content_category FOREIGN KEY (categoryid) REFERENCES category(id);
--
-- TOC entry 1791 (class 2606 OID 24587)
-- Dependencies: 1499 1501 1783
-- Name: fk_source_category; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY source
ADD CONSTRAINT fk_source_category FOREIGN KEY (categoryid) REFERENCES category(id);
--
-- TOC entry 1800 (class 0 OID 0)
-- Dependencies: 3
-- Name: public; Type: ACL; Schema: -; Owner: -
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
-- Completed on 2011-07-09 23:37:45 ART
--
-- PostgreSQL database dump complete
--