-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
107 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using grate.Configuration; | ||
using grate.Infrastructure; | ||
using grate.Migration; | ||
using grate.PostgreSql.Infrastructure; | ||
using grate.PostgreSql.Migration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using Sqlite.TestInfrastructure; | ||
using TestCommon.TestInfrastructure; | ||
|
||
namespace PostgreSQL; | ||
|
||
// ReSharper disable once UnusedType.Global | ||
public class Startup | ||
{ | ||
// ReSharper disable once UnusedMember.Global | ||
public void ConfigureServices(IServiceCollection services, HostBuilderContext context) | ||
{ | ||
services | ||
.AddLogging( | ||
lb => lb | ||
.AddXUnit() | ||
.AddConsole() | ||
.SetMinimumLevel(TestConfig.GetLogLevel()) | ||
) | ||
.AddSingleton<IGrateMigrator, GrateMigrator>() | ||
.AddSingleton<Func<GrateConfiguration, GrateMigrator>>(provider => | ||
config => | ||
{ | ||
IDatabase database = provider.GetRequiredService<IDatabase>(); | ||
|
||
ILogger<DbMigrator> dbLogger = provider.GetRequiredService<ILogger<DbMigrator>>(); | ||
ILogger<GrateMigrator> grateLogger = provider.GetRequiredService<ILogger<GrateMigrator>>(); | ||
|
||
IHashGenerator hashGenerator = provider.GetRequiredService<IHashGenerator>(); | ||
return | ||
new GrateMigrator(grateLogger, | ||
new DbMigrator(database, dbLogger, hashGenerator, config)); | ||
}) | ||
.AddSingleton<IHashGenerator, HashGenerator>() | ||
|
||
.AddTransient<IGrateTestContext, SqliteGrateTestContext>() | ||
|
||
.AddTransient<IDatabase, PostgreSqlDatabase>() | ||
.AddSingleton<ISyntax, PostgreSqlSyntax>() | ||
.AddSingleton<IDatabaseConnectionFactory, SqliteConnectionFactory>() | ||
.AddSingleton<StatementSplitter>() | ||
.AddSingleton(service => | ||
{ | ||
var database = service.GetService<IDatabase>()!; | ||
return new StatementSplitter(database.StatementSeparatorRegex); | ||
}); | ||
; | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.