# # patch "ChangeLog" # from [3f11efe232c0f6d25bc099e5d444e9dc7713b75f] # to [14ffab5654181abed3b704ec6b26e93a5549892c] # # patch "schema_migration.cc" # from [f9205058568c4e8b4b496d8b655a870f05edf0be] # to [931000b75115e0d2da46559e2f653b52337c122a] # --- ChangeLog +++ ChangeLog @@ -1,5 +1,11 @@ 2005-07-13 Nathaniel Smith + * schema_migration.cc (migrate_monotone_schema) + (migrator::migrate): Move the "nothing happened" check, and don't + vacuum unless a migration occurred. + +2005-07-13 Nathaniel Smith + * tests/t_restricted_diff_unchanged.at: New test. * testsuite.at: Add it. --- schema_migration.cc +++ schema_migration.cc @@ -194,11 +194,6 @@ throw runtime_error("NULL sqlite object given to migrate"); calculate_schema_id(sql, init); - if (target_id == init) - { - P(F("nothing to migrate; schema %s is up-to-date\n") % init); - return; - } if (sqlite3_create_function(sql, "sha1", -1, SQLITE_UTF8, NULL, &sqlite_sha1_fn, NULL, NULL)) @@ -262,7 +257,18 @@ { throw runtime_error("failure on COMMIT"); } + + if (sqlite3_exec(sql, "VACUUM", NULL, NULL, NULL) != SQLITE_OK) + throw runtime_error("error vacuuming after migration"); } + else + { + // We really want 'db migrate' on an up-to-date schema to be a no-op + // (no vacuum or anything, even), so that automated scripts can fire + // one off optimistically and not have to worry about getting their + // administrators to do it by hand. + P(F("no migration performed; database schema already up-to-date at %s\n") % init); + } } }; @@ -784,8 +790,4 @@ // tests/t_migrate_schema.at for details. m.migrate(sql, "1509fd75019aebef5ac3da3a5edf1312393b70e9"); - - if (sqlite3_exec(sql, "VACUUM", NULL, NULL, NULL) != SQLITE_OK) - throw runtime_error("error vacuuming after migration"); - }