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

View File

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