mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +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:
parent
9aaf2fe8d4
commit
b65c279557
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue