Skip to content

Commit b6c7cad

Browse files
committed
gh-33 Update DB migration
Signed-off-by: Victor Chang <[email protected]>
1 parent cb74f3a commit b6c7cad

File tree

8 files changed

+27
-8
lines changed

8 files changed

+27
-8
lines changed

src/CLI/Commands/AetCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,12 @@ private async Task<int> AddAeTitlehandlerAsync(MonaiApplicationEntity entity, IH
219219
if (result.IgnoredSopClasses.Any())
220220
{
221221
logger.MonaiAeIgnoredSops(string.Join(',', result.IgnoredSopClasses));
222-
logger.IgnoreSopClassesWarning();
222+
logger.IgnoredSopClassesWarning();
223223
}
224224
if (result.AllowedSopClasses.Any())
225225
{
226226
logger.MonaiAeAllowedSops(string.Join(',', result.AllowedSopClasses));
227-
logger.IgnoreSopClassesWarning();
227+
logger.AcceptedSopClassesWarning();
228228
}
229229
}
230230
catch (ConfigurationException ex)

src/CLI/Logging/Log.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static partial class Log
3434
public static partial void MonaiAeIgnoredSops(this ILogger logger, string ignoredSopClasses);
3535

3636
[LoggerMessage(EventId = 30014, Level = LogLevel.Warning, Message = "Instances with matching SOP class UIDs are accepted but dropped.")]
37-
public static partial void IgnoreSopClassesWarning(this ILogger logger);
37+
public static partial void IgnoredSopClassesWarning(this ILogger logger);
3838

3939
[LoggerMessage(EventId = 30015, Level = LogLevel.Critical, Message = "Error creating MONAI SCP AE Title {aeTitle}: {message}.")]
4040
public static partial void MonaiAeCreateCritical(this ILogger logger, string aeTitle, string message);
@@ -144,6 +144,9 @@ public static partial class Log
144144
[LoggerMessage(EventId = 30051, Level = LogLevel.Warning, Message = "Instances without matching SOP class UIDs are accepted but dropped.")]
145145
public static partial void AllowedSopClassesWarning(this ILogger logger);
146146

147+
[LoggerMessage(EventId = 30052, Level = LogLevel.Warning, Message = "Only instances with matching SOP class UIDs are accepted and stored.")]
148+
public static partial void AcceptedSopClassesWarning(this ILogger logger);
149+
147150
// Docker Runner
148151
[LoggerMessage(EventId = 31000, Level = LogLevel.Debug, Message = "Checking for existing {applicationName} ({version}) containers...")]
149152
public static partial void CheckingExistingAppContainer(this ILogger logger, string applicationName, string version);

src/CLI/Monai.Deploy.InformaticsGateway.CLI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SPDX-License-Identifier: Apache License 2.0
1212
<SelfContained>true</SelfContained>
1313
<PublishTrimmed>false</PublishTrimmed>
1414
<PublishReadyToRun>true</PublishReadyToRun>
15-
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
15+
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
1616
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
1717
<AssemblyName>mig-cli</AssemblyName>
1818
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>

src/Database/Migrations/20220322185946_R2_0.2.0.Designer.cs renamed to src/Database/Migrations/20220613235333_R2_0.2.0.Designer.cs

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Database/Migrations/20220322185946_R2_0.2.0.cs renamed to src/Database/Migrations/20220613235333_R2_0.2.0.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,20 @@ protected override void Up(MigrationBuilder migrationBuilder)
2525
oldClrType: typeof(string),
2626
oldType: "TEXT",
2727
oldNullable: true);
28+
29+
migrationBuilder.AddColumn<string>(
30+
name: "AllowedSopClasses",
31+
table: "MonaiApplicationEntities",
32+
type: "TEXT",
33+
nullable: true);
2834
}
2935

3036
protected override void Down(MigrationBuilder migrationBuilder)
3137
{
38+
migrationBuilder.DropColumn(
39+
name: "AllowedSopClasses",
40+
table: "MonaiApplicationEntities");
41+
3242
migrationBuilder.AlterColumn<string>(
3343
name: "CorrelationId",
3444
table: "Payload",

src/Database/Migrations/InformaticsGatewayContextModelSnapshot.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
4848
.IsRequired()
4949
.HasColumnType("TEXT");
5050

51+
b.Property<string>("AllowedSopClasses")
52+
.HasColumnType("TEXT");
53+
5154
b.Property<string>("Grouping")
5255
.IsRequired()
5356
.HasColumnType("TEXT");

src/InformaticsGateway/Services/Http/MonaiAeTitleController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: © 2021-2022 MONAI Consortium
1+
// SPDX-FileCopyrightText: 2021-2022 MONAI Consortium
22
// SPDX-License-Identifier: Apache License 2.0
33

44
using System;
@@ -153,7 +153,7 @@ private void Validate(MonaiApplicationEntity item)
153153
}
154154
if (item.IgnoredSopClasses.Any() && item.AllowedSopClasses.Any())
155155
{
156-
throw new ConfigurationException($"Cannot specify both allowed ignored SOP classes at the same time, they are mutually exclusive.");
156+
throw new ConfigurationException($"Cannot specify both allowed and ignored SOP classes at the same time, they are mutually exclusive.");
157157
}
158158
if (!item.IsValid(out var validationErrors))
159159
{

src/InformaticsGateway/Test/Services/Http/MonaiAeTitleControllerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public async Task Create_ShallReturnBadRequestWhenBothAllowedAndIgnoredSopsAreDe
233233
var problem = objectResult.Value as ProblemDetails;
234234
Assert.NotNull(problem);
235235
Assert.Equal("Validation error.", problem.Title);
236-
Assert.Equal("Cannot specify both allowed ignored SOP classes at the same time, they are mutually exclusive.", problem.Detail);
236+
Assert.Equal("Cannot specify both allowed and ignored SOP classes at the same time, they are mutually exclusive.", problem.Detail);
237237
Assert.Equal((int)HttpStatusCode.BadRequest, problem.Status);
238238
}
239239

0 commit comments

Comments
 (0)