added Db version update

This commit is contained in:
Nicolas Constant 2021-01-23 00:23:37 -05:00
parent 2f933ffc9c
commit cdb8aa48e1
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688

View file

@ -145,12 +145,25 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
var addIndex = $@"CREATE INDEX IF NOT EXISTS lastsync_twitteruser ON {_settings.TwitterUserTableName}(lastSync)";
await _tools.ExecuteRequestAsync(addIndex);
return new Version(2, 0);
await UpdateDbVersionAsync(to);
return to;
}
throw new NotImplementedException();
}
private async Task UpdateDbVersionAsync(Version newVersion)
{
using (var dbConnection = Connection)
{
dbConnection.Open();
await dbConnection.ExecuteAsync(
$"UPDATE {_settings.DbVersionTableName} SET major = @major, minor = @minor WHERE type = @type",
new { type = DbVersionType, major = newVersion.Major, minor = newVersion.Minor });
}
}
public async Task DeleteAllAsync()
{
var dropsRequests = new[]