From c3685dc52c219a2ebace65f063fbf256d49fdc66 Mon Sep 17 00:00:00 2001
From: nico <nico@magicbroccoli.de>
Date: Sun, 21 Jul 2019 22:46:25 +0200
Subject: missing create method

+ add check method to prevent sqlite3.OperationalError tracebacks
+ add create method to create base schema if missing

thanks to @weiss for reporting this
---
 schema.sql | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 schema.sql

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
new file mode 100644
index 0000000..3925ec6
--- /dev/null
+++ b/schema.sql
@@ -0,0 +1,16 @@
+-- spam table
+create table IF not exists spam
+(
+    user    TEXT,
+    domain  TEXT,
+    ts      TEXT,
+    message TEXT,
+    primary key (domain, ts)
+);
+
+-- indicies
+create index if not exists domain_tx_idx
+    on spam (domain, ts);
+
+create index if not exists user_domain_idx
+    on spam (user, domain);
-- 
cgit v1.2.3-18-g5258

