aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-11 19:09:13 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-11 19:09:13 -0400
commit5900739aa96d39fef48d5be8ce277880f2949d68 (patch)
tree990065c57c7d0f9c131b99c6119c66edc4594e69
parent557adb53661fe3ee2f84ffec9d408046fd0983bf (diff)
downloaddeduper-5900739aa96d39fef48d5be8ce277880f2949d68.tar.xz
Add additional constraints to table schemata.
-rw-r--r--signature_db.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/signature_db.cpp b/signature_db.cpp
index 1534ee6..638aa0e 100644
--- a/signature_db.cpp
+++ b/signature_db.cpp
@@ -35,7 +35,9 @@ signature_db::signature_db()
create table subslices(
image int,
slice int,
- slicesig text
+ slicesig text,
+ primary key (image, slice),
+ foreign key (image) references images (id)
);
)sql", nullptr, nullptr, nullptr);
sqlite3_exec(p->db, R"sql(
@@ -46,7 +48,8 @@ signature_db::signature_db()
id1 int,
id2 int,
dist real,
- primary key (id1, id2)
+ primary key (id1, id2),
+ foreign key (id1, id2) references images (id, id)
);
)sql", nullptr, nullptr, nullptr);
p->bst = nullptr;