From d572fdac9b8fee253cd9b00281cdfe625f16230e Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 28 May 2021 08:39:04 +0200 Subject: [PATCH] :bug: Fix unexpected exception on duplicate project. Related to files created out of order. --- backend/src/app/rpc/mutations/management.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/app/rpc/mutations/management.clj b/backend/src/app/rpc/mutations/management.clj index cc38374b2..7ef620726 100644 --- a/backend/src/app/rpc/mutations/management.clj +++ b/backend/src/app/rpc/mutations/management.clj @@ -173,7 +173,7 @@ index {file-id (uuid/next)} params (assoc params :index index :file file)] (proj/check-edition-permissions! conn profile-id (:project-id file)) - + (db/exec-one! conn ["SET CONSTRAINTS ALL DEFERRED"]) (-> (duplicate-file conn params {:reset-shared-flag true}) (update :data blob/decode))))) @@ -191,6 +191,7 @@ (db/with-atomic [conn pool] (let [project (db/get-by-id conn :project project-id)] (teams/check-edition-permissions! conn profile-id (:team-id project)) + (db/exec-one! conn ["SET CONSTRAINTS ALL DEFERRED"]) (duplicate-project conn (assoc params :project project))))) (defn duplicate-project