修复sqlite迁移
This commit is contained in:
@@ -739,9 +739,24 @@ public sealed class DevelopmentSqliteMigrator(
|
|||||||
NotificationInboxIndexesMigration,
|
NotificationInboxIndexesMigration,
|
||||||
NotificationInboxIndexesStatements,
|
NotificationInboxIndexesStatements,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
|
var experimentProjectColumns = (await db.Database.SqlQueryRaw<string>(
|
||||||
|
"SELECT name AS \"Value\" FROM pragma_table_info('ExperimentProjects')")
|
||||||
|
.ToListAsync(cancellationToken))
|
||||||
|
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||||
|
var experimentSessionInstructorsExist = await db.Database
|
||||||
|
.SqlQueryRaw<int>(
|
||||||
|
"SELECT COUNT(*) AS \"Value\" FROM sqlite_master WHERE type = 'table' AND name = 'ExperimentSessionInstructors'")
|
||||||
|
.AnyAsync(value => value > 0, cancellationToken);
|
||||||
|
var selfScheduledExperimentSelectionStatements = new List<string>();
|
||||||
|
if (!experimentProjectColumns.Contains("SelectionStartsAt"))
|
||||||
|
selfScheduledExperimentSelectionStatements.Add(SelfScheduledExperimentSelectionStatements[0]);
|
||||||
|
if (!experimentProjectColumns.Contains("SelectionEndsAt"))
|
||||||
|
selfScheduledExperimentSelectionStatements.Add(SelfScheduledExperimentSelectionStatements[1]);
|
||||||
|
if (!experimentSessionInstructorsExist)
|
||||||
|
selfScheduledExperimentSelectionStatements.AddRange(SelfScheduledExperimentSelectionStatements.Skip(2));
|
||||||
await ApplyMigrationAsync(
|
await ApplyMigrationAsync(
|
||||||
SelfScheduledExperimentSelectionMigration,
|
SelfScheduledExperimentSelectionMigration,
|
||||||
SelfScheduledExperimentSelectionStatements,
|
selfScheduledExperimentSelectionStatements,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user