From 5900739aa96d39fef48d5be8ce277880f2949d68 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 11 Sep 2022 19:09:13 -0400 Subject: Add additional constraints to table schemata. --- signature_db.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'signature_db.cpp') 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; -- cgit v1.2.3