Skip to content

NetDefender/Upgradier

Repository files navigation

Upgradier Packages codecov

A minimalist approach for updating multiple databases concurrently to a version based in conventions.

Declare a place to store de Source databases in json format. You can mix databases of different providers (actually SqlServer, MySql and PostgreSql).

Store batches in .sql files on Disk, Web Server, Aws S3, Azure Blob, or custom IBatchStrategy.

Optionally use a cache implementing IBatchCacheManager to not hit the server when each batch is requested.

Frozen Penguin

Prerequisites

Quick start

Create UpdateBuilder with options:

//Microsoft.Extensions.Logging.ILogger logger ...

BlobContainerClient blobContainerClient = ... // Optional use Azure

UpdateBuilder updateBuilder = new UpdateBuilder()
    .WithSourceProvider(options => new FileSourceProvider("c:\\my_files\\sources.json", options.Logger, options.Environment))
    .WithFileBatchStrategy("c:\\my_files\\batches")
    .WithCacheManager(options => new FileBatchCacheManager("c:\\my_files\\cache", options.Logger, options.Environment))
    .WithAzureBlobBatchStrategy(blobContainerClient)
    .AddSqlServerEngine()
    .AddMySqlServerEngine()
    .AddPostgreSqlServerEngine()
    .WithLogger(logger)
    .WithEnvironment("Dev");

Build to create the UpdateManager:

UpdateManager updateManager = updateBuilder.Build();

Update the databases:

IEnumerable<UpdateResult> updateResults = await updateManager.UpdateAsync();

Releases

No releases published

Packages

No packages published