From 6cda7ab549a4acebfe909cc702e9596740254cd1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 17 May 2019 13:10:46 +0300 Subject: [PATCH] Add ON DELETE CASCADE for future sqlite databases too --- database/upgrades/2018-09-01-initial-schema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/upgrades/2018-09-01-initial-schema.go b/database/upgrades/2018-09-01-initial-schema.go index ba3ef01..189d3d0 100644 --- a/database/upgrades/2018-09-01-initial-schema.go +++ b/database/upgrades/2018-09-01-initial-schema.go @@ -40,7 +40,7 @@ func init() { _, err = tx.Exec(fmt.Sprintf(`CREATE TABLE IF NOT EXISTS "user" ( mxid VARCHAR(255) PRIMARY KEY, - jid VARCHAR(255) UNIQUE, + jid VARCHAR(255) UNIQUE, management_room VARCHAR(255), @@ -63,7 +63,7 @@ func init() { content %[1]s NOT NULL, PRIMARY KEY (chat_jid, chat_receiver, jid), - FOREIGN KEY (chat_jid, chat_receiver) REFERENCES portal(jid, receiver) + FOREIGN KEY (chat_jid, chat_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE )`, byteType)) if err != nil { return err