db: Add a migration to set received_time on forwards in rare cases

The case where this is needed is when the wallet had a forwarded payment
somewhere between commits 66a47d2 (which started tracking forwardings) and
d901304 (which added the `received_time` column). This just emulates the
behavior of sqlite3 for postgres as well.

Signed-off-by: Christian Decker <@cdecker>
This commit is contained in:
Christian Decker 2019-10-20 23:04:50 +02:00 committed by neil saitug
parent 1ecad0cc53
commit 396e8224fa

View File

@ -477,6 +477,9 @@ static struct migration dbmigrations[] = {
");"), NULL},
{SQL("ALTER TABLE channels ADD shutdown_scriptpubkey_local BLOB;"),
NULL},
/* See https://github.com/ElementsProject/lightning/issues/3189 */
{SQL("UPDATE forwarded_payments SET received_time=0 WHERE received_time IS NULL;"),
NULL},
};
/* Leak tracking. */