diff --git a/Dashboard/Services/DatabaseService.NocHealth.cs b/Dashboard/Services/DatabaseService.NocHealth.cs index c1f59887..7a98b656 100644 --- a/Dashboard/Services/DatabaseService.NocHealth.cs +++ b/Dashboard/Services/DatabaseService.NocHealth.cs @@ -641,7 +641,7 @@ ORDER BY r.total_elapsed_time DESC { results.Add(new LongRunningQueryInfo { - SessionId = reader.GetInt32(0), + SessionId = Convert.ToInt32(reader.GetValue(0)), DatabaseName = reader.IsDBNull(1) ? "" : reader.GetString(1), QueryText = reader.IsDBNull(2) ? "" : reader.GetString(2), ProgramName = reader.IsDBNull(3) ? "" : reader.GetString(3), diff --git a/Lite/Database/DuckDbInitializer.cs b/Lite/Database/DuckDbInitializer.cs index 57121939..953401fe 100644 --- a/Lite/Database/DuckDbInitializer.cs +++ b/Lite/Database/DuckDbInitializer.cs @@ -141,11 +141,13 @@ await ExecuteNonQueryAsync(connection, var existingVersion = await GetSchemaVersionAsync(connection); - if (existingVersion < CurrentSchemaVersion) + /* On a fresh/reset database (v0), skip migrations entirely — they DROP tables + expecting CREATE TABLE to follow, which is destructive on a blank DB. + Just create tables with the current schema and stamp the version. */ + if (existingVersion > 0 && existingVersion < CurrentSchemaVersion) { _logger?.LogInformation("Schema upgrade needed: v{Old} -> v{New}", existingVersion, CurrentSchemaVersion); await RunMigrationsAsync(connection, existingVersion); - await SetSchemaVersionAsync(connection, CurrentSchemaVersion); } foreach (var tableStatement in Schema.GetAllTableStatements()) @@ -158,6 +160,11 @@ await ExecuteNonQueryAsync(connection, await ExecuteNonQueryAsync(connection, indexStatement); } + if (existingVersion < CurrentSchemaVersion) + { + await SetSchemaVersionAsync(connection, CurrentSchemaVersion); + } + _logger?.LogInformation("Database initialization complete. Schema version: {Version}", CurrentSchemaVersion); } diff --git a/README.md b/README.md index 4f9f8c04..9e37523d 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,13 @@ Free, open-source SQL Server performance monitoring in two editions. Built for D ![Dashboard landing page with server health cards](Screenshots/Screenshot%20Dashboard%20landing%20page%20with%20server%20health%20cards.jpg) ### Full Dashboard — Resource Overview -![Full Dashboard with charts](Screenshots/Screenshot%20Full%20Dashboard%20with%20charts.jpg) +![Full Dashboard — Resource Overview](Screenshots/Full%20Dashboard%20%E2%80%94%20Resource%20Overview.jpg) ### Lite Edition — Query Performance -![Lite Edition main window](Screenshots/Screenshot%20Lite%20Edition%20main%20window.jpg) +![Lite Edition — Query Performance](Screenshots/Lite%20Edition%20%E2%80%94%20Query%20Performance.jpg) + +### Graphical Plan Viewer +![Graphical plan viewer with missing index suggestions and operator analysis](Screenshots/New%20Query%20Plan%20Viewer.jpg) ### Alert Notifications ![Alert notification](Screenshots/Screenshot%20alert%20notification%20or%20email.jpg) diff --git "a/Screenshots/Full Dashboard \342\200\224 Resource Overview.jpg" "b/Screenshots/Full Dashboard \342\200\224 Resource Overview.jpg" new file mode 100644 index 00000000..13b3cb0e Binary files /dev/null and "b/Screenshots/Full Dashboard \342\200\224 Resource Overview.jpg" differ diff --git "a/Screenshots/Lite Edition \342\200\224 Query Performance.jpg" "b/Screenshots/Lite Edition \342\200\224 Query Performance.jpg" new file mode 100644 index 00000000..59031716 Binary files /dev/null and "b/Screenshots/Lite Edition \342\200\224 Query Performance.jpg" differ diff --git a/Screenshots/New Query Plan Viewer.jpg b/Screenshots/New Query Plan Viewer.jpg new file mode 100644 index 00000000..6bfae79a Binary files /dev/null and b/Screenshots/New Query Plan Viewer.jpg differ