mirror of
https://github.com/NicolasConstant/BirdsiteLive
synced 2025-06-05 21:49:16 +02:00
added index
This commit is contained in:
@@ -141,6 +141,10 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
|
|||||||
{
|
{
|
||||||
var addLastSync = $@"ALTER TABLE {_settings.TwitterUserTableName} ADD lastSync TIMESTAMP (2) WITHOUT TIME ZONE";
|
var addLastSync = $@"ALTER TABLE {_settings.TwitterUserTableName} ADD lastSync TIMESTAMP (2) WITHOUT TIME ZONE";
|
||||||
await _tools.ExecuteRequestAsync(addLastSync);
|
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);
|
return new Version(2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,18 +18,11 @@ namespace BirdsiteLive.DAL.Postgres.Tools
|
|||||||
|
|
||||||
public async Task ExecuteRequestAsync(string request)
|
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))
|
await conn.OpenAsync();
|
||||||
using (var cmd = new NpgsqlCommand(request, conn))
|
await cmd.ExecuteNonQueryAsync();
|
||||||
{
|
|
||||||
await conn.OpenAsync();
|
|
||||||
await cmd.ExecuteNonQueryAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,11 @@ namespace BirdsiteLive.DAL.Postgres.Tests.DataAccessLayers
|
|||||||
public async Task CleanUp()
|
public async Task CleanUp()
|
||||||
{
|
{
|
||||||
var dal = new DbInitializerPostgresDal(_settings, _tools);
|
var dal = new DbInitializerPostgresDal(_settings, _tools);
|
||||||
await dal.DeleteAllAsync();
|
try
|
||||||
|
{
|
||||||
|
await dal.DeleteAllAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
Reference in New Issue
Block a user