This commit is contained in:
2020-05-14 15:20:10 +00:00
parent 8f6e9cdc42
commit 8dec3816fa

View File

@@ -177,26 +177,20 @@ namespace AyaNova.Biz
//
internal async Task<bool> ResetSerial(long newSerial)
{
/*
ALTER TABLE table_name
ALTER COLUMN column_name
{ SET GENERATED { ALWAYS| BY DEFAULT } |
SET sequence_option | RESTART [ [ WITH ] restart ] }
*/
using (var command = ct.Database.GetDbConnection().CreateCommand())
{
command.CommandText = $"alter table awidget alter column serial restart with {newSerial}";
await ct.Database.OpenConnectionAsync();
await command.ExecuteNonQueryAsync();
await ct.Database.CloseConnectionAsync();
await ct.Database.CloseConnectionAsync();
}
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, 0, BizType, AyaEvent.ResetSerial, newSerial.ToString()), ct);
return true;
}