diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-08-12 23:59:45 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-09-01 02:34:00 +0800 |
commit | 2c6125c8768c138897d1d2b91b711520d61c0eee (patch) | |
tree | d1a5d4ea36b022f8f83d68afb0553d892e72f1bb | |
parent | 54810099280f6086b79f92db0a2722b434c01657 (diff) | |
download | gsoc2013-epiphany-2c6125c8768c138897d1d2b91b711520d61c0eee.tar.gz gsoc2013-epiphany-2c6125c8768c138897d1d2b91b711520d61c0eee.tar.zst gsoc2013-epiphany-2c6125c8768c138897d1d2b91b711520d61c0eee.zip |
ephy-profile-migrator: New migrator for history backend changes
This adds a couple of new required columns to the urls table.
-rw-r--r-- | lib/ephy-profile-migrator.c | 47 | ||||
-rw-r--r-- | lib/ephy-profile-utils.h | 2 |
2 files changed, 47 insertions, 2 deletions
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c index f013473c0..511698351 100644 --- a/lib/ephy-profile-migrator.c +++ b/lib/ephy-profile-migrator.c @@ -37,6 +37,7 @@ #include "ephy-history-service.h" #include "ephy-profile-utils.h" #include "ephy-settings.h" +#include "ephy-sqlite-connection.h" #include "ephy-web-app-utils.h" #ifdef ENABLE_NSS #include "ephy-nss-glue.h" @@ -769,6 +770,49 @@ migrate_web_app_links () ephy_web_application_free_application_list (apps); } +static void +migrate_new_urls_table () +{ + EphySQLiteConnection *history_database; + char *filename; + GError *error = NULL; + + filename = g_build_filename (ephy_dot_dir (), "ephy-history.db", NULL); + history_database = ephy_sqlite_connection_new (); + ephy_sqlite_connection_open (history_database, filename, &error); + + if (error) { + g_warning ("Failed to open history database: %s\n", error->message); + g_error_free (error); + g_free (filename); + return; + } + + ephy_sqlite_connection_execute (history_database, + "ALTER TABLE urls " + "ADD COLUMN thumbnail_update_time INTEGER DEFAULT 0", + &error); + if (error) { + g_warning ("Failed to add new column to table in history backend: %s\n", + error->message); + g_error_free (error); + error = NULL; + } + ephy_sqlite_connection_execute (history_database, + "ALTER TABLE urls " + "ADD COLUMN hidden_from_overview INTEGER DEFAULT 0", + &error); + if (error) { + g_warning ("Failed to add new column to table in history backend: %s\n", + error->message); + g_error_free (error); + error = NULL; + } + + g_object_unref (history_database); + g_free (filename); +} + const EphyProfileMigrator migrators[] = { migrate_cookies, migrate_passwords, @@ -780,7 +824,8 @@ const EphyProfileMigrator migrators[] = { migrate_passwords2, migrate_history, migrate_tabs_visibility, - migrate_web_app_links + migrate_web_app_links, + migrate_new_urls_table, }; static gboolean diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h index 9ae095735..8f50922c6 100644 --- a/lib/ephy-profile-utils.h +++ b/lib/ephy-profile-utils.h @@ -26,7 +26,7 @@ #define FORM_USERNAME_KEY "form_username" #define FORM_PASSWORD_KEY "form_password" -#define EPHY_PROFILE_MIGRATION_VERSION 7 +#define EPHY_PROFILE_MIGRATION_VERSION 8 int ephy_profile_utils_get_migration_version (void); |