-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.sql
344 lines (250 loc) · 7.79 KB
/
schema.sql
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.15
-- Dumped by pg_dump version 12.0
-- Started on 2019-12-04 21:53:58 PST
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 3 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: newsml
--
CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO dev_news_ml;
--
-- TOC entry 2792 (class 0 OID 0)
-- Dependencies: 3
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: newsml
--
COMMENT ON SCHEMA public IS 'standard public schema';
SET default_tablespace = '';
--
-- TOC entry 193 (class 1259 OID 16473)
-- Name: api_users; Type: TABLE; Schema: public; Owner: newsml
--
CREATE TABLE public.api_users (
id integer NOT NULL,
username character varying(256) NOT NULL,
password_hash character varying(256) NOT NULL,
created timestamp(6) with time zone
);
ALTER TABLE public.api_users OWNER TO dev_news_ml;
--
-- TOC entry 192 (class 1259 OID 16471)
-- Name: api_users_id_seq; Type: SEQUENCE; Schema: public; Owner: newsml
--
CREATE SEQUENCE public.api_users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.api_users_id_seq OWNER TO dev_news_ml;
--
-- TOC entry 2795 (class 0 OID 0)
-- Dependencies: 192
-- Name: api_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: newsml
--
--
-- TOC entry 195 (class 1259 OID 16486)
-- Name: campaign; Type: TABLE; Schema: public; Owner: newsml
--
CREATE TABLE public.campaign (
id integer NOT NULL,
description character varying(256),
reference character varying(32) NOT NULL,
campaign_start timestamp(6) without time zone,
campaign_end timestamp(6) without time zone,
is_cancelled boolean DEFAULT false,
status integer DEFAULT 0,
request_data character varying(4096),
provider character varying(256),
report boolean DEFAULT false,
is_test boolean DEFAULT false,
articles integer
);
ALTER TABLE public.campaign OWNER TO dev_news_ml;
--
-- TOC entry 194 (class 1259 OID 16484)
-- Name: campaign_id_seq; Type: SEQUENCE; Schema: public; Owner: newsml
--
CREATE SEQUENCE public.campaign_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.campaign_id_seq OWNER TO dev_news_ml;
--
-- TOC entry 2797 (class 0 OID 0)
-- Dependencies: 194
-- Name: campaign_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: newsml
--
--
-- TOC entry 188 (class 1259 OID 16454)
-- Name: companies; Type: TABLE; Schema: public; Owner: newsml
--
CREATE TABLE public.companies (
company_id integer NOT NULL,
name character varying(1024) NOT NULL,
mention_date time(6) with time zone
);
ALTER TABLE public.companies OWNER TO dev_news_ml;
--
-- TOC entry 187 (class 1259 OID 16452)
-- Name: companies_company_id_seq; Type: SEQUENCE; Schema: public; Owner: newsml
--
CREATE SEQUENCE public.companies_company_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.companies_company_id_seq OWNER TO dev_news_ml;
--
-- TOC entry 2799 (class 0 OID 0)
-- Dependencies: 187
-- Name: companies_company_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: newsml
--
--
-- TOC entry 186 (class 1259 OID 16443)
-- Name: news; Type: TABLE; Schema: public; Owner: newsml
--
CREATE TABLE public.news (
news_id integer NOT NULL,
author character varying(128),
source character varying(64),
source_id character varying(64),
title character varying(256) NOT NULL,
description character varying(65536) NOT NULL,
url character varying(512),
url_to_image character varying(512),
content character varying(65536),
campaign character varying(16),
score double precision,
magnitude double precision,
sentiment character varying(16),
rank_score double precision,
rank_order integer,
translated_content character varying(65536),
detected_language character varying(128),
published_at timestamp with time zone,
inserted_at timestamp with time zone
);
ALTER TABLE public.news OWNER TO dev_news_ml;
--
-- TOC entry 185 (class 1259 OID 16441)
-- Name: news_news_id_seq; Type: SEQUENCE; Schema: public; Owner: newsml
--
CREATE SEQUENCE public.news_news_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.news_news_id_seq OWNER TO dev_news_ml;
--
-- TOC entry 2801 (class 0 OID 0)
-- Dependencies: 185
-- Name: news_news_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: newsml
--
--
-- TOC entry 197 (class 1259 OID 16524)
-- Name: persons; Type: TABLE; Schema: public; Owner: newsml
--
CREATE TABLE public.persons (
id integer NOT NULL,
name character varying(64) NOT NULL,
mention_date timestamp(6) with time zone,
valid boolean DEFAULT true
);
ALTER TABLE public.persons OWNER TO dev_news_ml;
--
-- TOC entry 196 (class 1259 OID 16522)
-- Name: persons_id_seq; Type: SEQUENCE; Schema: public; Owner: newsml
--
CREATE SEQUENCE public.persons_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.persons_id_seq OWNER TO dev_news_ml;
--
-- TOC entry 2803 (class 0 OID 0)
-- Dependencies: 196
-- Name: persons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: newsml
--
--
-- TOC entry 190 (class 1259 OID 16462)
-- Name: tags; Type: TABLE; Schema: public; Owner: newsml
--
CREATE TABLE public.tags (
tag_id integer NOT NULL,
tag_name character varying(128) NOT NULL
);
ALTER TABLE public.tags OWNER TO dev_news_ml;
--
-- TOC entry 191 (class 1259 OID 16468)
-- Name: tags_news; Type: TABLE; Schema: public; Owner: newsml
--
CREATE TABLE public.tags_news (
tag_id bigint,
news_id bigint
);
ALTER TABLE public.tags_news OWNER TO dev_news_ml;
--
-- TOC entry 189 (class 1259 OID 16460)
-- Name: tags_tag_id_seq; Type: SEQUENCE; Schema: public; Owner: newsml
--
CREATE SEQUENCE public.tags_tag_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.tags_tag_id_seq OWNER TO dev_news_ml;
--
-- TOC entry 2806 (class 0 OID 0)
-- Dependencies: 189
-- Name: tags_tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: newsml
--
--
-- TOC entry 2635 (class 2604 OID 16476)
-- Name: api_users id; Type: DEFAULT; Schema: public; Owner: newsml
--
ALTER TABLE ONLY public.api_users ALTER COLUMN id SET DEFAULT nextval('public.api_users_id_seq'::regclass);
--
-- TOC entry 2636 (class 2604 OID 16489)
-- Name: campaign id; Type: DEFAULT; Schema: public; Owner: newsml
--
ALTER TABLE ONLY public.campaign ALTER COLUMN id SET DEFAULT nextval('public.campaign_id_seq'::regclass);
--
-- TOC entry 2633 (class 2604 OID 16457)
-- Name: companies company_id; Type: DEFAULT; Schema: public; Owner: newsml
--
ALTER TABLE ONLY public.companies ALTER COLUMN company_id SET DEFAULT nextval('public.companies_company_id_seq'::regclass);
--
-- TOC entry 2632 (class 2604 OID 16446)
-- Name: news news_id; Type: DEFAULT; Schema: public; Owner: newsml
--
ALTER TABLE ONLY public.news ALTER COLUMN news_id SET DEFAULT nextval('public.news_news_id_seq'::regclass);
--
-- TOC entry 2641 (class 2604 OID 16527)
-- Name: persons id; Type: DEFAULT; Schema: public; Owner: newsml
--
ALTER TABLE ONLY public.persons ALTER COLUMN id SET DEFAULT nextval('public.persons_id_seq'::regclass);
--
-- TOC entry 2634 (class 2604 OID 16465)
-- Name: tags tag_id; Type: DEFAULT; Schema: public; Owner: newsml
--
ALTER TABLE ONLY public.tags ALTER COLUMN tag_id SET DEFAULT nextval('public.tags_tag_id_seq'::regclass);