fix: correctly propagate a migration status when the migration failed
This commit is contained in:
parent
aae93d018b
commit
92c7f90b95
|
@ -76,7 +76,7 @@ bool Migration::do_migration(morm::ModelConnector * model_connector, morm::Model
|
|||
if( current_table_version != old_table_version )
|
||||
{
|
||||
migration.table_version = current_table_version;
|
||||
migration_status = migration.save();
|
||||
bool migration_save_status = migration.save();
|
||||
|
||||
pt::Log * log = model_connector->get_logger();
|
||||
|
||||
|
@ -85,13 +85,18 @@ bool Migration::do_migration(morm::ModelConnector * model_connector, morm::Model
|
|||
(*log) << pt::Log::log2 << "Migration: table " << table_name << " has been migrated to version " << current_table_version << pt::Log::logend;
|
||||
}
|
||||
|
||||
if( !migration_status && log )
|
||||
if( !migration_save_status && log )
|
||||
{
|
||||
(*log) << pt::Log::log1 << "Migration: table " << table_name << " has been migrated to version " << current_table_version;
|
||||
(*log) << " but there was a problem with saving this information in the migration table." << pt::Log::logend;
|
||||
(*log) << "Make sure the migration table is created and save/update following record there:" << pt::Log::logend;
|
||||
(*log) << migration << pt::Log::logend;
|
||||
}
|
||||
|
||||
if( !migration_save_status )
|
||||
{
|
||||
migration_status = false;
|
||||
}
|
||||
}
|
||||
|
||||
return migration_status;
|
||||
|
|
Loading…
Reference in New Issue