added index
This commit is contained in:
parent
f6ed37b46a
commit
2f933ffc9c
3 changed files with 13 additions and 12 deletions
|
@ -141,6 +141,10 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
|
|||
{
|
||||
var addLastSync = $@"ALTER TABLE {_settings.TwitterUserTableName} ADD lastSync TIMESTAMP (2) WITHOUT TIME ZONE";
|
||||
await _tools.ExecuteRequestAsync(addLastSync);
|
||||
|
||||
var addIndex = $@"CREATE INDEX IF NOT EXISTS lastsync_twitteruser ON {_settings.TwitterUserTableName}(lastSync)";
|
||||
await _tools.ExecuteRequestAsync(addIndex);
|
||||
|
||||
return new Version(2, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,18 +18,11 @@ namespace BirdsiteLive.DAL.Postgres.Tools
|
|||
|
||||
public async Task ExecuteRequestAsync(string request)
|
||||
{
|
||||
try
|
||||
using (var conn = new NpgsqlConnection(_settings.ConnString))
|
||||
using (var cmd = new NpgsqlCommand(request, conn))
|
||||
{
|
||||
using (var conn = new NpgsqlConnection(_settings.ConnString))
|
||||
using (var cmd = new NpgsqlCommand(request, conn))
|
||||
{
|
||||
await conn.OpenAsync();
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
await conn.OpenAsync();
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace BirdsiteLive.DAL.Postgres.Tests.DataAccessLayers
|
|||
public async Task CleanUp()
|
||||
{
|
||||
var dal = new DbInitializerPostgresDal(_settings, _tools);
|
||||
await dal.DeleteAllAsync();
|
||||
try
|
||||
{
|
||||
await dal.DeleteAllAsync();
|
||||
}
|
||||
catch (Exception ) { }
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
Reference in a new issue