-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
59 lines (52 loc) · 1.96 KB
/
Copy pathschema.sql
File metadata and controls
59 lines (52 loc) · 1.96 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
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
-- Contact form submissions for jseverino.com.
--
-- Apply to the remote D1 database:
-- wrangler d1 execute jseverino-contact --remote --file=./db/schema.sql
-- Apply to the local dev database (used by `wrangler pages dev`):
-- wrangler d1 execute jseverino-contact --local --file=./db/schema.sql
CREATE TABLE IF NOT EXISTS contact_submissions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT NOT NULL,
message TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'unread',
turnstile TEXT NOT NULL DEFAULT 'verified',
ip_address TEXT,
user_agent TEXT,
browser TEXT,
device TEXT,
country TEXT,
source_url TEXT,
assigned_to TEXT,
admin_notes TEXT,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_contact_submissions_created_at
ON contact_submissions (created_at DESC);
CREATE INDEX IF NOT EXISTS idx_contact_submissions_status
ON contact_submissions (status);
CREATE INDEX IF NOT EXISTS idx_contact_submissions_ip_created_at
ON contact_submissions (ip_address, created_at DESC);
CREATE TABLE IF NOT EXISTS csp_reports (
id INTEGER PRIMARY KEY AUTOINCREMENT,
document_uri TEXT,
blocked_uri TEXT,
effective_directive TEXT,
violated_directive TEXT,
disposition TEXT,
referrer TEXT,
source_file TEXT,
line_number INTEGER,
column_number INTEGER,
status_code INTEGER,
user_agent TEXT,
ip_address TEXT,
country TEXT,
raw_report TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_csp_reports_created_at
ON csp_reports (created_at DESC);
CREATE INDEX IF NOT EXISTS idx_csp_reports_effective_directive
ON csp_reports (effective_directive);