#
# patch "ChangeLog"
# from [5c06ef2f363ca1a97d94368001fa85e31d2131f8]
# to [e515f351203cbbb76453853ed4316f300572c411]
#
# patch "database.cc"
# from [2859331985e8687cd337886ff960d6ce0d6be7ae]
# to [7a37326e3fb76c441dde9a7000a5cbf187696ea8]
#
# patch "schema_migration.cc"
# from [38c6a6d8a82751cc80ff017b0a7f863d0b50eac6]
# to [572aa9fa72d4f32c72120d2792b8e27961ffa610]
#
# patch "schema_migration.hh"
# from [afe5da0197fa1b1b10a681a9ad6f006782708b82]
# to [889ff8603eb292709ad415b0784f3b958d99a134]
#
========================================================================
--- ChangeLog 5c06ef2f363ca1a97d94368001fa85e31d2131f8
+++ ChangeLog e515f351203cbbb76453853ed4316f300572c411
@@ -1,3 +1,9 @@
+2005-09-27 Timothy Brownawell
+
+ * schema_migration.hh: migrate_depot_schema() doesn't really exist
+ * database.cc, schema_migration.{cc,hh}: migrate_monotone_schema
+ now takes an app_state * , so data can be moved to/from the database.
+
2005-09-27 Matt Johnston
* botan/pkcs8.cc, keys.cc: fix monotone-specific pkcs8 key
========================================================================
--- database.cc 2859331985e8687cd337886ff960d6ce0d6be7ae
+++ database.cc 7a37326e3fb76c441dde9a7000a5cbf187696ea8
@@ -472,7 +472,7 @@
open();
- migrate_monotone_schema(__sql);
+ migrate_monotone_schema(__sql, __app);
sqlite3_close(__sql);
}
========================================================================
--- schema_migration.cc 38c6a6d8a82751cc80ff017b0a7f863d0b50eac6
+++ schema_migration.cc 572aa9fa72d4f32c72120d2792b8e27961ffa610
@@ -17,6 +17,7 @@
#include "sanity.hh"
#include "schema_migration.hh"
#include "botan/botan.h"
+#include "app_state.hh"
// this file knows how to migrate schema databases. the general strategy is
// to hash each schema we ever use, and make a list of the SQL commands
@@ -167,13 +168,19 @@
calculate_id(tmp2, id);
}
-typedef bool (*migrator_cb)(sqlite3 *, char **);
+typedef bool (*migrator_cb)(sqlite3 *, char **, app_state *);
struct
migrator
{
vector< pair > migration_events;
+ app_state * __app;
+ void set_app(app_state *app)
+ {
+ __app = app;
+ }
+
void add(string schema_id, migrator_cb cb)
{
migration_events.push_back(make_pair(schema_id, cb));
@@ -224,7 +231,7 @@
}
// do this migration step
- else if (! i->second(sql, &errmsg))
+ else if (! i->second(sql, &errmsg, __app))
{
string e("migration step failed");
if (errmsg != NULL)
@@ -305,7 +312,8 @@
static bool
migrate_client_merge_url_and_group(sqlite3 * sql,
- char ** errmsg)
+ char ** errmsg,
+ app_state *)
{
// migrate the posting_queue table
@@ -448,7 +456,8 @@
static bool
migrate_client_add_hashes_and_merkle_trees(sqlite3 * sql,
- char ** errmsg)
+ char ** errmsg,
+ app_state *)
{
// add the column to manifest_certs
@@ -611,7 +620,8 @@
static bool
migrate_client_to_revisions(sqlite3 * sql,
- char ** errmsg)
+ char ** errmsg,
+ app_state *)
{
int res;
@@ -692,7 +702,8 @@
static bool
migrate_client_to_epochs(sqlite3 * sql,
- char ** errmsg)
+ char ** errmsg,
+ app_state *)
{
int res;
@@ -716,7 +727,8 @@
static bool
migrate_client_to_vars(sqlite3 * sql,
- char ** errmsg)
+ char ** errmsg,
+ app_state *)
{
int res;
@@ -736,7 +748,8 @@
static bool
migrate_client_to_add_indexes(sqlite3 * sql,
- char ** errmsg)
+ char ** errmsg,
+ app_state *)
{
int res;
@@ -765,10 +778,11 @@
}
void
-migrate_monotone_schema(sqlite3 *sql)
+migrate_monotone_schema(sqlite3 *sql, app_state *app)
{
migrator m;
+ m.set_app(app);
m.add("edb5fa6cef65bcb7d0c612023d267c3aeaa1e57a",
&migrate_client_merge_url_and_group);
========================================================================
--- schema_migration.hh afe5da0197fa1b1b10a681a9ad6f006782708b82
+++ schema_migration.hh 889ff8603eb292709ad415b0784f3b958d99a134
@@ -17,9 +17,9 @@
// of the migration.
struct sqlite3;
+struct app_state;
void calculate_schema_id(sqlite3 *sql, std::string & id);
-void migrate_depot_schema(sqlite3 *sql);
-void migrate_monotone_schema(sqlite3 *sql);
+void migrate_monotone_schema(sqlite3 *sql, app_state *app);
#endif // __SCHEMA_MIGRATION__