forked from aaronsw/watchdog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
68 lines (58 loc) · 1.42 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
DROP TABLE state CASCADE;
DROP TABLE district CASCADE;
DROP TABLE politician CASCADE;
CREATE TABLE state (
-- index.json
code varchar(2) primary key,
name varchar(256),
status varchar(256),
wikipedia varchar(256),
fipscode varchar(2)
);
CREATE TABLE district (
-- index.json
name varchar(10) primary key,
district int,
state varchar(2) references state,
voting boolean,
wikipedia varchar(256),
-- almanac.json
almanac varchar(256),
area_sqmi int,
cook_index varchar(10),
poverty_pct real,
median_income int,
est_population int, -- most recent population estimate
est_population_year int, -- year of the estimate
-- shapes.json
outline text, -- geojson
-- centers.json
center_lat real,
center_lng real,
zoom_level int
);
CREATE TABLE politician (
-- index.json
id varchar(256) primary key,
district varchar(10) references district,
wikipedia varchar(256),
-- govtrack.json
bioguideid varchar(256),
opensecretsid varchar(256),
govtrackid varchar(256),
gender varchar(1),
birthday date,
firstname varchar(256),
middlename varchar(256),
lastname varchar(256),
officeurl varchar(256),
party varchar(256),
religion varchar(256),
-- photos.json
photo_path varchar(256),
photo_credit_url varchar(256),
photo_credit_text varchar(256)
);
GRANT ALL on state TO watchdog;
GRANT ALL on district TO watchdog;
GRANT ALL on politician TO watchdog;