Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean permission_get_tasks during migration #601

Merged
merged 3 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions doc/postgres-HOWTO
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
GREENBONE-VULNERABILITY-MANAGER POSTGRESQL BACKEND HOWTO
========================================================

Please note: Everything should work using Postgres, but this backend has
seen little testing so far. The reference system used for development is
Debian GNU/Linux 'Jessie' 8.
Please note: Everything should work using Postgres. The reference system used
for development is Debian GNU/Linux 'Stretch' 9.

1 Install Postgres.

Expand Down Expand Up @@ -55,6 +54,10 @@ Migrating from SQLite to PostgreSQL
Manager before the migration as it would create a fresh one and therefore
prevent migration.

Note that the migrate script will modify the SQLite database to clean
up errors. So it's a good idea to make a backup in case anything goes
wrong.

2 Run "greenbone-scapdata-sync".

3 Run "greenbone-certdata-sync".
Expand Down
7 changes: 7 additions & 0 deletions tools/gvm-migrate-to-postgres.in
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,13 @@ cleanup_sqlite_db () {
# table lying around.
sqlite "DROP TABLE IF EXISTS escalator_condition_data_trash;"
test_sql_exit "Failed to remove escalator_condition_data_trash"

HAVE_CACHE=`sqlite "SELECT EXISTS (SELECT FROM sqlite_master WHERE type='table' AND name='permissions_get_tasks');"`
if [ "$HAVE_CACHE" != "0" ]
then
sqlite "UPDATE permissions_get_tasks SET has_permission = 1 WHERE has_permission != '0';"
test_sql_exit "Failed to clean permission_get_tasks"
fi
}

# Replace the value of a column if the cast does not work
Expand Down