Rename WebApi project to Vegasco.Server.Api
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
And update all references including comments etc.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Npgsql;
|
||||
using Respawn;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace Vegasco.Server.Api.Tests.Integration;
|
||||
internal sealed class PostgresRespawner : IDisposable
|
||||
{
|
||||
private readonly DbConnection _connection;
|
||||
private readonly Respawner _respawner;
|
||||
|
||||
private PostgresRespawner(Respawner respawner, DbConnection connection)
|
||||
{
|
||||
_respawner = respawner;
|
||||
_connection = connection;
|
||||
}
|
||||
|
||||
public static async Task<PostgresRespawner> CreateAsync(string connectionString)
|
||||
{
|
||||
DbConnection connection = new NpgsqlConnection(connectionString);
|
||||
await connection.OpenAsync();
|
||||
|
||||
var respawner = await Respawner.CreateAsync(connection,
|
||||
new RespawnerOptions
|
||||
{
|
||||
SchemasToInclude = ["public"],
|
||||
DbAdapter = DbAdapter.Postgres
|
||||
});
|
||||
return new PostgresRespawner(respawner, connection);
|
||||
}
|
||||
|
||||
public async Task ResetDatabaseAsync()
|
||||
{
|
||||
await _respawner.ResetAsync(_connection);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_connection.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user