@ -878,8 +878,12 @@ static void db_migrate(struct lightningd *ld, struct db *db, struct log *log)
while ( current < available ) {
while ( current < available ) {
current + + ;
current + + ;
if ( dbmigrations [ current ] . sql )
if ( dbmigrations [ current ] . sql ) {
db_exec ( __func__ , db , " %s " , dbmigrations [ current ] . sql ) ;
struct db_stmt * stmt =
db_prepare_v2 ( db , dbmigrations [ current ] . sql ) ;
db_exec_prepared_v2 ( stmt ) ;
db_stmt_free ( stmt ) ;
}
if ( dbmigrations [ current ] . func )
if ( dbmigrations [ current ] . func )
dbmigrations [ current ] . func ( ld , db ) ;
dbmigrations [ current ] . func ( ld , db ) ;
}
}
@ -1270,10 +1274,14 @@ void sqlite3_bind_amount_sat(sqlite3_stmt *stmt, int col,
/* Will apply the current config fee settings to all channels */
/* Will apply the current config fee settings to all channels */
void migrate_pr2342_feerate_per_channel ( struct lightningd * ld , struct db * db )
void migrate_pr2342_feerate_per_channel ( struct lightningd * ld , struct db * db )
{
{
db_exec ( __func__ , db ,
struct db_stmt * stmt = db_prepare_v2 (
" UPDATE channels SET feerate_base = %u, feerate_ppm = %u; " ,
db , SQL ( " UPDATE channels SET feerate_base = ?, feerate_ppm = ?; " ) ) ;
ld - > config . fee_base ,
ld - > config . fee_per_satoshi ) ;
db_bind_int ( stmt , 0 , ld - > config . fee_base ) ;
db_bind_int ( stmt , 1 , ld - > config . fee_per_satoshi ) ;
db_exec_prepared_v2 ( stmt ) ;
db_stmt_free ( stmt ) ;
}
}
void sqlite3_bind_timeabs ( sqlite3_stmt * stmt , int col , struct timeabs t )
void sqlite3_bind_timeabs ( sqlite3_stmt * stmt , int col , struct timeabs t )