Browse Source

db: don't enter into db_upgrades table on every startup.

Below this code appears:

	if (current != orig)
		db_exec(__func__, db,
			"INSERT INTO db_upgrades VALUES (%i, '%s');",
			orig, version());

But since the loop pre-increments current, this is always true.  I wondered
why there were so many duplicates in my db_upgrades table!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
issue-2504
Rusty Russell 6 years ago
parent
commit
b65c279557
  1. 4
      wallet/db.c

4
wallet/db.c

@ -636,8 +636,8 @@ static void db_migrate(struct db *db, struct log *log)
log_info(log, "Updating database from version %u to %u", log_info(log, "Updating database from version %u to %u",
current, available); current, available);
while (++current <= available) while (current < available)
db_exec(__func__, db, "%s", dbmigrations[current]); db_exec(__func__, db, "%s", dbmigrations[++current]);
/* Finally update the version number in the version table */ /* Finally update the version number in the version table */
db_exec(__func__, db, "UPDATE version SET version=%d;", available); db_exec(__func__, db, "UPDATE version SET version=%d;", available);

Loading…
Cancel
Save