changeset 821:2465fff63ad9

Old group deletion at migration done in a transaction
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 19 Jun 2020 09:52:12 +0900
parents e64d18e78507
children fc6855839333
files s4-migrate.sh
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/s4-migrate.sh	Thu Jun 18 19:30:06 2020 +0900
+++ b/s4-migrate.sh	Fri Jun 19 09:52:12 2020 +0900
@@ -109,7 +109,7 @@
        )
   err d3="$d3"
   if [ -z "$d1$d2$d3" ]; then
-    echo "Copying done, rewriting article links..."
+    echo "Copy and verification done, rewriting URL in articles..."
     echo "Old URL: $URL"
     echo "New URL: $dsturl"
     query <<-EOF
@@ -166,14 +166,19 @@
               | unhexize | sed -Ef "$sedfile2" | hexize`
       echo "UPDATE dst.article_s SET val=X'$newval' WHERE rowid=$arid;" >>$sql
     done
+    echo "URL rewriting done." 
+    echo -n "Removing the group in the old world..." 
     if [ -z "`query \".read $sql\"`" ]; then
       query <<-EOF
+	SAVEPOINT rmgroup;
 	DELETE FROM main.article WHERE blogid IN ($blogs);
 	DELETE FROM main.blog WHERE id IN ($blogs);
 	DELETE FROM main.grp WHERE rowid=$grid;
+	RELEASE SAVEPOINT rmgroup;
 	EOF
       s=`query "SELECT * FROM main.grp WHERE rowid=$grid;"`
       if [ -z "$s" ]; then
+	echo "Done."
 	echo "Success!!"
 	query "END;"
 	clean-orphaned

yatex.org