Skip to content

Commit

Permalink
Add migrator to remove table nvt_cves.
Browse files Browse the repository at this point in the history
  • Loading branch information
janowagner committed Jun 4, 2019
1 parent 1df070c commit b6fdd16
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ include (CPack)

## Variables

set (GVMD_DATABASE_VERSION 208)
set (GVMD_DATABASE_VERSION 209)

set (GVMD_SCAP_DATABASE_VERSION 15)

Expand Down
34 changes: 34 additions & 0 deletions src/manage_migrators.c
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,39 @@ migrate_207_to_208 ()
return 0;
}

/**
* @brief Migrate the database from version 208 to version 209.
*
* @return 0 success, -1 error.
*/
int
migrate_208_to_209 ()
{
sql_begin_immediate ();

/* Ensure that the database is currently version 208. */

if (manage_db_version () != 208)
{
sql_rollback ();
return -1;
}

/* Update the database. */

/* Drop the now-unused table "nvt_cves". */

sql ("DROP TABLE IF EXISTS nvt_cves;");

/* Set the database version to 209. */

set_db_version (209);

sql_commit ();

return 0;
}

#undef UPDATE_DASHBOARD_SETTINGS

/**
Expand Down Expand Up @@ -1739,6 +1772,7 @@ static migrator_t database_migrators[] = {
{206, migrate_205_to_206},
{207, migrate_206_to_207},
{208, migrate_207_to_208},
{209, migrate_208_to_209},
/* End marker. */
{-1, NULL}};

Expand Down

0 comments on commit b6fdd16

Please sign in to comment.