From 4932175e74a82a0efb53b2a731ba7480531d0b36 Mon Sep 17 00:00:00 2001 From: cuqmbr Date: Sat, 16 Jul 2022 10:58:56 +0300 Subject: [PATCH] fix: make username property not nullable --- DatabaseModels/ScoreboardRecord.cs | 2 +- ...0220716075243_NullableUsername.Designer.cs | 40 +++++++++++++++++++ .../20220716075243_NullableUsername.cs | 19 +++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 Server/Migrations/20220716075243_NullableUsername.Designer.cs create mode 100644 Server/Migrations/20220716075243_NullableUsername.cs diff --git a/DatabaseModels/ScoreboardRecord.cs b/DatabaseModels/ScoreboardRecord.cs index e605c30..10c91ab 100644 --- a/DatabaseModels/ScoreboardRecord.cs +++ b/DatabaseModels/ScoreboardRecord.cs @@ -5,7 +5,7 @@ namespace DatabaseModels; public class ScoreboardRecord { [Key] - public string? Username { get; set; } + public string Username { get; set; } public int Score { get; set; } public DateTime PostTime { get; set; } diff --git a/Server/Migrations/20220716075243_NullableUsername.Designer.cs b/Server/Migrations/20220716075243_NullableUsername.Designer.cs new file mode 100644 index 0000000..b59a626 --- /dev/null +++ b/Server/Migrations/20220716075243_NullableUsername.Designer.cs @@ -0,0 +1,40 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Server.Data; + +#nullable disable + +namespace Server.Migrations +{ + [DbContext(typeof(ServerDbContext))] + [Migration("20220716075243_NullableUsername")] + partial class NullableUsername + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.6"); + + modelBuilder.Entity("DatabaseModels.ScoreboardRecord", b => + { + b.Property("Username") + .HasColumnType("TEXT"); + + b.Property("PostTime") + .HasColumnType("TEXT"); + + b.Property("Score") + .HasColumnType("INTEGER"); + + b.HasKey("Username"); + + b.ToTable("Scoreboard"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Server/Migrations/20220716075243_NullableUsername.cs b/Server/Migrations/20220716075243_NullableUsername.cs new file mode 100644 index 0000000..082c539 --- /dev/null +++ b/Server/Migrations/20220716075243_NullableUsername.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Server.Migrations +{ + public partial class NullableUsername : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +}