mirror of
https://github.com/bitwarden/server.git
synced 2024-11-30 13:33:24 +01:00
2790687dc2
* Centralize database migration logic * Clean up unused usings * Prizatize * Remove verbose flag from Docker invocation * Allow certain database operations to be skipped * Readonly
24 lines
712 B
C#
24 lines
712 B
C#
using Bit.Core.Settings;
|
|
using Bit.Core.Utilities;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Bit.Migrator;
|
|
|
|
public class SqlServerDbMigrator : IDbMigrator
|
|
{
|
|
private readonly DbMigrator _migrator;
|
|
|
|
public SqlServerDbMigrator(GlobalSettings globalSettings, ILogger<DbMigrator> logger)
|
|
{
|
|
_migrator = new DbMigrator(globalSettings.SqlServer.ConnectionString, logger,
|
|
globalSettings.SqlServer.SkipDatabasePreparation);
|
|
}
|
|
|
|
public bool MigrateDatabase(bool enableLogging = true,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
return _migrator.MigrateMsSqlDatabaseWithRetries(enableLogging,
|
|
cancellationToken: cancellationToken);
|
|
}
|
|
}
|