更新nuget&&添加swagger

This commit is contained in:
2026-08-09 14:47:08 +08:00 Unverified
parent 1229f3163d
commit 3c9863580b
16 changed files with 6967 additions and 38 deletions
@@ -90,6 +90,8 @@ public sealed class DevelopmentSqliteMigrator(
"20260809_47_course_grade_distribution";
private const string TeachingTaskGradeAnalyticsMigration =
"20260809_48_teaching_task_grade_analytics";
private const string SwaggerDocumentationSettingMigration =
"20260809_49_swagger_documentation_setting";
public async Task MigrateAsync(CancellationToken cancellationToken = default)
{
@@ -669,6 +671,14 @@ public sealed class DevelopmentSqliteMigrator(
TeachingTaskGradeAnalyticsMigration,
TeachingTaskGradeAnalyticsStatements,
cancellationToken);
var swaggerSettingsExist = await db.Database
.SqlQueryRaw<int>(
"SELECT COUNT(*) AS \"Value\" FROM sqlite_master WHERE type = 'table' AND name = 'SystemFeatureSettings'")
.AnyAsync(value => value > 0, cancellationToken);
await ApplyMigrationAsync(
SwaggerDocumentationSettingMigration,
swaggerSettingsExist ? [] : SwaggerDocumentationSettingStatements,
cancellationToken);
}
private async Task ApplyMigrationAsync(
@@ -2913,4 +2923,21 @@ public sealed class DevelopmentSqliteMigrator(
ADD COLUMN "Kind" INTEGER NOT NULL DEFAULT 1;
"""
];
private static readonly string[] SwaggerDocumentationSettingStatements =
[
"""
CREATE TABLE "SystemFeatureSettings" (
"Id" TEXT NOT NULL CONSTRAINT "PK_SystemFeatureSettings" PRIMARY KEY,
"Key" TEXT NOT NULL,
"IsEnabled" INTEGER NOT NULL,
"CreatedAt" TEXT NOT NULL,
"UpdatedAt" TEXT NOT NULL
);
""",
"""
CREATE UNIQUE INDEX "IX_SystemFeatureSettings_Key"
ON "SystemFeatureSettings" ("Key");
"""
];
}