фикс ФИО админа в бд
This commit is contained in:
parent
62ba8b5877
commit
3891b6c033
22
Program.cs
22
Program.cs
@ -1358,6 +1358,27 @@ class Program
|
||||
);";
|
||||
await command.ExecuteNonQueryAsync();
|
||||
Log.Information("Таблица Admins успешно создана (если её не было).");
|
||||
|
||||
// Проверяем наличие столбца FullName
|
||||
command.CommandText = "PRAGMA table_info(Admins);";
|
||||
var tableInfo = await command.ExecuteReaderAsync();
|
||||
bool fullNameColumnExists = false;
|
||||
|
||||
while (await tableInfo.ReadAsync())
|
||||
{
|
||||
if (tableInfo["name"].ToString() == "FullName")
|
||||
{
|
||||
fullNameColumnExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fullNameColumnExists)
|
||||
{
|
||||
command.CommandText = "ALTER TABLE Admins ADD COLUMN FullName TEXT NOT NULL DEFAULT '';";
|
||||
await command.ExecuteNonQueryAsync();
|
||||
Log.Information("Столбец FullName добавлен в таблицу Admins.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -1367,6 +1388,7 @@ class Program
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Метод для сохранения администратора в базу данных
|
||||
private static async Task SaveAdminToDatabase(long chatId, string fullName)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user