This repository was archived by the owner on May 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.sql
More file actions
34 lines (32 loc) · 1.18 KB
/
Copy pathdb.sql
File metadata and controls
34 lines (32 loc) · 1.18 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
-- Written for PostgreSQL
DROP TABLE IF EXISTS usr CASCADE;
CREATE TABLE usr (
id BIGINT PRIMARY KEY,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
description TEXT,
followers_count INTEGER NOT NULL,
friends_count INTEGER NOT NULL,
lang TEXT NOT NULL,
location TEXT,
name TEXT NOT NULL,
profile_image_url TEXT NOT NULL,
protected BOOLEAN NOT NULL,
screen_name TEXT UNIQUE NOT NULL,
statuses_count INTEGER NOT NULL,
timezone TEXT,
url TEXT,
verified BOOLEAN NOT NULL
);
DROP TABLE IF EXISTS tweet CASCADE;
CREATE TABLE tweet (
id BIGINT PRIMARY KEY,
longitude DOUBLE PRECISION,
latitude DOUBLE PRECISION,
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
in_reply_to_status_id BIGINT,
in_reply_to_user_id BIGINT,
lang TEXT,
source TEXT NOT NULL,
twtext TEXT NOT NULL,
user_id BIGINT NOT NULL REFERENCES usr (id) ON DELETE CASCADE ON UPDATE CASCADE
);