1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-24 12:35:25 +01:00
bitwarden-server/util/Migrator/SqlServerDbMigrator.cs
Matt Bishop 2790687dc2
[PM-6938] Allow certain database operations to be skipped (#3914)
* Centralize database migration logic

* Clean up unused usings

* Prizatize

* Remove verbose flag from Docker invocation

* Allow certain database operations to be skipped

* Readonly
2024-03-27 11:20:54 -04:00

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);
}
}