db_lock(mdb);
db_start_transaction(jcr, mdb);
- Mmsg(mdb->cmd, "SELECT 1 from PathHierarchy LIMIT 1");
- /* TODO: Add this code in the make_bacula_table script */
+ /* TODO: Remove this code when updating make_bacula_table script */
+ Mmsg(mdb->cmd, "SELECT 1 FROM Job WHERE HasCache<>2 LIMIT 1");
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
Dmsg0(dbglevel, "Creating cache table\n");
Mmsg(mdb->cmd, "ALTER TABLE Job ADD HasCache int DEFAULT 0");
if (clean) {
Pmsg0(0, "Clean old table\n");
- db_sql_query(db, "DELETE FROM brestore_pathhierarchy", NULL, NULL);
- db_sql_query(db, "DELETE FROM brestore_knownjobid", NULL, NULL);
- db_sql_query(db, "DELETE FROM brestore_pathvisibility", NULL, NULL);
+ db_sql_query(db, "DELETE FROM PathHierarchy", NULL, NULL);
+ db_sql_query(db, "UPDATE Job SET HasCache=0", NULL, NULL);
+ db_sql_query(db, "DELETE FROM PathVisibility", NULL, NULL);
bvfs_update_cache(bjcr, db);
}