тест
This commit is contained in:
parent
63bc99fee9
commit
4db8b0fc64
27
Program.cs
27
Program.cs
@ -641,6 +641,32 @@ class Program
|
||||
{
|
||||
await connection.OpenAsync();
|
||||
|
||||
// Проверяем, существует ли таблица Reports
|
||||
var checkTableCommand = connection.CreateCommand();
|
||||
checkTableCommand.CommandText = "PRAGMA table_info(Reports);";
|
||||
var tableInfo = await checkTableCommand.ExecuteReaderAsync();
|
||||
|
||||
bool priorityColumnExists = false;
|
||||
|
||||
while (await tableInfo.ReadAsync())
|
||||
{
|
||||
if (tableInfo["name"].ToString() == "Priority")
|
||||
{
|
||||
priorityColumnExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!priorityColumnExists)
|
||||
{
|
||||
// Добавляем столбец Priority, если его нет
|
||||
var alterTableCommand = connection.CreateCommand();
|
||||
alterTableCommand.CommandText = "ALTER TABLE Reports ADD COLUMN Priority TEXT NOT NULL DEFAULT 'низкий';";
|
||||
await alterTableCommand.ExecuteNonQueryAsync();
|
||||
Log.Information("Столбец Priority добавлен в таблицу Reports.");
|
||||
}
|
||||
|
||||
// Создаем таблицу, если её не существует
|
||||
var createTableCommand = connection.CreateCommand();
|
||||
createTableCommand.CommandText =
|
||||
@"
|
||||
@ -667,6 +693,7 @@ class Program
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Dictionary<long, int> userReportSteps = new Dictionary<long, int>();
|
||||
private static Dictionary<long, Report> userReports = new Dictionary<long, Report>();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user