From e3ff46be758ef88fa4bfc3c3fcb19704f9bcb610 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Tue, 21 Nov 2017 15:43:43 +0100 Subject: [PATCH] feat(MainDb): enforce conference_event table, primary key is now (event_id, chat_room_id) --- src/db/main-db.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/db/main-db.cpp b/src/db/main-db.cpp index 8da8c2517..2e79fe642 100644 --- a/src/db/main-db.cpp +++ b/src/db/main-db.cpp @@ -746,6 +746,7 @@ MainDb::MainDb (const shared_ptr &core) : AbstractDb(*new MainDbPrivate), " is_admin BOOLEAN NOT NULL," " PRIMARY KEY (chat_room_id, sip_address_id)," + " FOREIGN KEY (chat_room_id)" " REFERENCES chat_room(id)" " ON DELETE CASCADE," @@ -756,10 +757,11 @@ MainDb::MainDb (const shared_ptr &core) : AbstractDb(*new MainDbPrivate), *session << "CREATE TABLE IF NOT EXISTS conference_event (" - " event_id" + primaryKeyStr("BIGINT UNSIGNED") + "," - + " event_id" + primaryKeyRefStr("BIGINT UNSIGNED") + "," " chat_room_id" + primaryKeyRefStr("BIGINT UNSIGNED") + "," + " PRIMARY KEY (event_id, chat_room_id)," + " FOREIGN KEY (event_id)" " REFERENCES event(id)" " ON DELETE CASCADE,"