WIP #751 - Fix an issue with migrations
Rather oddly, the migrations weren't committing, and so the index tables never got created.
This commit is contained in:
parent
3e010fe26c
commit
8798d6bd42
|
|
@ -53,6 +53,25 @@ namespace Elsa.Persistence.YesSql.Services
|
|||
_logger.LogError(ex, "Could not run migrations automatically on '{FeatureName}'", migration);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var commitTask = _session.CurrentTransaction?.CommitAsync() ?? Task.CompletedTask;
|
||||
await commitTask;
|
||||
}
|
||||
catch(InvalidOperationException)
|
||||
{
|
||||
// TODO: Improve on this ugly hack/workaround!
|
||||
//
|
||||
// The commit can throw this exception because it's already been committed. But if
|
||||
// we don't explicitly commit here then it never gets committed and it's as if the
|
||||
// migrations never took place!
|
||||
//
|
||||
// I suspect that either this method is being called more than once, or perhaps (IMO
|
||||
// more likely) an async operation (somewhere) isn't being awaited. That could mean
|
||||
// that the connection is closed/killed-off before the commit actually completes,
|
||||
// with the effect that it doesn't happen.
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<IDataMigration>> GetMigrationsThatNeedUpdateAsync()
|
||||
|
|
|
|||
Loading…
Reference in a new issue