[tracker/wip/carlosg/update-perf: 16/72] core: Bump database version
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 16/72] core: Bump database version
- Date: Tue, 30 Aug 2022 15:39:40 +0000 (UTC)
commit 91e9fbe7497bcd127b381b650a722a62e9c53a8b
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Aug 22 16:15:59 2022 +0200
core: Bump database version
In order to fix the fts_view views as per the previous commit.
src/libtracker-sparql/core/tracker-data-manager.c | 19 +++++++++++++++++++
src/libtracker-sparql/core/tracker-db-manager.h | 3 ++-
src/libtracker-sparql/core/tracker-fts.c | 2 +-
3 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-manager.c
b/src/libtracker-sparql/core/tracker-data-manager.c
index 05ebf1c66..85d964459 100644
--- a/src/libtracker-sparql/core/tracker-data-manager.c
+++ b/src/libtracker-sparql/core/tracker-data-manager.c
@@ -4194,6 +4194,25 @@ tracker_data_manager_update_from_version (TrackerDataManager *manager,
goto error;
}
+ if (version < TRACKER_DB_VERSION_3_4) {
+ GHashTableIter iter;
+ const gchar *graph;
+
+ if (!tracker_db_interface_sqlite_fts_delete_table (iface, "main", &internal_error))
+ goto error;
+ if (!tracker_data_manager_update_fts (manager, iface, "main", &internal_error))
+ goto error;
+
+ g_hash_table_iter_init (&iter, manager->graphs);
+
+ while (g_hash_table_iter_next (&iter, (gpointer *) &graph, NULL)) {
+ if (!tracker_db_interface_sqlite_fts_delete_table (iface, graph, &internal_error))
+ goto error;
+ if (!tracker_data_manager_update_fts (manager, iface, graph, &internal_error))
+ goto error;
+ }
+ }
+
tracker_db_manager_update_version (manager->db_manager);
return TRUE;
diff --git a/src/libtracker-sparql/core/tracker-db-manager.h b/src/libtracker-sparql/core/tracker-db-manager.h
index 941ecad9d..413b6b55d 100644
--- a/src/libtracker-sparql/core/tracker-db-manager.h
+++ b/src/libtracker-sparql/core/tracker-db-manager.h
@@ -52,10 +52,11 @@ typedef enum {
/* Starts at 25 because we forgot to clean up */
TRACKER_DB_VERSION_3_0 = 25, /* 3.0 */
TRACKER_DB_VERSION_3_3, /* Blank nodes */
+ TRACKER_DB_VERSION_3_4, /* Fixed FTS view */
} TrackerDBVersion;
/* Set current database version we are working with */
-#define TRACKER_DB_VERSION_NOW TRACKER_DB_VERSION_3_3
+#define TRACKER_DB_VERSION_NOW TRACKER_DB_VERSION_3_4
void tracker_db_manager_rollback_db_creation (TrackerDBManager *db_manager);
diff --git a/src/libtracker-sparql/core/tracker-fts.c b/src/libtracker-sparql/core/tracker-fts.c
index be351817b..8398b6e7a 100644
--- a/src/libtracker-sparql/core/tracker-fts.c
+++ b/src/libtracker-sparql/core/tracker-fts.c
@@ -179,7 +179,7 @@ tracker_fts_delete_table (sqlite3 *db,
gchar *query;
int rc;
- query = g_strdup_printf ("DROP VIEW IF EXISTS fts_view");
+ query = g_strdup_printf ("DROP VIEW IF EXISTS \"%s\".fts_view", database);
rc = sqlite3_exec (db, query, NULL, NULL, NULL);
g_free (query);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]