自选项目实验优化

This commit is contained in:
2026-08-11 09:29:44 +08:00 Unverified
parent 9b32ee916c
commit e69ab6f580
11 changed files with 7578 additions and 67 deletions
@@ -104,6 +104,8 @@ public sealed class DevelopmentSqliteMigrator(
"20260809_54_experiment_course_grades";
private const string NotificationInboxIndexesMigration =
"20260810_55_notification_inbox_indexes";
private const string SelfScheduledExperimentSelectionMigration =
"20260811_56_self_scheduled_experiment_selection";
public async Task MigrateAsync(CancellationToken cancellationToken = default)
{
@@ -737,6 +739,10 @@ public sealed class DevelopmentSqliteMigrator(
NotificationInboxIndexesMigration,
NotificationInboxIndexesStatements,
cancellationToken);
await ApplyMigrationAsync(
SelfScheduledExperimentSelectionMigration,
SelfScheduledExperimentSelectionStatements,
cancellationToken);
}
private async Task ApplyMigrationAsync(
@@ -3129,6 +3135,27 @@ public sealed class DevelopmentSqliteMigrator(
"""
];
private static readonly string[] SelfScheduledExperimentSelectionStatements =
[
"ALTER TABLE \"ExperimentProjects\" ADD COLUMN \"SelectionStartsAt\" TEXT NULL;",
"ALTER TABLE \"ExperimentProjects\" ADD COLUMN \"SelectionEndsAt\" TEXT NULL;",
"""
CREATE TABLE "ExperimentSessionInstructors" (
"Id" TEXT NOT NULL CONSTRAINT "PK_ExperimentSessionInstructors" PRIMARY KEY,
"ExperimentSessionId" TEXT NOT NULL,
"TeacherId" TEXT NOT NULL,
"CreatedAt" TEXT NOT NULL,
"UpdatedAt" TEXT NOT NULL,
CONSTRAINT "FK_ExperimentSessionInstructors_ExperimentSessions_ExperimentSessionId"
FOREIGN KEY ("ExperimentSessionId") REFERENCES "ExperimentSessions" ("Id") ON DELETE CASCADE,
CONSTRAINT "FK_ExperimentSessionInstructors_Teachers_TeacherId"
FOREIGN KEY ("TeacherId") REFERENCES "Teachers" ("Id") ON DELETE RESTRICT
);
""",
"CREATE UNIQUE INDEX \"IX_ExperimentSessionInstructors_ExperimentSessionId_TeacherId\" ON \"ExperimentSessionInstructors\" (\"ExperimentSessionId\", \"TeacherId\");",
"CREATE INDEX \"IX_ExperimentSessionInstructors_TeacherId\" ON \"ExperimentSessionInstructors\" (\"TeacherId\");"
];
private static readonly string[] ReusableCourseGroupsStatements =
[
"""