Author: mattm
Date: 2016-10-13 14:54:49 +0200 (Thu, 13 Oct 2016)
New Revision: 26398

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/tools/openvas-migrate-to-postgres.in
Log:
        * tools/openvas-migrate-to-postgres.in (cleanup_sqlite_db): Remove stray
        role_users_trash.
        (copy_data): Adjust logs.
        (migrate): Set TO before using it.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog     2016-10-13 09:36:52 UTC (rev 26397)
+++ trunk/openvas-manager/ChangeLog     2016-10-13 12:54:49 UTC (rev 26398)
@@ -1,5 +1,12 @@
 2016-10-13  Matthew Mundell <matthew.mund...@greenbone.net>
 
+       * tools/openvas-migrate-to-postgres.in (cleanup_sqlite_db): Remove stray
+       role_users_trash.
+       (copy_data): Adjust logs.
+       (migrate): Set TO before using it.
+
+2016-10-13  Matthew Mundell <matthew.mund...@greenbone.net>
+
        * src/manage_migrators.c (migrate_167_to_168): Delete task_preferences
        too.
 

Modified: trunk/openvas-manager/tools/openvas-migrate-to-postgres.in
===================================================================
--- trunk/openvas-manager/tools/openvas-migrate-to-postgres.in  2016-10-13 
09:36:52 UTC (rev 26397)
+++ trunk/openvas-manager/tools/openvas-migrate-to-postgres.in  2016-10-13 
12:54:49 UTC (rev 26398)
@@ -966,6 +966,10 @@
 }
 
 cleanup_sqlite_db () {
+  # Remove stray role_users_trash.
+  sqlite "DELETE FROM role_users_trash WHERE role NOT IN (SELECT id FROM 
roles_trash);"
+  test_sql_exit "Failed to clean up role_users_trash"
+
   # Remove stray task_alerts.
   sqlite "DELETE FROM task_alerts WHERE alert_location = 0 AND alert NOT IN 
(SELECT id FROM alerts);"
   test_sql_exit "Failed to clean up task_alerts"
@@ -1066,7 +1070,7 @@
     exit 1
   fi
 
-  log_info "Copying SQLite3 data: copying"
+  log_info "Copying SQLite3 data: copying tables"
 
   for TABLE in $TABLES; do
     # Get the Postgres columns because the import CSV must be in that order.
@@ -1074,6 +1078,7 @@
     # This also works around extra columns that were hanging around in old
     # database.
     #
+    log_info "Copying SQLite3 data: copying table $TABLE"
     COLS=`pg "SELECT string_agg ('\"' || column_name || '\"', ',') from 
(select column_name from information_schema.columns where table_schema = 
'public' and table_name = '$TABLE' order by ordinal_position) as sub;"`
     log_debug "COLS: $COLS"
     # Pipe SQLite CSV output into Postgres COPY FROM.
@@ -1571,10 +1576,10 @@
     exit 1
   fi
 
+  TO=$2
+
   log_info "Migrating schema from $1 to $TO."
 
-  TO=$2
-
   if [ $1 -eq $TO ]
   then
       return

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits

Reply via email to