diff --git a/openbis/source/sql/postgresql/migration/migration-159-160.sql b/openbis/source/sql/postgresql/migration/migration-159-160.sql
index f9d812e6fc9b6a41720cace98ebf068ac0f0cae9..1c2395256fc52b2263a6280b25181b73b220b679 100644
--- a/openbis/source/sql/postgresql/migration/migration-159-160.sql
+++ b/openbis/source/sql/postgresql/migration/migration-159-160.sql
@@ -1,10 +1,3 @@
-UPDATE content_copies SET location_unique_check = 
-  data_id || ',' || 
-  edms_id || ',' || 
-  coalesce(path, '') || ',' || 
-  coalesce(git_commit_hash, '') || ',' || 
-  coalesce(external_code, '');
-        
 CREATE OR REPLACE FUNCTION content_copies_uniqueness_check()
   RETURNS trigger AS
 $BODY$
@@ -18,3 +11,10 @@ BEGIN
 END;
 $BODY$
   LANGUAGE 'plpgsql';
+
+UPDATE content_copies SET location_unique_check = 
+  data_id || ',' || 
+  edms_id || ',' || 
+  coalesce(path, '') || ',' || 
+  coalesce(git_commit_hash, '') || ',' || 
+  coalesce(external_code, '');