forked from SoDOff-Project/sodoff
make author viking optional for system messages
This commit is contained in:
parent
b090604bc1
commit
20452e2058
1317
src/Migrations/20250306234213_Messaging_VikingIdOptional.Designer.cs
generated
Normal file
1317
src/Migrations/20250306234213_Messaging_VikingIdOptional.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
59
src/Migrations/20250306234213_Messaging_VikingIdOptional.cs
Normal file
59
src/Migrations/20250306234213_Messaging_VikingIdOptional.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace sodoff.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Messaging_VikingIdOptional : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Messages_Vikings_VikingId",
|
||||
table: "Messages");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "VikingId",
|
||||
table: "Messages",
|
||||
type: "INTEGER",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Messages_Vikings_VikingId",
|
||||
table: "Messages",
|
||||
column: "VikingId",
|
||||
principalTable: "Vikings",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Messages_Vikings_VikingId",
|
||||
table: "Messages");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "VikingId",
|
||||
table: "Messages",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Messages_Vikings_VikingId",
|
||||
table: "Messages",
|
||||
column: "VikingId",
|
||||
principalTable: "Vikings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingsId");
|
||||
|
||||
b.ToTable("GroupViking", (string)null);
|
||||
b.ToTable("GroupViking");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.AchievementPoints", b =>
|
||||
@ -49,7 +49,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasKey("VikingId", "Type");
|
||||
|
||||
b.ToTable("AchievementPoints", (string)null);
|
||||
b.ToTable("AchievementPoints");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.AchievementTaskState", b =>
|
||||
@ -67,7 +67,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("AchievementTaskState", (string)null);
|
||||
b.ToTable("AchievementTaskState");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Buddy", b =>
|
||||
@ -103,7 +103,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Buddies", (string)null);
|
||||
b.ToTable("Buddies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Dragon", b =>
|
||||
@ -128,7 +128,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Dragons", (string)null);
|
||||
b.ToTable("Dragons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.GameData", b =>
|
||||
@ -165,7 +165,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("GameData", (string)null);
|
||||
b.ToTable("GameData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.GameDataPair", b =>
|
||||
@ -188,7 +188,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("GameDataId");
|
||||
|
||||
b.ToTable("GameDataPairs", (string)null);
|
||||
b.ToTable("GameDataPairs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Group", b =>
|
||||
@ -221,7 +221,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Groups", (string)null);
|
||||
b.ToTable("Groups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Image", b =>
|
||||
@ -245,7 +245,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Images", (string)null);
|
||||
b.ToTable("Images");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.InventoryItem", b =>
|
||||
@ -273,7 +273,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("InventoryItems", (string)null);
|
||||
b.ToTable("InventoryItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.MMORole", b =>
|
||||
@ -292,7 +292,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("MMORoles", (string)null);
|
||||
b.ToTable("MMORoles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Message", b =>
|
||||
@ -346,7 +346,7 @@ namespace sodoff.Migrations
|
||||
b.Property<int>("ToVikingId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("VikingId")
|
||||
b.Property<int?>("VikingId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
@ -357,7 +357,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Messages", (string)null);
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.MissionState", b =>
|
||||
@ -382,7 +382,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("MissionStates", (string)null);
|
||||
b.ToTable("MissionStates");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Neighborhood", b =>
|
||||
@ -414,7 +414,7 @@ namespace sodoff.Migrations
|
||||
b.HasIndex("VikingId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Neighborhoods", (string)null);
|
||||
b.ToTable("Neighborhoods");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Pair", b =>
|
||||
@ -438,7 +438,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("MasterId");
|
||||
|
||||
b.ToTable("Pairs", (string)null);
|
||||
b.ToTable("Pairs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.PairData", b =>
|
||||
@ -467,7 +467,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("PairData", (string)null);
|
||||
b.ToTable("PairData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Party", b =>
|
||||
@ -501,7 +501,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Parties", (string)null);
|
||||
b.ToTable("Parties");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.ProfileAnswer", b =>
|
||||
@ -523,7 +523,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("ProfileAnswers", (string)null);
|
||||
b.ToTable("ProfileAnswers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Rating", b =>
|
||||
@ -550,7 +550,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Ratings", (string)null);
|
||||
b.ToTable("Ratings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.RatingRank", b =>
|
||||
@ -579,7 +579,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RatingRanks", (string)null);
|
||||
b.ToTable("RatingRanks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Room", b =>
|
||||
@ -602,7 +602,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Rooms", (string)null);
|
||||
b.ToTable("Rooms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.RoomItem", b =>
|
||||
@ -622,7 +622,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("RoomId");
|
||||
|
||||
b.ToTable("RoomItems", (string)null);
|
||||
b.ToTable("RoomItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.SavedData", b =>
|
||||
@ -638,7 +638,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasKey("VikingId", "SaveId");
|
||||
|
||||
b.ToTable("SavedData", (string)null);
|
||||
b.ToTable("SavedData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.SceneData", b =>
|
||||
@ -662,7 +662,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("SceneData", (string)null);
|
||||
b.ToTable("SceneData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Session", b =>
|
||||
@ -686,7 +686,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Sessions", (string)null);
|
||||
b.ToTable("Sessions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.TaskStatus", b =>
|
||||
@ -710,7 +710,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("TaskStatuses", (string)null);
|
||||
b.ToTable("TaskStatuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.User", b =>
|
||||
@ -733,7 +733,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users", (string)null);
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b =>
|
||||
@ -752,7 +752,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("UserBadgesCompleted", (string)null);
|
||||
b.ToTable("UserBadgesCompleted");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.UserBan", b =>
|
||||
@ -777,7 +777,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("VikingId");
|
||||
|
||||
b.ToTable("Bans", (string)null);
|
||||
b.ToTable("Bans");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.UserMissionData", b =>
|
||||
@ -802,7 +802,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasKey("VikingId", "WorldId", "MissionId");
|
||||
|
||||
b.ToTable("UserMissionData", (string)null);
|
||||
b.ToTable("UserMissionData");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("sodoff.Model.Viking", b =>
|
||||
@ -848,7 +848,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Vikings", (string)null);
|
||||
b.ToTable("Vikings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GroupViking", b =>
|
||||
@ -988,9 +988,7 @@ namespace sodoff.Migrations
|
||||
|
||||
b.HasOne("sodoff.Model.Viking", "Viking")
|
||||
.WithMany("MessagesMade")
|
||||
.HasForeignKey("VikingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
.HasForeignKey("VikingId");
|
||||
|
||||
b.Navigation("ParentMessage");
|
||||
|
||||
|
@ -328,7 +328,8 @@ public class DBContext : DbContext {
|
||||
// Messages
|
||||
builder.Entity<Message>().HasOne(r => r.Viking)
|
||||
.WithMany(e => e.MessagesMade)
|
||||
.HasForeignKey(e => e.VikingId);
|
||||
.HasForeignKey(e => e.VikingId)
|
||||
.IsRequired(false); // system messages usually don't have am author
|
||||
|
||||
builder.Entity<Message>().HasOne(r => r.ToViking)
|
||||
.WithMany(e => e.MessageBoard)
|
||||
|
@ -9,8 +9,8 @@ public class Message
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int VikingId { get; set; }
|
||||
public int? ToVikingId { get; set; }
|
||||
public int? VikingId { get; set; }
|
||||
public int ToVikingId { get; set; }
|
||||
|
||||
public int QueueID { get; set; }
|
||||
public int? ConversationID { get; set; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user