варп
This commit is contained in:
parent
0146435d19
commit
cda1ab2149
41
Program.cs
41
Program.cs
@ -1762,7 +1762,26 @@ class Program
|
|||||||
{
|
{
|
||||||
await connection.OpenAsync();
|
await connection.OpenAsync();
|
||||||
|
|
||||||
// Проверяем, существует ли таблица Reports
|
// Сначала создаем таблицу Reports, если её не существует
|
||||||
|
var createTableCommand = connection.CreateCommand();
|
||||||
|
createTableCommand.CommandText =
|
||||||
|
@"
|
||||||
|
CREATE TABLE IF NOT EXISTS Reports (
|
||||||
|
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
ChatId INTEGER NOT NULL,
|
||||||
|
Priority TEXT NOT NULL,
|
||||||
|
Room TEXT NOT NULL,
|
||||||
|
Description TEXT NOT NULL,
|
||||||
|
ReporterName TEXT NOT NULL,
|
||||||
|
DateCreated DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
Status TEXT DEFAULT 'ожидает',
|
||||||
|
AdminId INTEGER DEFAULT 0
|
||||||
|
);
|
||||||
|
";
|
||||||
|
await createTableCommand.ExecuteNonQueryAsync();
|
||||||
|
Log.Information("Таблица Reports успешно создана (если её не было).");
|
||||||
|
|
||||||
|
// Проверяем, существует ли таблица Reports и добавляем недостающие столбцы
|
||||||
var checkTableCommand = connection.CreateCommand();
|
var checkTableCommand = connection.CreateCommand();
|
||||||
checkTableCommand.CommandText = "PRAGMA table_info(Reports);";
|
checkTableCommand.CommandText = "PRAGMA table_info(Reports);";
|
||||||
var tableInfo = await checkTableCommand.ExecuteReaderAsync();
|
var tableInfo = await checkTableCommand.ExecuteReaderAsync();
|
||||||
@ -1809,25 +1828,6 @@ class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Создаем таблицу Reports, если её не существует
|
|
||||||
var createTableCommand = connection.CreateCommand();
|
|
||||||
createTableCommand.CommandText =
|
|
||||||
@"
|
|
||||||
CREATE TABLE IF NOT EXISTS Reports (
|
|
||||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
ChatId INTEGER NOT NULL,
|
|
||||||
Priority TEXT NOT NULL,
|
|
||||||
Room TEXT NOT NULL,
|
|
||||||
Description TEXT NOT NULL,
|
|
||||||
ReporterName TEXT NOT NULL,
|
|
||||||
DateCreated DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
Status TEXT DEFAULT 'ожидает',
|
|
||||||
AdminId INTEGER DEFAULT 0
|
|
||||||
);
|
|
||||||
";
|
|
||||||
await createTableCommand.ExecuteNonQueryAsync();
|
|
||||||
Log.Information("Таблица Reports успешно создана (если её не было).");
|
|
||||||
|
|
||||||
// Создаем таблицу администраторов
|
// Создаем таблицу администраторов
|
||||||
await CreateAdminsTableIfNotExists();
|
await CreateAdminsTableIfNotExists();
|
||||||
}
|
}
|
||||||
@ -1838,6 +1838,7 @@ class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Dictionary<long, int> userReportSteps = new Dictionary<long, int>();
|
private static Dictionary<long, int> userReportSteps = new Dictionary<long, int>();
|
||||||
private static Dictionary<long, Report> userReports = new Dictionary<long, Report>();
|
private static Dictionary<long, Report> userReports = new Dictionary<long, Report>();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user