Skip to content

Commit

Permalink
#54: remove nullable from props of ValidationPackage model
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Jun 25, 2024
1 parent f88f808 commit 2392649
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PackageRegistryService.Migrations
{
/// <inheritdoc />
public partial class NoNullableFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ReleaseNotes",
table: "ValidationPackages",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);

migrationBuilder.AlterColumn<string>(
name: "CQCHookEndpoint",
table: "ValidationPackages",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ReleaseNotes",
table: "ValidationPackages",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");

migrationBuilder.AlterColumn<string>(
name: "CQCHookEndpoint",
table: "ValidationPackages",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("text");
b.Property<string>("CQCHookEndpoint")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Description")
Expand All @@ -114,6 +115,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("date");
b.Property<string>("ReleaseNotes")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Summary")
Expand Down
8 changes: 4 additions & 4 deletions src/PackageRegistryService/Models/ValidationPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ public class ValidationPackage
/// <summary>
///
/// </summary>
public ICollection<AVPRIndex.Domain.OntologyAnnotation>? Tags { get; set; }
public ICollection<AVPRIndex.Domain.OntologyAnnotation> Tags { get; set; } = Array.Empty<AVPRIndex.Domain.OntologyAnnotation>();

/// <summary>
///
/// </summary>
public string? ReleaseNotes { get; set; }
public string ReleaseNotes { get; set; } = "";

/// <summary>
///
/// </summary>
public string? CQCHookEndpoint { get; set; }
public string CQCHookEndpoint { get; set; } = "";

/// <summary>
///
/// </summary>
public ICollection<AVPRIndex.Domain.Author>? Authors { get; set; } // https://www.learnentityframeworkcore.com/relationships#navigation-properties
public ICollection<AVPRIndex.Domain.Author> Authors { get; set; } = Array.Empty<AVPRIndex.Domain.Author>();// https://www.learnentityframeworkcore.com/relationships#navigation-properties

/// <summary>
///
Expand Down

0 comments on commit 2392649

Please sign in to comment.