From 4db8b0fc641e4a96ea8f5bd0e74de856cdddc3e5 Mon Sep 17 00:00:00 2001 From: Professional Date: Wed, 19 Mar 2025 19:29:40 +0700 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Program.cs b/Program.cs index eaab3ae..ce94308 100644 --- a/Program.cs +++ b/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 userReportSteps = new Dictionary(); private static Dictionary userReports = new Dictionary();