From 91673ad3acd7acd9515ccc4bfb6e4cfef1fc254c Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Thu, 14 Sep 2023 13:15:13 +0530 Subject: [PATCH] fix: fkey constraint (#812) --- .../java/io/supertokens/inmemorydb/queries/GeneralQueries.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/supertokens/inmemorydb/queries/GeneralQueries.java b/src/main/java/io/supertokens/inmemorydb/queries/GeneralQueries.java index 67672989b..510cfb59c 100644 --- a/src/main/java/io/supertokens/inmemorydb/queries/GeneralQueries.java +++ b/src/main/java/io/supertokens/inmemorydb/queries/GeneralQueries.java @@ -80,6 +80,8 @@ static String getQueryToCreateUsersTable(Start start) { + "PRIMARY KEY (app_id, tenant_id, user_id)," + "FOREIGN KEY (app_id, tenant_id) REFERENCES " + Config.getConfig(start).getTenantsTable() + " (app_id, tenant_id) ON DELETE CASCADE," + + "FOREIGN KEY (app_id, primary_or_recipe_user_id) REFERENCES " + Config.getConfig(start).getAppIdToUserIdTable() + + " (app_id, user_id) ON DELETE CASCADE," + "FOREIGN KEY (app_id, user_id) REFERENCES " + Config.getConfig(start).getAppIdToUserIdTable() + " (app_id, user_id) ON DELETE CASCADE" + ");";