-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
election-scraper-structure.sql
178 lines (139 loc) · 4.38 KB
/
election-scraper-structure.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
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.4
-- Dumped by pg_dump version 14.4
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;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: areas; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.areas (
id character varying(255) NOT NULL,
areas_group character varying(255),
county_id character varying(255),
county_name character varying(255),
ward_id character varying(255),
precinct_id character varying(255),
precinct_name character varying(255),
state_senate_id character varying(255),
state_house_id character varying(255),
county_commissioner_id character varying(255),
district_court_id character varying(255),
soil_water_id character varying(255),
school_district_id character varying(255),
school_district_name character varying(255),
mcd_id character varying(255),
precincts character varying(255),
name character varying(255),
updated timestamp without time zone
);
--
-- Name: contests; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.contests (
id character varying(255) NOT NULL,
office_id character varying(255),
results_group character varying(255),
office_name character varying(255),
district_code character varying(255),
state character varying(255),
county_id character varying(255),
precinct_id character varying(255),
precincts_reporting bigint,
total_effected_precincts bigint,
total_votes_for_office bigint,
seats bigint,
scope character varying(255),
title character varying(255),
boundary character varying(255),
question_body text,
sub_title character varying(255),
incumbent_party character varying(255),
updated timestamp without time zone,
ranked_choice boolean,
"primary" boolean,
partisan boolean,
called boolean
);
--
-- Name: meta; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.meta (
key character varying(255) NOT NULL,
value text,
type character varying(255),
updated timestamp without time zone
);
--
-- Name: questions; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.questions (
id character varying(255) NOT NULL,
contest_id character varying(255),
title character varying(255),
sub_title character varying(255),
question_body text,
updated timestamp without time zone
);
--
-- Name: results; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.results (
id character varying(255) NOT NULL,
contest_id character varying(255) NOT NULL,
office_name character varying(255),
candidate_id character varying(255),
candidate character varying(255),
suffix character varying(255),
incumbent_code character varying(255),
party_id character varying(255),
votes_candidate bigint,
percentage double precision,
ranked_choice_place bigint,
updated timestamp without time zone,
results_group character varying(255)
);
--
-- Name: areas area_id_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.areas
ADD CONSTRAINT area_id_pkey PRIMARY KEY (id);
--
-- Name: contests contest_id_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.contests
ADD CONSTRAINT contest_id_pkey PRIMARY KEY (id);
--
-- Name: meta meta_key_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.meta
ADD CONSTRAINT meta_key_pkey PRIMARY KEY (key);
--
-- Name: questions question_id_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.questions
ADD CONSTRAINT question_id_pkey PRIMARY KEY (id);
--
-- Name: results result_id_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.results
ADD CONSTRAINT result_id_pkey PRIMARY KEY (id);
--
-- Name: results results_contest_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.results
ADD CONSTRAINT results_contest_id_fkey FOREIGN KEY (contest_id) REFERENCES public.contests(id);
--
-- PostgreSQL database dump complete
--