aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2018-03-23 05:15:59 +0000
committerFelix Hanley <felix@userspace.com.au>2018-03-23 05:15:59 +0000
commit4ac8be667694a98debac14bac4e84913bfbbbe07 (patch)
tree8324de314936768744cbf40db400dbf911156ade
parent38277d4acd5d8f5f3ceec0e387f45e3fc669418d (diff)
downloaddhtsearch-4ac8be667694a98debac14bac4e84913bfbbbe07.tar.gz
dhtsearch-4ac8be667694a98debac14bac4e84913bfbbbe07.tar.bz2
Create the unique indexes
-rw-r--r--db/sqlite.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/db/sqlite.go b/db/sqlite.go
index f78498a..7e17187 100644
--- a/db/sqlite.go
+++ b/db/sqlite.go
@@ -477,6 +477,7 @@ const sqliteSchema = `create table if not exists torrents (
updated timestamp with time zone,
tsv tsvector
);
+create unique index torrents_infohash_idx on torrents (infohash);
create virtual table torrents_fts using fts5(
name, content='torrents', content_rowid='id',
tokenize="porter unicode61 separators ' !""#$%&''()*+,-./:;<=>?@[\]^_` + "`" + `{|}~'"
@@ -502,6 +503,7 @@ create table if not exists tags (
id integer primary key,
name character varying(50) unique
);
+create unique index tags_name_idx on tags (name);
create table if not exists tags_torrents (
tag_id integer not null references tags on delete cascade,
torrent_id integer not null references torrents on delete cascade,
@@ -515,6 +517,7 @@ create table if not exists peers (
created timestamp with time zone,
updated timestamp with time zone
);
+create unique index peers_address_idx on peers (address);
create table if not exists peers_torrents (
peer_id integer not null references peers on delete cascade,
torrent_id integer not null references torrents on delete cascade,