mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-09 17:14:28 +01:00
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>
This commit is contained in:
@@ -636,8 +636,8 @@ static void db_migrate(struct db *db, struct log *log)
|
||||
log_info(log, "Updating database from version %u to %u",
|
||||
current, available);
|
||||
|
||||
while (++current <= available)
|
||||
db_exec(__func__, db, "%s", dbmigrations[current]);
|
||||
while (current < available)
|
||||
db_exec(__func__, db, "%s", dbmigrations[++current]);
|
||||
|
||||
/* Finally update the version number in the version table */
|
||||
db_exec(__func__, db, "UPDATE version SET version=%d;", available);
|
||||
|
||||
Reference in New Issue
Block a user