public void Erase() { var db = _configProvider.GetDbConnectionString(); try { using (var cnx = new NpgsqlConnection(db)) { var evolve = new Evolve.Evolve(cnx); evolve.Erase(); }; } catch (Exception ex) { Console.WriteLine($"DB Migrations Failed. \n{ex}"); throw; } }
private void Migrate(string path) { using var connection = new NpgsqlConnection(configuration.GetConnectionString("default")); var evolve = new Evolve.Evolve(connection, msg => logger.LogInformation(msg)) { Locations = new[] { Path.Combine(path, "db/migrations"), Path.Combine(path, "db/datasets") }, IsEraseDisabled = this.environment.IsProduction() }; if (this.environment.IsDevelopment()) { evolve.Erase(); } evolve.Migrate(); }