-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0000_init.sql
31 lines (27 loc) · 838 Bytes
/
0000_init.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
-- Create migrations table
CREATE TABLE IF NOT EXISTS _migrations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Create rate limits table
CREATE TABLE IF NOT EXISTS rate_limits (
ip TEXT PRIMARY KEY,
requests INTEGER DEFAULT 0,
last_reset DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Create github users table
CREATE TABLE IF NOT EXISTS github_users (
username TEXT PRIMARY KEY,
followers INTEGER DEFAULT 0,
following INTEGER DEFAULT 0,
last_updated DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Create visitors table with last_updated column
CREATE TABLE IF NOT EXISTS visitors (
repo TEXT PRIMARY KEY,
count INTEGER DEFAULT 0,
last_updated DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Record migration
INSERT INTO _migrations (name) VALUES ('0000_init');