-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
39 lines (35 loc) · 1010 Bytes
/
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
CREATE TABLE ScrapeMetadata (
timestamp TEXT PRIMARY KEY
);
CREATE TABLE ScrapeOrigin (
short_code TEXT PRIMARY KEY,
full_name TEXT NOT NULL,
kijiji_id TEXT NOT NULL,
kijiji_name TEXT NOT NULL,
latitude FLOAT NOT NULL,
longitude FLOAT NOT NULL,
radius FLOAT NOT NULL
);
CREATE TABLE ApartmentScrape (
id INTEGER PRIMARY KEY,
scrape_origin_short_code INTEGER NOT NULL REFERENCES ScrapeOrigin(short_code),
url TEXT NOT NULL,
content TEXT NOT NULL,
scraped_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE ApartmentDetails (
apartment_scrape_id INTEGER PRIMARY KEY REFERENCES ApartmentScrape(id),
headline TEXT NOT NULL,
description TEXT NOT NULL,
date_posted TEXT NOT NULL,
price INTEGER,
raw_address TEXT NOT NULL,
num_rooms INTEGER,
num_bathrooms INTEGER
);
CREATE TABLE ApartmentAddress (
apartment_scrape_id INTEGER PRIMARY KEY REFERENCES ApartmentScrape(id),
latitude REAL NOT NULL,
longitude REAL NOT NULL,
formatted_address REAL NOT NULL
);