From e9995f08768601fc82ef51ccb50d57e53b374d8d Mon Sep 17 00:00:00 2001 From: AlanMoonbase Date: Wed, 19 Mar 2025 11:48:47 -0700 Subject: [PATCH] restructure ef core migrations -added different context for production environments -added migrations for both dev and production databases -added config values ``ProdDbProvider`` and ``ProdDbConnection`` (since most likely production environment will use PGSQL or MySQL, although PGSQL migrations are not provided but can be made) --- src/Configuration/ApiServerConfig.cs | 2 + .../20250319184324_InitialCreate.Designer.cs | 1329 ++++++++++++++++ .../20250319184324_InitialCreate.cs | 1023 +++++++++++++ .../DevMigrations/DBContextModelSnapshot.cs | 1326 ++++++++++++++++ .../20250319184417_InitialCreate.Designer.cs | 1330 +++++++++++++++++ .../20250319184417_InitialCreate.cs | 1058 +++++++++++++ .../ProductionDBContextModelSnapshot.cs | 1327 ++++++++++++++++ src/Model/ProductionDBContext.cs | 34 + src/Program.cs | 10 +- src/appsettings.json | 48 +- src/sodoff.csproj | 2 + 11 files changed, 7463 insertions(+), 26 deletions(-) create mode 100644 src/Migrations/DevMigrations/20250319184324_InitialCreate.Designer.cs create mode 100644 src/Migrations/DevMigrations/20250319184324_InitialCreate.cs create mode 100644 src/Migrations/DevMigrations/DBContextModelSnapshot.cs create mode 100644 src/Migrations/ProductionMigrations/20250319184417_InitialCreate.Designer.cs create mode 100644 src/Migrations/ProductionMigrations/20250319184417_InitialCreate.cs create mode 100644 src/Migrations/ProductionMigrations/ProductionDBContextModelSnapshot.cs create mode 100644 src/Model/ProductionDBContext.cs diff --git a/src/Configuration/ApiServerConfig.cs b/src/Configuration/ApiServerConfig.cs index 958c3e8..308e497 100644 --- a/src/Configuration/ApiServerConfig.cs +++ b/src/Configuration/ApiServerConfig.cs @@ -9,8 +9,10 @@ public class ApiServerConfig { public bool LoadNonSoDData { get; set; } = false; public DbProviders DbProvider { get; set; } = DbProviders.SQLite; + public DbProviders ProdDbProvider { get; set; } = DbProviders.MySQL; public string DbPath { get; set; } = string.Empty; public string DbConnection { get; set; } = string.Empty; + public string ProdDbConnection { get; set; } = string.Empty; } public enum DbProviders { diff --git a/src/Migrations/DevMigrations/20250319184324_InitialCreate.Designer.cs b/src/Migrations/DevMigrations/20250319184324_InitialCreate.Designer.cs new file mode 100644 index 0000000..c58a1e6 --- /dev/null +++ b/src/Migrations/DevMigrations/20250319184324_InitialCreate.Designer.cs @@ -0,0 +1,1329 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using sodoff.Model; + +#nullable disable + +namespace sodoff.Migrations.SqliteMigrations +{ + [DbContext(typeof(DBContext))] + [Migration("20250319184324_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true); + + modelBuilder.Entity("GroupViking", b => + { + b.Property("GroupsId") + .HasColumnType("INTEGER"); + + b.Property("VikingsId") + .HasColumnType("INTEGER"); + + b.HasKey("GroupsId", "VikingsId"); + + b.HasIndex("VikingsId"); + + b.ToTable("GroupViking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("INTEGER"); + + b.HasKey("VikingId", "Type"); + + b.ToTable("AchievementPoints"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.Property("TaskId") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("Points") + .HasColumnType("INTEGER"); + + b.HasKey("TaskId", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("AchievementTaskState"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BuddyStatus1") + .HasColumnType("INTEGER"); + + b.Property("BuddyStatus2") + .HasColumnType("INTEGER"); + + b.Property("BuddyVikingId") + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("IsBestFriend1") + .HasColumnType("INTEGER"); + + b.Property("IsBestFriend2") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("BuddyVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Buddies"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("PetXP") + .HasColumnType("INTEGER"); + + b.Property("RaisedPetData") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Dragons"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatePlayed") + .HasColumnType("TEXT"); + + b.Property("Difficulty") + .HasColumnType("INTEGER"); + + b.Property("GameId") + .HasColumnType("INTEGER"); + + b.Property("GameLevel") + .HasColumnType("INTEGER"); + + b.Property("IsMultiplayer") + .HasColumnType("INTEGER"); + + b.Property("Loss") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("Win") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameDataId") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("GameDataId"); + + b.ToTable("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ApiKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GroupID") + .HasColumnType("TEXT"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.Property("ImageType") + .HasColumnType("TEXT"); + + b.Property("ImageSlot") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("ImageData") + .HasColumnType("TEXT"); + + b.Property("TemplateName") + .HasColumnType("TEXT"); + + b.HasKey("ImageType", "ImageSlot", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Images"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AttributesSerialized") + .HasColumnType("TEXT"); + + b.Property("ItemId") + .HasColumnType("INTEGER"); + + b.Property("Quantity") + .HasColumnType("INTEGER"); + + b.Property("StatsSerialized") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("InventoryItems"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Role") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MMORoles"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ConversationID") + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsNew") + .HasColumnType("INTEGER"); + + b.Property("IsPrivate") + .HasColumnType("INTEGER"); + + b.Property("LastUpdatedAt") + .HasColumnType("TEXT"); + + b.Property("MemberMessage") + .HasColumnType("TEXT"); + + b.Property("MessageLevel") + .HasColumnType("INTEGER"); + + b.Property("MessageType") + .HasColumnType("INTEGER"); + + b.Property("MessageTypeID") + .HasColumnType("INTEGER"); + + b.Property("NonMemberMessage") + .HasColumnType("TEXT"); + + b.Property("ParentMessageId") + .HasColumnType("INTEGER"); + + b.Property("QueueID") + .HasColumnType("INTEGER"); + + b.Property("ToVikingId") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ParentMessageId"); + + b.HasIndex("ToVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Messages"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("MissionId") + .HasColumnType("INTEGER"); + + b.Property("MissionStatus") + .HasColumnType("INTEGER"); + + b.Property("UserAccepted") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MissionStates"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Slot0") + .HasColumnType("TEXT"); + + b.Property("Slot1") + .HasColumnType("TEXT"); + + b.Property("Slot2") + .HasColumnType("TEXT"); + + b.Property("Slot3") + .HasColumnType("TEXT"); + + b.Property("Slot4") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId") + .IsUnique(); + + b.ToTable("Neighborhoods"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Key") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("MasterId") + .HasColumnType("INTEGER"); + + b.Property("Value") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("MasterId"); + + b.ToTable("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DragonId") + .HasColumnType("INTEGER"); + + b.Property("PairId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("DragonId"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AssetBundle") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ExpirationDate") + .HasColumnType("TEXT"); + + b.Property("Location") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LocationIconAsset") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrivateParty") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Parties"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AnswerID") + .HasColumnType("INTEGER"); + + b.Property("QuestionID") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("ProfileAnswers"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("RankId") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("RankId"); + + b.HasIndex("VikingId"); + + b.ToTable("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CategoryID") + .HasColumnType("INTEGER"); + + b.Property("Rank") + .HasColumnType("INTEGER"); + + b.Property("RatedEntityID") + .HasColumnType("INTEGER"); + + b.Property("RatedUserID") + .HasColumnType("TEXT"); + + b.Property("RatingAverage") + .HasColumnType("REAL"); + + b.Property("UpdateDate") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("RatingRanks"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("RoomId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Rooms"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RoomId") + .HasColumnType("INTEGER"); + + b.Property("RoomItemData") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("RoomItems"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("SaveId") + .HasColumnType("INTEGER"); + + b.Property("SerializedData") + .HasColumnType("TEXT"); + + b.HasKey("VikingId", "SaveId"); + + b.ToTable("SavedData"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("SceneName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("XmlData") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("SceneData"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.Property("ApiToken") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("ApiToken"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.Property("Id") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("MissionId") + .HasColumnType("INTEGER"); + + b.Property("Completed") + .HasColumnType("INTEGER"); + + b.Property("Payload") + .HasColumnType("TEXT"); + + b.HasKey("Id", "VikingId", "MissionId"); + + b.HasIndex("VikingId"); + + b.ToTable("TaskStatuses"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BadgeId") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("UserBadgesCompleted"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("UserBanType") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("WorldId") + .HasColumnType("INTEGER"); + + b.Property("MissionId") + .HasColumnType("INTEGER"); + + b.Property("IsCompleted") + .HasColumnType("INTEGER"); + + b.Property("StepId") + .HasColumnType("INTEGER"); + + b.Property("TaskId") + .HasColumnType("INTEGER"); + + b.HasKey("VikingId", "WorldId", "MissionId"); + + b.ToTable("UserMissionData"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AvatarSerialized") + .HasColumnType("TEXT"); + + b.Property("BirthDate") + .HasColumnType("TEXT"); + + b.Property("BuddyCode") + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("CurrentRoomId") + .HasColumnType("INTEGER"); + + b.Property("CurrentZone") + .HasColumnType("TEXT"); + + b.Property("GameVersion") + .HasColumnType("INTEGER"); + + b.Property("Gender") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Online") + .HasColumnType("INTEGER"); + + b.Property("SelectedDragonId") + .HasColumnType("INTEGER"); + + b.Property("Uid") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("SelectedDragonId") + .IsUnique(); + + b.HasIndex("Uid"); + + b.HasIndex("UserId"); + + b.ToTable("Vikings"); + }); + + modelBuilder.Entity("GroupViking", b => + { + b.HasOne("sodoff.Model.Group", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", null) + .WithMany() + .HasForeignKey("VikingsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementPoints") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementTaskStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.HasOne("sodoff.Model.Viking", "BuddyViking") + .WithMany("BuddyList") + .HasForeignKey("BuddyVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("BuddiesMade") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BuddyViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Dragons") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("GameData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.HasOne("sodoff.Model.GameData", "GameData") + .WithMany("GameDataPairs") + .HasForeignKey("GameDataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Images") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("InventoryItems") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MMORoles") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.HasOne("sodoff.Model.Message", "ParentMessage") + .WithMany("Replies") + .HasForeignKey("ParentMessageId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "ToViking") + .WithMany("MessageBoard") + .HasForeignKey("ToVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MessagesMade") + .HasForeignKey("VikingId"); + + b.Navigation("ParentMessage"); + + b.Navigation("ToViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MissionStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithOne("Neighborhood") + .HasForeignKey("sodoff.Model.Neighborhood", "VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.HasOne("sodoff.Model.PairData", "PairData") + .WithMany("Pairs") + .HasForeignKey("MasterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.HasOne("sodoff.Model.Dragon", "Dragon") + .WithMany("PairData") + .HasForeignKey("DragonId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("PairData") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("PairData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Dragon"); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Parties") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("ProfileAnswers") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.HasOne("sodoff.Model.RatingRank", "Rank") + .WithMany("Ratings") + .HasForeignKey("RankId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Ratings") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rank"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Rooms") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.HasOne("sodoff.Model.Room", "Room") + .WithMany("Items") + .HasForeignKey("RoomId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Room"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SavedData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SceneData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.HasOne("sodoff.Model.User", "User") + .WithMany("Sessions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Sessions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("TaskStatuses") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBadgesCompleted") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBans") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserMissions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.HasOne("sodoff.Model.Dragon", "SelectedDragon") + .WithOne() + .HasForeignKey("sodoff.Model.Viking", "SelectedDragonId"); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("Vikings") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SelectedDragon"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Navigation("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Navigation("Replies"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Navigation("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Navigation("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Navigation("PairData"); + + b.Navigation("Sessions"); + + b.Navigation("Vikings"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Navigation("AchievementPoints"); + + b.Navigation("AchievementTaskStates"); + + b.Navigation("BuddiesMade"); + + b.Navigation("BuddyList"); + + b.Navigation("Dragons"); + + b.Navigation("GameData"); + + b.Navigation("Images"); + + b.Navigation("InventoryItems"); + + b.Navigation("MMORoles"); + + b.Navigation("MessageBoard"); + + b.Navigation("MessagesMade"); + + b.Navigation("MissionStates"); + + b.Navigation("Neighborhood"); + + b.Navigation("PairData"); + + b.Navigation("Parties"); + + b.Navigation("ProfileAnswers"); + + b.Navigation("Ratings"); + + b.Navigation("Rooms"); + + b.Navigation("SavedData"); + + b.Navigation("SceneData"); + + b.Navigation("Sessions"); + + b.Navigation("TaskStatuses"); + + b.Navigation("UserBadgesCompleted"); + + b.Navigation("UserBans"); + + b.Navigation("UserMissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Migrations/DevMigrations/20250319184324_InitialCreate.cs b/src/Migrations/DevMigrations/20250319184324_InitialCreate.cs new file mode 100644 index 0000000..4a9e145 --- /dev/null +++ b/src/Migrations/DevMigrations/20250319184324_InitialCreate.cs @@ -0,0 +1,1023 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace sodoff.Migrations.SqliteMigrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Groups", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GroupID = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + Color = table.Column(type: "TEXT", nullable: false), + Logo = table.Column(type: "TEXT", nullable: false), + ApiKey = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Groups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "RatingRanks", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CategoryID = table.Column(type: "INTEGER", nullable: false), + RatedEntityID = table.Column(type: "INTEGER", nullable: true), + RatedUserID = table.Column(type: "TEXT", nullable: true), + Rank = table.Column(type: "INTEGER", nullable: false), + RatingAverage = table.Column(type: "REAL", nullable: false), + UpdateDate = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RatingRanks", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Email = table.Column(type: "TEXT", nullable: false), + Username = table.Column(type: "TEXT", nullable: false), + Password = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AchievementPoints", + columns: table => new + { + VikingId = table.Column(type: "INTEGER", nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + Value = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AchievementPoints", x => new { x.VikingId, x.Type }); + }); + + migrationBuilder.CreateTable( + name: "AchievementTaskState", + columns: table => new + { + VikingId = table.Column(type: "INTEGER", nullable: false), + TaskId = table.Column(type: "INTEGER", nullable: false), + Points = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AchievementTaskState", x => new { x.TaskId, x.VikingId }); + }); + + migrationBuilder.CreateTable( + name: "Bans", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + UserBanType = table.Column(type: "INTEGER", nullable: false), + CreatedAt = table.Column(type: "TEXT", nullable: false), + ExpiresOn = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Bans", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Buddies", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + BuddyVikingId = table.Column(type: "INTEGER", nullable: false), + BuddyStatus1 = table.Column(type: "INTEGER", nullable: false), + BuddyStatus2 = table.Column(type: "INTEGER", nullable: false), + IsBestFriend1 = table.Column(type: "INTEGER", nullable: false), + IsBestFriend2 = table.Column(type: "INTEGER", nullable: false), + CreatedAt = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Buddies", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Dragons", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + EntityId = table.Column(type: "TEXT", nullable: false), + VikingId = table.Column(type: "INTEGER", nullable: false), + RaisedPetData = table.Column(type: "TEXT", nullable: true), + PetXP = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Dragons", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Vikings", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Uid = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + UserId = table.Column(type: "TEXT", nullable: false), + AvatarSerialized = table.Column(type: "TEXT", nullable: true), + BuddyCode = table.Column(type: "TEXT", nullable: true), + SelectedDragonId = table.Column(type: "INTEGER", nullable: true), + Online = table.Column(type: "INTEGER", nullable: true), + CurrentRoomId = table.Column(type: "INTEGER", nullable: true), + CurrentZone = table.Column(type: "TEXT", nullable: true), + CreationDate = table.Column(type: "TEXT", nullable: true), + BirthDate = table.Column(type: "TEXT", nullable: true), + Gender = table.Column(type: "INTEGER", nullable: true), + GameVersion = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Vikings", x => x.Id); + table.ForeignKey( + name: "FK_Vikings_Dragons_SelectedDragonId", + column: x => x.SelectedDragonId, + principalTable: "Dragons", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Vikings_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GameData", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + GameId = table.Column(type: "INTEGER", nullable: false), + Difficulty = table.Column(type: "INTEGER", nullable: false), + GameLevel = table.Column(type: "INTEGER", nullable: false), + DatePlayed = table.Column(type: "TEXT", nullable: false), + IsMultiplayer = table.Column(type: "INTEGER", nullable: false), + Win = table.Column(type: "INTEGER", nullable: false), + Loss = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameData", x => x.Id); + table.ForeignKey( + name: "FK_GameData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GroupViking", + columns: table => new + { + GroupsId = table.Column(type: "INTEGER", nullable: false), + VikingsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GroupViking", x => new { x.GroupsId, x.VikingsId }); + table.ForeignKey( + name: "FK_GroupViking_Groups_GroupsId", + column: x => x.GroupsId, + principalTable: "Groups", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GroupViking_Vikings_VikingsId", + column: x => x.VikingsId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Images", + columns: table => new + { + ImageType = table.Column(type: "TEXT", nullable: false), + ImageSlot = table.Column(type: "INTEGER", nullable: false), + VikingId = table.Column(type: "INTEGER", nullable: false), + ImageData = table.Column(type: "TEXT", nullable: true), + TemplateName = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Images", x => new { x.ImageType, x.ImageSlot, x.VikingId }); + table.ForeignKey( + name: "FK_Images_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "InventoryItems", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ItemId = table.Column(type: "INTEGER", nullable: false), + VikingId = table.Column(type: "INTEGER", nullable: false), + StatsSerialized = table.Column(type: "TEXT", nullable: true), + AttributesSerialized = table.Column(type: "TEXT", nullable: true), + Quantity = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_InventoryItems", x => x.Id); + table.ForeignKey( + name: "FK_InventoryItems_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Messages", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: true), + ToVikingId = table.Column(type: "INTEGER", nullable: false), + QueueID = table.Column(type: "INTEGER", nullable: false), + ConversationID = table.Column(type: "INTEGER", nullable: true), + ParentMessageId = table.Column(type: "INTEGER", nullable: true), + MessageType = table.Column(type: "INTEGER", nullable: true), + MessageTypeID = table.Column(type: "INTEGER", nullable: true), + MessageLevel = table.Column(type: "INTEGER", nullable: false), + Data = table.Column(type: "TEXT", nullable: true), + MemberMessage = table.Column(type: "TEXT", nullable: true), + NonMemberMessage = table.Column(type: "TEXT", nullable: true), + CreatedAt = table.Column(type: "TEXT", nullable: false), + LastUpdatedAt = table.Column(type: "TEXT", nullable: true), + IsDeleted = table.Column(type: "INTEGER", nullable: false), + IsNew = table.Column(type: "INTEGER", nullable: false), + IsPrivate = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Messages", x => x.Id); + table.ForeignKey( + name: "FK_Messages_Messages_ParentMessageId", + column: x => x.ParentMessageId, + principalTable: "Messages", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Messages_Vikings_ToVikingId", + column: x => x.ToVikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Messages_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "MissionStates", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + MissionId = table.Column(type: "INTEGER", nullable: false), + VikingId = table.Column(type: "INTEGER", nullable: false), + MissionStatus = table.Column(type: "INTEGER", nullable: false), + UserAccepted = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_MissionStates", x => x.Id); + table.ForeignKey( + name: "FK_MissionStates_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "MMORoles", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + Role = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MMORoles", x => x.Id); + table.ForeignKey( + name: "FK_MMORoles_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Neighborhoods", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + Slot0 = table.Column(type: "TEXT", nullable: false), + Slot1 = table.Column(type: "TEXT", nullable: false), + Slot2 = table.Column(type: "TEXT", nullable: false), + Slot3 = table.Column(type: "TEXT", nullable: false), + Slot4 = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Neighborhoods", x => x.Id); + table.ForeignKey( + name: "FK_Neighborhoods_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PairData", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + PairId = table.Column(type: "INTEGER", nullable: false), + UserId = table.Column(type: "TEXT", nullable: true), + VikingId = table.Column(type: "INTEGER", nullable: true), + DragonId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PairData", x => x.Id); + table.ForeignKey( + name: "FK_PairData_Dragons_DragonId", + column: x => x.DragonId, + principalTable: "Dragons", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PairData_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PairData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Parties", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Location = table.Column(type: "TEXT", nullable: false), + VikingId = table.Column(type: "INTEGER", nullable: false), + ExpirationDate = table.Column(type: "TEXT", nullable: false), + PrivateParty = table.Column(type: "INTEGER", nullable: true), + LocationIconAsset = table.Column(type: "TEXT", nullable: false), + AssetBundle = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Parties", x => x.Id); + table.ForeignKey( + name: "FK_Parties_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProfileAnswers", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + QuestionID = table.Column(type: "INTEGER", nullable: false), + AnswerID = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProfileAnswers", x => x.Id); + table.ForeignKey( + name: "FK_ProfileAnswers_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Ratings", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + RankId = table.Column(type: "INTEGER", nullable: false), + Value = table.Column(type: "INTEGER", nullable: false), + Date = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Ratings", x => x.Id); + table.ForeignKey( + name: "FK_Ratings_RatingRanks_RankId", + column: x => x.RankId, + principalTable: "RatingRanks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Ratings_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Rooms", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoomId = table.Column(type: "TEXT", nullable: false), + VikingId = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Rooms", x => x.Id); + table.ForeignKey( + name: "FK_Rooms_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SavedData", + columns: table => new + { + VikingId = table.Column(type: "INTEGER", nullable: false), + SaveId = table.Column(type: "INTEGER", nullable: false), + SerializedData = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SavedData", x => new { x.VikingId, x.SaveId }); + table.ForeignKey( + name: "FK_SavedData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SceneData", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + SceneName = table.Column(type: "TEXT", nullable: false), + XmlData = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SceneData", x => x.Id); + table.ForeignKey( + name: "FK_SceneData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Sessions", + columns: table => new + { + ApiToken = table.Column(type: "TEXT", nullable: false), + UserId = table.Column(type: "TEXT", nullable: true), + VikingId = table.Column(type: "INTEGER", nullable: true), + CreatedAt = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Sessions", x => x.ApiToken); + table.ForeignKey( + name: "FK_Sessions_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Sessions_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TaskStatuses", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false), + MissionId = table.Column(type: "INTEGER", nullable: false), + VikingId = table.Column(type: "INTEGER", nullable: false), + Payload = table.Column(type: "TEXT", nullable: true), + Completed = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskStatuses", x => new { x.Id, x.VikingId, x.MissionId }); + table.ForeignKey( + name: "FK_TaskStatuses_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "UserBadgesCompleted", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + VikingId = table.Column(type: "INTEGER", nullable: false), + BadgeId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserBadgesCompleted", x => x.Id); + table.ForeignKey( + name: "FK_UserBadgesCompleted_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "UserMissionData", + columns: table => new + { + VikingId = table.Column(type: "INTEGER", nullable: false), + WorldId = table.Column(type: "INTEGER", nullable: false), + MissionId = table.Column(type: "INTEGER", nullable: false), + StepId = table.Column(type: "INTEGER", nullable: false), + TaskId = table.Column(type: "INTEGER", nullable: false), + IsCompleted = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserMissionData", x => new { x.VikingId, x.WorldId, x.MissionId }); + table.ForeignKey( + name: "FK_UserMissionData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "GameDataPairs", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GameDataId = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameDataPairs", x => x.Id); + table.ForeignKey( + name: "FK_GameDataPairs_GameData_GameDataId", + column: x => x.GameDataId, + principalTable: "GameData", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Pairs", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Key = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: false), + MasterId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Pairs", x => x.Id); + table.ForeignKey( + name: "FK_Pairs_PairData_MasterId", + column: x => x.MasterId, + principalTable: "PairData", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "RoomItems", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoomId = table.Column(type: "INTEGER", nullable: false), + RoomItemData = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RoomItems", x => x.Id); + table.ForeignKey( + name: "FK_RoomItems_Rooms_RoomId", + column: x => x.RoomId, + principalTable: "Rooms", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AchievementTaskState_VikingId", + table: "AchievementTaskState", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Bans_VikingId", + table: "Bans", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Buddies_BuddyVikingId", + table: "Buddies", + column: "BuddyVikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Buddies_VikingId", + table: "Buddies", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Dragons_VikingId", + table: "Dragons", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_GameData_VikingId", + table: "GameData", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_GameDataPairs_GameDataId", + table: "GameDataPairs", + column: "GameDataId"); + + migrationBuilder.CreateIndex( + name: "IX_GroupViking_VikingsId", + table: "GroupViking", + column: "VikingsId"); + + migrationBuilder.CreateIndex( + name: "IX_Images_VikingId", + table: "Images", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_InventoryItems_VikingId", + table: "InventoryItems", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Messages_ParentMessageId", + table: "Messages", + column: "ParentMessageId"); + + migrationBuilder.CreateIndex( + name: "IX_Messages_ToVikingId", + table: "Messages", + column: "ToVikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Messages_VikingId", + table: "Messages", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_MissionStates_VikingId", + table: "MissionStates", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_MMORoles_VikingId", + table: "MMORoles", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Neighborhoods_VikingId", + table: "Neighborhoods", + column: "VikingId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_PairData_DragonId", + table: "PairData", + column: "DragonId"); + + migrationBuilder.CreateIndex( + name: "IX_PairData_UserId", + table: "PairData", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_PairData_VikingId", + table: "PairData", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Pairs_MasterId", + table: "Pairs", + column: "MasterId"); + + migrationBuilder.CreateIndex( + name: "IX_Parties_VikingId", + table: "Parties", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_ProfileAnswers_VikingId", + table: "ProfileAnswers", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Ratings_RankId", + table: "Ratings", + column: "RankId"); + + migrationBuilder.CreateIndex( + name: "IX_Ratings_VikingId", + table: "Ratings", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_RoomItems_RoomId", + table: "RoomItems", + column: "RoomId"); + + migrationBuilder.CreateIndex( + name: "IX_Rooms_VikingId", + table: "Rooms", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_SceneData_VikingId", + table: "SceneData", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Sessions_UserId", + table: "Sessions", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Sessions_VikingId", + table: "Sessions", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskStatuses_VikingId", + table: "TaskStatuses", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_UserBadgesCompleted_VikingId", + table: "UserBadgesCompleted", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Vikings_SelectedDragonId", + table: "Vikings", + column: "SelectedDragonId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Vikings_Uid", + table: "Vikings", + column: "Uid"); + + migrationBuilder.CreateIndex( + name: "IX_Vikings_UserId", + table: "Vikings", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_AchievementPoints_Vikings_VikingId", + table: "AchievementPoints", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AchievementTaskState_Vikings_VikingId", + table: "AchievementTaskState", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Bans_Vikings_VikingId", + table: "Bans", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Buddies_Vikings_BuddyVikingId", + table: "Buddies", + column: "BuddyVikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Buddies_Vikings_VikingId", + table: "Buddies", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Dragons_Vikings_VikingId", + table: "Dragons", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Dragons_Vikings_VikingId", + table: "Dragons"); + + migrationBuilder.DropTable( + name: "AchievementPoints"); + + migrationBuilder.DropTable( + name: "AchievementTaskState"); + + migrationBuilder.DropTable( + name: "Bans"); + + migrationBuilder.DropTable( + name: "Buddies"); + + migrationBuilder.DropTable( + name: "GameDataPairs"); + + migrationBuilder.DropTable( + name: "GroupViking"); + + migrationBuilder.DropTable( + name: "Images"); + + migrationBuilder.DropTable( + name: "InventoryItems"); + + migrationBuilder.DropTable( + name: "Messages"); + + migrationBuilder.DropTable( + name: "MissionStates"); + + migrationBuilder.DropTable( + name: "MMORoles"); + + migrationBuilder.DropTable( + name: "Neighborhoods"); + + migrationBuilder.DropTable( + name: "Pairs"); + + migrationBuilder.DropTable( + name: "Parties"); + + migrationBuilder.DropTable( + name: "ProfileAnswers"); + + migrationBuilder.DropTable( + name: "Ratings"); + + migrationBuilder.DropTable( + name: "RoomItems"); + + migrationBuilder.DropTable( + name: "SavedData"); + + migrationBuilder.DropTable( + name: "SceneData"); + + migrationBuilder.DropTable( + name: "Sessions"); + + migrationBuilder.DropTable( + name: "TaskStatuses"); + + migrationBuilder.DropTable( + name: "UserBadgesCompleted"); + + migrationBuilder.DropTable( + name: "UserMissionData"); + + migrationBuilder.DropTable( + name: "GameData"); + + migrationBuilder.DropTable( + name: "Groups"); + + migrationBuilder.DropTable( + name: "PairData"); + + migrationBuilder.DropTable( + name: "RatingRanks"); + + migrationBuilder.DropTable( + name: "Rooms"); + + migrationBuilder.DropTable( + name: "Vikings"); + + migrationBuilder.DropTable( + name: "Dragons"); + + migrationBuilder.DropTable( + name: "Users"); + } + } +} diff --git a/src/Migrations/DevMigrations/DBContextModelSnapshot.cs b/src/Migrations/DevMigrations/DBContextModelSnapshot.cs new file mode 100644 index 0000000..e64a6be --- /dev/null +++ b/src/Migrations/DevMigrations/DBContextModelSnapshot.cs @@ -0,0 +1,1326 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using sodoff.Model; + +#nullable disable + +namespace sodoff.Migrations.SqliteMigrations +{ + [DbContext(typeof(DBContext))] + partial class DBContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true); + + modelBuilder.Entity("GroupViking", b => + { + b.Property("GroupsId") + .HasColumnType("INTEGER"); + + b.Property("VikingsId") + .HasColumnType("INTEGER"); + + b.HasKey("GroupsId", "VikingsId"); + + b.HasIndex("VikingsId"); + + b.ToTable("GroupViking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("INTEGER"); + + b.HasKey("VikingId", "Type"); + + b.ToTable("AchievementPoints"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.Property("TaskId") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("Points") + .HasColumnType("INTEGER"); + + b.HasKey("TaskId", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("AchievementTaskState"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BuddyStatus1") + .HasColumnType("INTEGER"); + + b.Property("BuddyStatus2") + .HasColumnType("INTEGER"); + + b.Property("BuddyVikingId") + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("IsBestFriend1") + .HasColumnType("INTEGER"); + + b.Property("IsBestFriend2") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("BuddyVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Buddies"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EntityId") + .HasColumnType("TEXT"); + + b.Property("PetXP") + .HasColumnType("INTEGER"); + + b.Property("RaisedPetData") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Dragons"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatePlayed") + .HasColumnType("TEXT"); + + b.Property("Difficulty") + .HasColumnType("INTEGER"); + + b.Property("GameId") + .HasColumnType("INTEGER"); + + b.Property("GameLevel") + .HasColumnType("INTEGER"); + + b.Property("IsMultiplayer") + .HasColumnType("INTEGER"); + + b.Property("Loss") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("Win") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GameDataId") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("GameDataId"); + + b.ToTable("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ApiKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Color") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GroupID") + .HasColumnType("TEXT"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.Property("ImageType") + .HasColumnType("TEXT"); + + b.Property("ImageSlot") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("ImageData") + .HasColumnType("TEXT"); + + b.Property("TemplateName") + .HasColumnType("TEXT"); + + b.HasKey("ImageType", "ImageSlot", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Images"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AttributesSerialized") + .HasColumnType("TEXT"); + + b.Property("ItemId") + .HasColumnType("INTEGER"); + + b.Property("Quantity") + .HasColumnType("INTEGER"); + + b.Property("StatsSerialized") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("InventoryItems"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Role") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MMORoles"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ConversationID") + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Data") + .HasColumnType("TEXT"); + + b.Property("IsDeleted") + .HasColumnType("INTEGER"); + + b.Property("IsNew") + .HasColumnType("INTEGER"); + + b.Property("IsPrivate") + .HasColumnType("INTEGER"); + + b.Property("LastUpdatedAt") + .HasColumnType("TEXT"); + + b.Property("MemberMessage") + .HasColumnType("TEXT"); + + b.Property("MessageLevel") + .HasColumnType("INTEGER"); + + b.Property("MessageType") + .HasColumnType("INTEGER"); + + b.Property("MessageTypeID") + .HasColumnType("INTEGER"); + + b.Property("NonMemberMessage") + .HasColumnType("TEXT"); + + b.Property("ParentMessageId") + .HasColumnType("INTEGER"); + + b.Property("QueueID") + .HasColumnType("INTEGER"); + + b.Property("ToVikingId") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ParentMessageId"); + + b.HasIndex("ToVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Messages"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("MissionId") + .HasColumnType("INTEGER"); + + b.Property("MissionStatus") + .HasColumnType("INTEGER"); + + b.Property("UserAccepted") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MissionStates"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Slot0") + .HasColumnType("TEXT"); + + b.Property("Slot1") + .HasColumnType("TEXT"); + + b.Property("Slot2") + .HasColumnType("TEXT"); + + b.Property("Slot3") + .HasColumnType("TEXT"); + + b.Property("Slot4") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId") + .IsUnique(); + + b.ToTable("Neighborhoods"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Key") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("MasterId") + .HasColumnType("INTEGER"); + + b.Property("Value") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("MasterId"); + + b.ToTable("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DragonId") + .HasColumnType("INTEGER"); + + b.Property("PairId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("DragonId"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AssetBundle") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ExpirationDate") + .HasColumnType("TEXT"); + + b.Property("Location") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LocationIconAsset") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("PrivateParty") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Parties"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AnswerID") + .HasColumnType("INTEGER"); + + b.Property("QuestionID") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("ProfileAnswers"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("RankId") + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("RankId"); + + b.HasIndex("VikingId"); + + b.ToTable("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CategoryID") + .HasColumnType("INTEGER"); + + b.Property("Rank") + .HasColumnType("INTEGER"); + + b.Property("RatedEntityID") + .HasColumnType("INTEGER"); + + b.Property("RatedUserID") + .HasColumnType("TEXT"); + + b.Property("RatingAverage") + .HasColumnType("REAL"); + + b.Property("UpdateDate") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("RatingRanks"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("RoomId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Rooms"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RoomId") + .HasColumnType("INTEGER"); + + b.Property("RoomItemData") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("RoomItems"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("SaveId") + .HasColumnType("INTEGER"); + + b.Property("SerializedData") + .HasColumnType("TEXT"); + + b.HasKey("VikingId", "SaveId"); + + b.ToTable("SavedData"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("SceneName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("XmlData") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("SceneData"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.Property("ApiToken") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("ApiToken"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.Property("Id") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("MissionId") + .HasColumnType("INTEGER"); + + b.Property("Completed") + .HasColumnType("INTEGER"); + + b.Property("Payload") + .HasColumnType("TEXT"); + + b.HasKey("Id", "VikingId", "MissionId"); + + b.HasIndex("VikingId"); + + b.ToTable("TaskStatuses"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Email") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BadgeId") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("UserBadgesCompleted"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("ExpiresOn") + .HasColumnType("TEXT"); + + b.Property("UserBanType") + .HasColumnType("INTEGER"); + + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.Property("VikingId") + .HasColumnType("INTEGER"); + + b.Property("WorldId") + .HasColumnType("INTEGER"); + + b.Property("MissionId") + .HasColumnType("INTEGER"); + + b.Property("IsCompleted") + .HasColumnType("INTEGER"); + + b.Property("StepId") + .HasColumnType("INTEGER"); + + b.Property("TaskId") + .HasColumnType("INTEGER"); + + b.HasKey("VikingId", "WorldId", "MissionId"); + + b.ToTable("UserMissionData"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AvatarSerialized") + .HasColumnType("TEXT"); + + b.Property("BirthDate") + .HasColumnType("TEXT"); + + b.Property("BuddyCode") + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("CurrentRoomId") + .HasColumnType("INTEGER"); + + b.Property("CurrentZone") + .HasColumnType("TEXT"); + + b.Property("GameVersion") + .HasColumnType("INTEGER"); + + b.Property("Gender") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Online") + .HasColumnType("INTEGER"); + + b.Property("SelectedDragonId") + .HasColumnType("INTEGER"); + + b.Property("Uid") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("SelectedDragonId") + .IsUnique(); + + b.HasIndex("Uid"); + + b.HasIndex("UserId"); + + b.ToTable("Vikings"); + }); + + modelBuilder.Entity("GroupViking", b => + { + b.HasOne("sodoff.Model.Group", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", null) + .WithMany() + .HasForeignKey("VikingsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementPoints") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementTaskStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.HasOne("sodoff.Model.Viking", "BuddyViking") + .WithMany("BuddyList") + .HasForeignKey("BuddyVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("BuddiesMade") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BuddyViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Dragons") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("GameData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.HasOne("sodoff.Model.GameData", "GameData") + .WithMany("GameDataPairs") + .HasForeignKey("GameDataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Images") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("InventoryItems") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MMORoles") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.HasOne("sodoff.Model.Message", "ParentMessage") + .WithMany("Replies") + .HasForeignKey("ParentMessageId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "ToViking") + .WithMany("MessageBoard") + .HasForeignKey("ToVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MessagesMade") + .HasForeignKey("VikingId"); + + b.Navigation("ParentMessage"); + + b.Navigation("ToViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MissionStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithOne("Neighborhood") + .HasForeignKey("sodoff.Model.Neighborhood", "VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.HasOne("sodoff.Model.PairData", "PairData") + .WithMany("Pairs") + .HasForeignKey("MasterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.HasOne("sodoff.Model.Dragon", "Dragon") + .WithMany("PairData") + .HasForeignKey("DragonId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("PairData") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("PairData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Dragon"); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Parties") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("ProfileAnswers") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.HasOne("sodoff.Model.RatingRank", "Rank") + .WithMany("Ratings") + .HasForeignKey("RankId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Ratings") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rank"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Rooms") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.HasOne("sodoff.Model.Room", "Room") + .WithMany("Items") + .HasForeignKey("RoomId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Room"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SavedData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SceneData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.HasOne("sodoff.Model.User", "User") + .WithMany("Sessions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Sessions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("TaskStatuses") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBadgesCompleted") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBans") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserMissions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.HasOne("sodoff.Model.Dragon", "SelectedDragon") + .WithOne() + .HasForeignKey("sodoff.Model.Viking", "SelectedDragonId"); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("Vikings") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SelectedDragon"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Navigation("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Navigation("Replies"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Navigation("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Navigation("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Navigation("PairData"); + + b.Navigation("Sessions"); + + b.Navigation("Vikings"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Navigation("AchievementPoints"); + + b.Navigation("AchievementTaskStates"); + + b.Navigation("BuddiesMade"); + + b.Navigation("BuddyList"); + + b.Navigation("Dragons"); + + b.Navigation("GameData"); + + b.Navigation("Images"); + + b.Navigation("InventoryItems"); + + b.Navigation("MMORoles"); + + b.Navigation("MessageBoard"); + + b.Navigation("MessagesMade"); + + b.Navigation("MissionStates"); + + b.Navigation("Neighborhood"); + + b.Navigation("PairData"); + + b.Navigation("Parties"); + + b.Navigation("ProfileAnswers"); + + b.Navigation("Ratings"); + + b.Navigation("Rooms"); + + b.Navigation("SavedData"); + + b.Navigation("SceneData"); + + b.Navigation("Sessions"); + + b.Navigation("TaskStatuses"); + + b.Navigation("UserBadgesCompleted"); + + b.Navigation("UserBans"); + + b.Navigation("UserMissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Migrations/ProductionMigrations/20250319184417_InitialCreate.Designer.cs b/src/Migrations/ProductionMigrations/20250319184417_InitialCreate.Designer.cs new file mode 100644 index 0000000..09a0758 --- /dev/null +++ b/src/Migrations/ProductionMigrations/20250319184417_InitialCreate.Designer.cs @@ -0,0 +1,1330 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using sodoff.Model; + +#nullable disable + +namespace sodoff.Migrations.ProductionMigrations +{ + [DbContext(typeof(ProductionDBContext))] + [Migration("20250319184417_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("GroupViking", b => + { + b.Property("GroupsId") + .HasColumnType("int"); + + b.Property("VikingsId") + .HasColumnType("int"); + + b.HasKey("GroupsId", "VikingsId"); + + b.HasIndex("VikingsId"); + + b.ToTable("GroupViking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("VikingId", "Type"); + + b.ToTable("AchievementPoints"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.Property("TaskId") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("Points") + .HasColumnType("int"); + + b.HasKey("TaskId", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("AchievementTaskState"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BuddyStatus1") + .HasColumnType("int"); + + b.Property("BuddyStatus2") + .HasColumnType("int"); + + b.Property("BuddyVikingId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsBestFriend1") + .HasColumnType("tinyint(1)"); + + b.Property("IsBestFriend2") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuddyVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Buddies"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("EntityId") + .HasColumnType("char(36)"); + + b.Property("PetXP") + .HasColumnType("int"); + + b.Property("RaisedPetData") + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Dragons"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DatePlayed") + .HasColumnType("datetime(6)"); + + b.Property("Difficulty") + .HasColumnType("int"); + + b.Property("GameId") + .HasColumnType("int"); + + b.Property("GameLevel") + .HasColumnType("int"); + + b.Property("IsMultiplayer") + .HasColumnType("tinyint(1)"); + + b.Property("Loss") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("Win") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("GameDataId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GameDataId"); + + b.ToTable("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ApiKey") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Color") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("GroupID") + .HasColumnType("char(36)"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.Property("ImageType") + .HasColumnType("varchar(255)"); + + b.Property("ImageSlot") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("ImageData") + .HasColumnType("longtext"); + + b.Property("TemplateName") + .HasColumnType("longtext"); + + b.HasKey("ImageType", "ImageSlot", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Images"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AttributesSerialized") + .HasColumnType("longtext"); + + b.Property("ItemId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("StatsSerialized") + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("InventoryItems"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MMORoles"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ConversationID") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("IsNew") + .HasColumnType("tinyint(1)"); + + b.Property("IsPrivate") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("MemberMessage") + .HasColumnType("longtext"); + + b.Property("MessageLevel") + .HasColumnType("int"); + + b.Property("MessageType") + .HasColumnType("int"); + + b.Property("MessageTypeID") + .HasColumnType("int"); + + b.Property("NonMemberMessage") + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("int"); + + b.Property("QueueID") + .HasColumnType("int"); + + b.Property("ToVikingId") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentMessageId"); + + b.HasIndex("ToVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Messages"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("MissionId") + .HasColumnType("int"); + + b.Property("MissionStatus") + .HasColumnType("int"); + + b.Property("UserAccepted") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MissionStates"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Slot0") + .HasColumnType("char(36)"); + + b.Property("Slot1") + .HasColumnType("char(36)"); + + b.Property("Slot2") + .HasColumnType("char(36)"); + + b.Property("Slot3") + .HasColumnType("char(36)"); + + b.Property("Slot4") + .HasColumnType("char(36)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId") + .IsUnique(); + + b.ToTable("Neighborhoods"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MasterId") + .HasColumnType("int"); + + b.Property("Value") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("MasterId"); + + b.ToTable("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DragonId") + .HasColumnType("int"); + + b.Property("PairId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DragonId"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AssetBundle") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExpirationDate") + .HasColumnType("datetime(6)"); + + b.Property("Location") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LocationIconAsset") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PrivateParty") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Parties"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AnswerID") + .HasColumnType("int"); + + b.Property("QuestionID") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("ProfileAnswers"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("RankId") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RankId"); + + b.HasIndex("VikingId"); + + b.ToTable("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CategoryID") + .HasColumnType("int"); + + b.Property("Rank") + .HasColumnType("int"); + + b.Property("RatedEntityID") + .HasColumnType("int"); + + b.Property("RatedUserID") + .HasColumnType("longtext"); + + b.Property("RatingAverage") + .HasColumnType("float"); + + b.Property("UpdateDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("RatingRanks"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("RoomId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Rooms"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("RoomId") + .HasColumnType("int"); + + b.Property("RoomItemData") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("RoomItems"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("SaveId") + .HasColumnType("int unsigned"); + + b.Property("SerializedData") + .HasColumnType("longtext"); + + b.HasKey("VikingId", "SaveId"); + + b.ToTable("SavedData"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("SceneName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("XmlData") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("SceneData"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.Property("ApiToken") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("ApiToken"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("MissionId") + .HasColumnType("int"); + + b.Property("Completed") + .HasColumnType("tinyint(1)"); + + b.Property("Payload") + .HasColumnType("longtext"); + + b.HasKey("Id", "VikingId", "MissionId"); + + b.HasIndex("VikingId"); + + b.ToTable("TaskStatuses"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Password") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Username") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BadgeId") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("UserBadgesCompleted"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiresOn") + .HasColumnType("datetime(6)"); + + b.Property("UserBanType") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("WorldId") + .HasColumnType("int"); + + b.Property("MissionId") + .HasColumnType("int"); + + b.Property("IsCompleted") + .HasColumnType("tinyint(1)"); + + b.Property("StepId") + .HasColumnType("int"); + + b.Property("TaskId") + .HasColumnType("int"); + + b.HasKey("VikingId", "WorldId", "MissionId"); + + b.ToTable("UserMissionData"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AvatarSerialized") + .HasColumnType("longtext"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("BuddyCode") + .HasColumnType("longtext"); + + b.Property("CreationDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentRoomId") + .HasColumnType("int"); + + b.Property("CurrentZone") + .HasColumnType("longtext"); + + b.Property("GameVersion") + .HasColumnType("int unsigned"); + + b.Property("Gender") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Online") + .HasColumnType("tinyint(1)"); + + b.Property("SelectedDragonId") + .HasColumnType("int"); + + b.Property("Uid") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("SelectedDragonId") + .IsUnique(); + + b.HasIndex("Uid"); + + b.HasIndex("UserId"); + + b.ToTable("Vikings"); + }); + + modelBuilder.Entity("GroupViking", b => + { + b.HasOne("sodoff.Model.Group", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", null) + .WithMany() + .HasForeignKey("VikingsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementPoints") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementTaskStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.HasOne("sodoff.Model.Viking", "BuddyViking") + .WithMany("BuddyList") + .HasForeignKey("BuddyVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("BuddiesMade") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BuddyViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Dragons") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("GameData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.HasOne("sodoff.Model.GameData", "GameData") + .WithMany("GameDataPairs") + .HasForeignKey("GameDataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Images") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("InventoryItems") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MMORoles") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.HasOne("sodoff.Model.Message", "ParentMessage") + .WithMany("Replies") + .HasForeignKey("ParentMessageId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "ToViking") + .WithMany("MessageBoard") + .HasForeignKey("ToVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MessagesMade") + .HasForeignKey("VikingId"); + + b.Navigation("ParentMessage"); + + b.Navigation("ToViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MissionStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithOne("Neighborhood") + .HasForeignKey("sodoff.Model.Neighborhood", "VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.HasOne("sodoff.Model.PairData", "PairData") + .WithMany("Pairs") + .HasForeignKey("MasterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.HasOne("sodoff.Model.Dragon", "Dragon") + .WithMany("PairData") + .HasForeignKey("DragonId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("PairData") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("PairData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Dragon"); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Parties") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("ProfileAnswers") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.HasOne("sodoff.Model.RatingRank", "Rank") + .WithMany("Ratings") + .HasForeignKey("RankId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Ratings") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rank"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Rooms") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.HasOne("sodoff.Model.Room", "Room") + .WithMany("Items") + .HasForeignKey("RoomId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Room"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SavedData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SceneData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.HasOne("sodoff.Model.User", "User") + .WithMany("Sessions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Sessions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("TaskStatuses") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBadgesCompleted") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBans") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserMissions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.HasOne("sodoff.Model.Dragon", "SelectedDragon") + .WithOne() + .HasForeignKey("sodoff.Model.Viking", "SelectedDragonId"); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("Vikings") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SelectedDragon"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Navigation("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Navigation("Replies"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Navigation("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Navigation("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Navigation("PairData"); + + b.Navigation("Sessions"); + + b.Navigation("Vikings"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Navigation("AchievementPoints"); + + b.Navigation("AchievementTaskStates"); + + b.Navigation("BuddiesMade"); + + b.Navigation("BuddyList"); + + b.Navigation("Dragons"); + + b.Navigation("GameData"); + + b.Navigation("Images"); + + b.Navigation("InventoryItems"); + + b.Navigation("MMORoles"); + + b.Navigation("MessageBoard"); + + b.Navigation("MessagesMade"); + + b.Navigation("MissionStates"); + + b.Navigation("Neighborhood"); + + b.Navigation("PairData"); + + b.Navigation("Parties"); + + b.Navigation("ProfileAnswers"); + + b.Navigation("Ratings"); + + b.Navigation("Rooms"); + + b.Navigation("SavedData"); + + b.Navigation("SceneData"); + + b.Navigation("Sessions"); + + b.Navigation("TaskStatuses"); + + b.Navigation("UserBadgesCompleted"); + + b.Navigation("UserBans"); + + b.Navigation("UserMissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Migrations/ProductionMigrations/20250319184417_InitialCreate.cs b/src/Migrations/ProductionMigrations/20250319184417_InitialCreate.cs new file mode 100644 index 0000000..b3a6fef --- /dev/null +++ b/src/Migrations/ProductionMigrations/20250319184417_InitialCreate.cs @@ -0,0 +1,1058 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using MySql.EntityFrameworkCore.Metadata; + +#nullable disable + +namespace sodoff.Migrations.ProductionMigrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Groups", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + GroupID = table.Column(type: "char(36)", nullable: false), + Name = table.Column(type: "longtext", nullable: false), + Type = table.Column(type: "int", nullable: false), + Color = table.Column(type: "longtext", nullable: false), + Logo = table.Column(type: "longtext", nullable: false), + ApiKey = table.Column(type: "longtext", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Groups", x => x.Id); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RatingRanks", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + CategoryID = table.Column(type: "int", nullable: false), + RatedEntityID = table.Column(type: "int", nullable: true), + RatedUserID = table.Column(type: "longtext", nullable: true), + Rank = table.Column(type: "int", nullable: false), + RatingAverage = table.Column(type: "float", nullable: false), + UpdateDate = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RatingRanks", x => x.Id); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false), + Email = table.Column(type: "longtext", nullable: false), + Username = table.Column(type: "longtext", nullable: false), + Password = table.Column(type: "longtext", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AchievementPoints", + columns: table => new + { + VikingId = table.Column(type: "int", nullable: false), + Type = table.Column(type: "int", nullable: false), + Value = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AchievementPoints", x => new { x.VikingId, x.Type }); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AchievementTaskState", + columns: table => new + { + VikingId = table.Column(type: "int", nullable: false), + TaskId = table.Column(type: "int", nullable: false), + Points = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AchievementTaskState", x => new { x.TaskId, x.VikingId }); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Bans", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + UserBanType = table.Column(type: "int", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + ExpiresOn = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Bans", x => x.Id); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Buddies", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + BuddyVikingId = table.Column(type: "int", nullable: false), + BuddyStatus1 = table.Column(type: "int", nullable: false), + BuddyStatus2 = table.Column(type: "int", nullable: false), + IsBestFriend1 = table.Column(type: "tinyint(1)", nullable: false), + IsBestFriend2 = table.Column(type: "tinyint(1)", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Buddies", x => x.Id); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Dragons", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + EntityId = table.Column(type: "char(36)", nullable: false), + VikingId = table.Column(type: "int", nullable: false), + RaisedPetData = table.Column(type: "longtext", nullable: true), + PetXP = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Dragons", x => x.Id); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Vikings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + Uid = table.Column(type: "char(36)", nullable: false), + Name = table.Column(type: "longtext", nullable: false), + UserId = table.Column(type: "char(36)", nullable: false), + AvatarSerialized = table.Column(type: "longtext", nullable: true), + BuddyCode = table.Column(type: "longtext", nullable: true), + SelectedDragonId = table.Column(type: "int", nullable: true), + Online = table.Column(type: "tinyint(1)", nullable: true), + CurrentRoomId = table.Column(type: "int", nullable: true), + CurrentZone = table.Column(type: "longtext", nullable: true), + CreationDate = table.Column(type: "datetime(6)", nullable: true), + BirthDate = table.Column(type: "datetime(6)", nullable: true), + Gender = table.Column(type: "int", nullable: true), + GameVersion = table.Column(type: "int unsigned", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Vikings", x => x.Id); + table.ForeignKey( + name: "FK_Vikings_Dragons_SelectedDragonId", + column: x => x.SelectedDragonId, + principalTable: "Dragons", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Vikings_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "GameData", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + GameId = table.Column(type: "int", nullable: false), + Difficulty = table.Column(type: "int", nullable: false), + GameLevel = table.Column(type: "int", nullable: false), + DatePlayed = table.Column(type: "datetime(6)", nullable: false), + IsMultiplayer = table.Column(type: "tinyint(1)", nullable: false), + Win = table.Column(type: "tinyint(1)", nullable: false), + Loss = table.Column(type: "tinyint(1)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameData", x => x.Id); + table.ForeignKey( + name: "FK_GameData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "GroupViking", + columns: table => new + { + GroupsId = table.Column(type: "int", nullable: false), + VikingsId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GroupViking", x => new { x.GroupsId, x.VikingsId }); + table.ForeignKey( + name: "FK_GroupViking_Groups_GroupsId", + column: x => x.GroupsId, + principalTable: "Groups", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_GroupViking_Vikings_VikingsId", + column: x => x.VikingsId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Images", + columns: table => new + { + ImageType = table.Column(type: "varchar(255)", nullable: false), + ImageSlot = table.Column(type: "int", nullable: false), + VikingId = table.Column(type: "int", nullable: false), + ImageData = table.Column(type: "longtext", nullable: true), + TemplateName = table.Column(type: "longtext", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Images", x => new { x.ImageType, x.ImageSlot, x.VikingId }); + table.ForeignKey( + name: "FK_Images_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "InventoryItems", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + ItemId = table.Column(type: "int", nullable: false), + VikingId = table.Column(type: "int", nullable: false), + StatsSerialized = table.Column(type: "longtext", nullable: true), + AttributesSerialized = table.Column(type: "longtext", nullable: true), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_InventoryItems", x => x.Id); + table.ForeignKey( + name: "FK_InventoryItems_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Messages", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: true), + ToVikingId = table.Column(type: "int", nullable: false), + QueueID = table.Column(type: "int", nullable: false), + ConversationID = table.Column(type: "int", nullable: true), + ParentMessageId = table.Column(type: "int", nullable: true), + MessageType = table.Column(type: "int", nullable: true), + MessageTypeID = table.Column(type: "int", nullable: true), + MessageLevel = table.Column(type: "int", nullable: false), + Data = table.Column(type: "longtext", nullable: true), + MemberMessage = table.Column(type: "longtext", nullable: true), + NonMemberMessage = table.Column(type: "longtext", nullable: true), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false), + IsNew = table.Column(type: "tinyint(1)", nullable: false), + IsPrivate = table.Column(type: "tinyint(1)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Messages", x => x.Id); + table.ForeignKey( + name: "FK_Messages_Messages_ParentMessageId", + column: x => x.ParentMessageId, + principalTable: "Messages", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Messages_Vikings_ToVikingId", + column: x => x.ToVikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Messages_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id"); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "MissionStates", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + MissionId = table.Column(type: "int", nullable: false), + VikingId = table.Column(type: "int", nullable: false), + MissionStatus = table.Column(type: "int", nullable: false), + UserAccepted = table.Column(type: "tinyint(1)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_MissionStates", x => x.Id); + table.ForeignKey( + name: "FK_MissionStates_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "MMORoles", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + Role = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MMORoles", x => x.Id); + table.ForeignKey( + name: "FK_MMORoles_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Neighborhoods", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + Slot0 = table.Column(type: "char(36)", nullable: false), + Slot1 = table.Column(type: "char(36)", nullable: false), + Slot2 = table.Column(type: "char(36)", nullable: false), + Slot3 = table.Column(type: "char(36)", nullable: false), + Slot4 = table.Column(type: "char(36)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Neighborhoods", x => x.Id); + table.ForeignKey( + name: "FK_Neighborhoods_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "PairData", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + PairId = table.Column(type: "int", nullable: false), + UserId = table.Column(type: "char(36)", nullable: true), + VikingId = table.Column(type: "int", nullable: true), + DragonId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PairData", x => x.Id); + table.ForeignKey( + name: "FK_PairData_Dragons_DragonId", + column: x => x.DragonId, + principalTable: "Dragons", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PairData_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PairData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Parties", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + Location = table.Column(type: "longtext", nullable: false), + VikingId = table.Column(type: "int", nullable: false), + ExpirationDate = table.Column(type: "datetime(6)", nullable: false), + PrivateParty = table.Column(type: "tinyint(1)", nullable: true), + LocationIconAsset = table.Column(type: "longtext", nullable: false), + AssetBundle = table.Column(type: "longtext", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Parties", x => x.Id); + table.ForeignKey( + name: "FK_Parties_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ProfileAnswers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + QuestionID = table.Column(type: "int", nullable: false), + AnswerID = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProfileAnswers", x => x.Id); + table.ForeignKey( + name: "FK_ProfileAnswers_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Ratings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + RankId = table.Column(type: "int", nullable: false), + Value = table.Column(type: "int", nullable: false), + Date = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Ratings", x => x.Id); + table.ForeignKey( + name: "FK_Ratings_RatingRanks_RankId", + column: x => x.RankId, + principalTable: "RatingRanks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Ratings_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Rooms", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + RoomId = table.Column(type: "longtext", nullable: false), + VikingId = table.Column(type: "int", nullable: false), + Name = table.Column(type: "longtext", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Rooms", x => x.Id); + table.ForeignKey( + name: "FK_Rooms_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "SavedData", + columns: table => new + { + VikingId = table.Column(type: "int", nullable: false), + SaveId = table.Column(type: "int unsigned", nullable: false), + SerializedData = table.Column(type: "longtext", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SavedData", x => new { x.VikingId, x.SaveId }); + table.ForeignKey( + name: "FK_SavedData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "SceneData", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + SceneName = table.Column(type: "longtext", nullable: false), + XmlData = table.Column(type: "longtext", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SceneData", x => x.Id); + table.ForeignKey( + name: "FK_SceneData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Sessions", + columns: table => new + { + ApiToken = table.Column(type: "char(36)", nullable: false), + UserId = table.Column(type: "char(36)", nullable: true), + VikingId = table.Column(type: "int", nullable: true), + CreatedAt = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Sessions", x => x.ApiToken); + table.ForeignKey( + name: "FK_Sessions_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Sessions_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "TaskStatuses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false), + MissionId = table.Column(type: "int", nullable: false), + VikingId = table.Column(type: "int", nullable: false), + Payload = table.Column(type: "longtext", nullable: true), + Completed = table.Column(type: "tinyint(1)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskStatuses", x => new { x.Id, x.VikingId, x.MissionId }); + table.ForeignKey( + name: "FK_TaskStatuses_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "UserBadgesCompleted", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + VikingId = table.Column(type: "int", nullable: false), + BadgeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserBadgesCompleted", x => x.Id); + table.ForeignKey( + name: "FK_UserBadgesCompleted_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "UserMissionData", + columns: table => new + { + VikingId = table.Column(type: "int", nullable: false), + WorldId = table.Column(type: "int", nullable: false), + MissionId = table.Column(type: "int", nullable: false), + StepId = table.Column(type: "int", nullable: false), + TaskId = table.Column(type: "int", nullable: false), + IsCompleted = table.Column(type: "tinyint(1)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserMissionData", x => new { x.VikingId, x.WorldId, x.MissionId }); + table.ForeignKey( + name: "FK_UserMissionData_Vikings_VikingId", + column: x => x.VikingId, + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "GameDataPairs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + GameDataId = table.Column(type: "int", nullable: false), + Name = table.Column(type: "longtext", nullable: false), + Value = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GameDataPairs", x => x.Id); + table.ForeignKey( + name: "FK_GameDataPairs_GameData_GameDataId", + column: x => x.GameDataId, + principalTable: "GameData", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Pairs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + Key = table.Column(type: "longtext", nullable: false), + Value = table.Column(type: "longtext", nullable: false), + MasterId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Pairs", x => x.Id); + table.ForeignKey( + name: "FK_Pairs_PairData_MasterId", + column: x => x.MasterId, + principalTable: "PairData", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RoomItems", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn), + RoomId = table.Column(type: "int", nullable: false), + RoomItemData = table.Column(type: "longtext", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RoomItems", x => x.Id); + table.ForeignKey( + name: "FK_RoomItems_Rooms_RoomId", + column: x => x.RoomId, + principalTable: "Rooms", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySQL:Charset", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_AchievementTaskState_VikingId", + table: "AchievementTaskState", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Bans_VikingId", + table: "Bans", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Buddies_BuddyVikingId", + table: "Buddies", + column: "BuddyVikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Buddies_VikingId", + table: "Buddies", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Dragons_VikingId", + table: "Dragons", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_GameData_VikingId", + table: "GameData", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_GameDataPairs_GameDataId", + table: "GameDataPairs", + column: "GameDataId"); + + migrationBuilder.CreateIndex( + name: "IX_GroupViking_VikingsId", + table: "GroupViking", + column: "VikingsId"); + + migrationBuilder.CreateIndex( + name: "IX_Images_VikingId", + table: "Images", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_InventoryItems_VikingId", + table: "InventoryItems", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Messages_ParentMessageId", + table: "Messages", + column: "ParentMessageId"); + + migrationBuilder.CreateIndex( + name: "IX_Messages_ToVikingId", + table: "Messages", + column: "ToVikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Messages_VikingId", + table: "Messages", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_MissionStates_VikingId", + table: "MissionStates", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_MMORoles_VikingId", + table: "MMORoles", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Neighborhoods_VikingId", + table: "Neighborhoods", + column: "VikingId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_PairData_DragonId", + table: "PairData", + column: "DragonId"); + + migrationBuilder.CreateIndex( + name: "IX_PairData_UserId", + table: "PairData", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_PairData_VikingId", + table: "PairData", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Pairs_MasterId", + table: "Pairs", + column: "MasterId"); + + migrationBuilder.CreateIndex( + name: "IX_Parties_VikingId", + table: "Parties", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_ProfileAnswers_VikingId", + table: "ProfileAnswers", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Ratings_RankId", + table: "Ratings", + column: "RankId"); + + migrationBuilder.CreateIndex( + name: "IX_Ratings_VikingId", + table: "Ratings", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_RoomItems_RoomId", + table: "RoomItems", + column: "RoomId"); + + migrationBuilder.CreateIndex( + name: "IX_Rooms_VikingId", + table: "Rooms", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_SceneData_VikingId", + table: "SceneData", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Sessions_UserId", + table: "Sessions", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Sessions_VikingId", + table: "Sessions", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskStatuses_VikingId", + table: "TaskStatuses", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_UserBadgesCompleted_VikingId", + table: "UserBadgesCompleted", + column: "VikingId"); + + migrationBuilder.CreateIndex( + name: "IX_Vikings_SelectedDragonId", + table: "Vikings", + column: "SelectedDragonId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Vikings_Uid", + table: "Vikings", + column: "Uid"); + + migrationBuilder.CreateIndex( + name: "IX_Vikings_UserId", + table: "Vikings", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_AchievementPoints_Vikings_VikingId", + table: "AchievementPoints", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AchievementTaskState_Vikings_VikingId", + table: "AchievementTaskState", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Bans_Vikings_VikingId", + table: "Bans", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Buddies_Vikings_BuddyVikingId", + table: "Buddies", + column: "BuddyVikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Buddies_Vikings_VikingId", + table: "Buddies", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Dragons_Vikings_VikingId", + table: "Dragons", + column: "VikingId", + principalTable: "Vikings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Dragons_Vikings_VikingId", + table: "Dragons"); + + migrationBuilder.DropTable( + name: "AchievementPoints"); + + migrationBuilder.DropTable( + name: "AchievementTaskState"); + + migrationBuilder.DropTable( + name: "Bans"); + + migrationBuilder.DropTable( + name: "Buddies"); + + migrationBuilder.DropTable( + name: "GameDataPairs"); + + migrationBuilder.DropTable( + name: "GroupViking"); + + migrationBuilder.DropTable( + name: "Images"); + + migrationBuilder.DropTable( + name: "InventoryItems"); + + migrationBuilder.DropTable( + name: "Messages"); + + migrationBuilder.DropTable( + name: "MissionStates"); + + migrationBuilder.DropTable( + name: "MMORoles"); + + migrationBuilder.DropTable( + name: "Neighborhoods"); + + migrationBuilder.DropTable( + name: "Pairs"); + + migrationBuilder.DropTable( + name: "Parties"); + + migrationBuilder.DropTable( + name: "ProfileAnswers"); + + migrationBuilder.DropTable( + name: "Ratings"); + + migrationBuilder.DropTable( + name: "RoomItems"); + + migrationBuilder.DropTable( + name: "SavedData"); + + migrationBuilder.DropTable( + name: "SceneData"); + + migrationBuilder.DropTable( + name: "Sessions"); + + migrationBuilder.DropTable( + name: "TaskStatuses"); + + migrationBuilder.DropTable( + name: "UserBadgesCompleted"); + + migrationBuilder.DropTable( + name: "UserMissionData"); + + migrationBuilder.DropTable( + name: "GameData"); + + migrationBuilder.DropTable( + name: "Groups"); + + migrationBuilder.DropTable( + name: "PairData"); + + migrationBuilder.DropTable( + name: "RatingRanks"); + + migrationBuilder.DropTable( + name: "Rooms"); + + migrationBuilder.DropTable( + name: "Vikings"); + + migrationBuilder.DropTable( + name: "Dragons"); + + migrationBuilder.DropTable( + name: "Users"); + } + } +} diff --git a/src/Migrations/ProductionMigrations/ProductionDBContextModelSnapshot.cs b/src/Migrations/ProductionMigrations/ProductionDBContextModelSnapshot.cs new file mode 100644 index 0000000..b79412b --- /dev/null +++ b/src/Migrations/ProductionMigrations/ProductionDBContextModelSnapshot.cs @@ -0,0 +1,1327 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using sodoff.Model; + +#nullable disable + +namespace sodoff.Migrations.ProductionMigrations +{ + [DbContext(typeof(ProductionDBContext))] + partial class ProductionDBContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.20") + .HasAnnotation("Proxies:ChangeTracking", false) + .HasAnnotation("Proxies:CheckEquality", false) + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("GroupViking", b => + { + b.Property("GroupsId") + .HasColumnType("int"); + + b.Property("VikingsId") + .HasColumnType("int"); + + b.HasKey("GroupsId", "VikingsId"); + + b.HasIndex("VikingsId"); + + b.ToTable("GroupViking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("VikingId", "Type"); + + b.ToTable("AchievementPoints"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.Property("TaskId") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("Points") + .HasColumnType("int"); + + b.HasKey("TaskId", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("AchievementTaskState"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BuddyStatus1") + .HasColumnType("int"); + + b.Property("BuddyStatus2") + .HasColumnType("int"); + + b.Property("BuddyVikingId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsBestFriend1") + .HasColumnType("tinyint(1)"); + + b.Property("IsBestFriend2") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuddyVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Buddies"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("EntityId") + .HasColumnType("char(36)"); + + b.Property("PetXP") + .HasColumnType("int"); + + b.Property("RaisedPetData") + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Dragons"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DatePlayed") + .HasColumnType("datetime(6)"); + + b.Property("Difficulty") + .HasColumnType("int"); + + b.Property("GameId") + .HasColumnType("int"); + + b.Property("GameLevel") + .HasColumnType("int"); + + b.Property("IsMultiplayer") + .HasColumnType("tinyint(1)"); + + b.Property("Loss") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("Win") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("GameDataId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GameDataId"); + + b.ToTable("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ApiKey") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Color") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("GroupID") + .HasColumnType("char(36)"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.Property("ImageType") + .HasColumnType("varchar(255)"); + + b.Property("ImageSlot") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("ImageData") + .HasColumnType("longtext"); + + b.Property("TemplateName") + .HasColumnType("longtext"); + + b.HasKey("ImageType", "ImageSlot", "VikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Images"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AttributesSerialized") + .HasColumnType("longtext"); + + b.Property("ItemId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("StatsSerialized") + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("InventoryItems"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MMORoles"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ConversationID") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("IsNew") + .HasColumnType("tinyint(1)"); + + b.Property("IsPrivate") + .HasColumnType("tinyint(1)"); + + b.Property("LastUpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("MemberMessage") + .HasColumnType("longtext"); + + b.Property("MessageLevel") + .HasColumnType("int"); + + b.Property("MessageType") + .HasColumnType("int"); + + b.Property("MessageTypeID") + .HasColumnType("int"); + + b.Property("NonMemberMessage") + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("int"); + + b.Property("QueueID") + .HasColumnType("int"); + + b.Property("ToVikingId") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentMessageId"); + + b.HasIndex("ToVikingId"); + + b.HasIndex("VikingId"); + + b.ToTable("Messages"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("MissionId") + .HasColumnType("int"); + + b.Property("MissionStatus") + .HasColumnType("int"); + + b.Property("UserAccepted") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("MissionStates"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Slot0") + .HasColumnType("char(36)"); + + b.Property("Slot1") + .HasColumnType("char(36)"); + + b.Property("Slot2") + .HasColumnType("char(36)"); + + b.Property("Slot3") + .HasColumnType("char(36)"); + + b.Property("Slot4") + .HasColumnType("char(36)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId") + .IsUnique(); + + b.ToTable("Neighborhoods"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MasterId") + .HasColumnType("int"); + + b.Property("Value") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("MasterId"); + + b.ToTable("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DragonId") + .HasColumnType("int"); + + b.Property("PairId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DragonId"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AssetBundle") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ExpirationDate") + .HasColumnType("datetime(6)"); + + b.Property("Location") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LocationIconAsset") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PrivateParty") + .HasColumnType("tinyint(1)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Parties"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AnswerID") + .HasColumnType("int"); + + b.Property("QuestionID") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("ProfileAnswers"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("RankId") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RankId"); + + b.HasIndex("VikingId"); + + b.ToTable("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CategoryID") + .HasColumnType("int"); + + b.Property("Rank") + .HasColumnType("int"); + + b.Property("RatedEntityID") + .HasColumnType("int"); + + b.Property("RatedUserID") + .HasColumnType("longtext"); + + b.Property("RatingAverage") + .HasColumnType("float"); + + b.Property("UpdateDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("RatingRanks"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("RoomId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Rooms"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("RoomId") + .HasColumnType("int"); + + b.Property("RoomItemData") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("RoomId"); + + b.ToTable("RoomItems"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("SaveId") + .HasColumnType("int unsigned"); + + b.Property("SerializedData") + .HasColumnType("longtext"); + + b.HasKey("VikingId", "SaveId"); + + b.ToTable("SavedData"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("SceneName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("XmlData") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("SceneData"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.Property("ApiToken") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("ApiToken"); + + b.HasIndex("UserId"); + + b.HasIndex("VikingId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("MissionId") + .HasColumnType("int"); + + b.Property("Completed") + .HasColumnType("tinyint(1)"); + + b.Property("Payload") + .HasColumnType("longtext"); + + b.HasKey("Id", "VikingId", "MissionId"); + + b.HasIndex("VikingId"); + + b.ToTable("TaskStatuses"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Password") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Username") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BadgeId") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("UserBadgesCompleted"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiresOn") + .HasColumnType("datetime(6)"); + + b.Property("UserBanType") + .HasColumnType("int"); + + b.Property("VikingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VikingId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.Property("VikingId") + .HasColumnType("int"); + + b.Property("WorldId") + .HasColumnType("int"); + + b.Property("MissionId") + .HasColumnType("int"); + + b.Property("IsCompleted") + .HasColumnType("tinyint(1)"); + + b.Property("StepId") + .HasColumnType("int"); + + b.Property("TaskId") + .HasColumnType("int"); + + b.HasKey("VikingId", "WorldId", "MissionId"); + + b.ToTable("UserMissionData"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AvatarSerialized") + .HasColumnType("longtext"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("BuddyCode") + .HasColumnType("longtext"); + + b.Property("CreationDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentRoomId") + .HasColumnType("int"); + + b.Property("CurrentZone") + .HasColumnType("longtext"); + + b.Property("GameVersion") + .HasColumnType("int unsigned"); + + b.Property("Gender") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Online") + .HasColumnType("tinyint(1)"); + + b.Property("SelectedDragonId") + .HasColumnType("int"); + + b.Property("Uid") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("SelectedDragonId") + .IsUnique(); + + b.HasIndex("Uid"); + + b.HasIndex("UserId"); + + b.ToTable("Vikings"); + }); + + modelBuilder.Entity("GroupViking", b => + { + b.HasOne("sodoff.Model.Group", null) + .WithMany() + .HasForeignKey("GroupsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", null) + .WithMany() + .HasForeignKey("VikingsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("sodoff.Model.AchievementPoints", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementPoints") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.AchievementTaskState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("AchievementTaskStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Buddy", b => + { + b.HasOne("sodoff.Model.Viking", "BuddyViking") + .WithMany("BuddyList") + .HasForeignKey("BuddyVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("BuddiesMade") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BuddyViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Dragons") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("GameData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.GameDataPair", b => + { + b.HasOne("sodoff.Model.GameData", "GameData") + .WithMany("GameDataPairs") + .HasForeignKey("GameDataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GameData"); + }); + + modelBuilder.Entity("sodoff.Model.Image", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Images") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.InventoryItem", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("InventoryItems") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MMORole", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MMORoles") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.HasOne("sodoff.Model.Message", "ParentMessage") + .WithMany("Replies") + .HasForeignKey("ParentMessageId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "ToViking") + .WithMany("MessageBoard") + .HasForeignKey("ToVikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MessagesMade") + .HasForeignKey("VikingId"); + + b.Navigation("ParentMessage"); + + b.Navigation("ToViking"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.MissionState", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("MissionStates") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Neighborhood", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithOne("Neighborhood") + .HasForeignKey("sodoff.Model.Neighborhood", "VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Pair", b => + { + b.HasOne("sodoff.Model.PairData", "PairData") + .WithMany("Pairs") + .HasForeignKey("MasterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.HasOne("sodoff.Model.Dragon", "Dragon") + .WithMany("PairData") + .HasForeignKey("DragonId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("PairData") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("PairData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Dragon"); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Party", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Parties") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.ProfileAnswer", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("ProfileAnswers") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Rating", b => + { + b.HasOne("sodoff.Model.RatingRank", "Rank") + .WithMany("Ratings") + .HasForeignKey("RankId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Ratings") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rank"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Rooms") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.RoomItem", b => + { + b.HasOne("sodoff.Model.Room", "Room") + .WithMany("Items") + .HasForeignKey("RoomId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Room"); + }); + + modelBuilder.Entity("sodoff.Model.SavedData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SavedData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.SceneData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("SceneData") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Session", b => + { + b.HasOne("sodoff.Model.User", "User") + .WithMany("Sessions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("Sessions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("User"); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.TaskStatus", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("TaskStatuses") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBadgeCompleteData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBadgesCompleted") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserBan", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserBans") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.UserMissionData", b => + { + b.HasOne("sodoff.Model.Viking", "Viking") + .WithMany("UserMissions") + .HasForeignKey("VikingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Viking"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.HasOne("sodoff.Model.Dragon", "SelectedDragon") + .WithOne() + .HasForeignKey("sodoff.Model.Viking", "SelectedDragonId"); + + b.HasOne("sodoff.Model.User", "User") + .WithMany("Vikings") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SelectedDragon"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("sodoff.Model.Dragon", b => + { + b.Navigation("PairData"); + }); + + modelBuilder.Entity("sodoff.Model.GameData", b => + { + b.Navigation("GameDataPairs"); + }); + + modelBuilder.Entity("sodoff.Model.Message", b => + { + b.Navigation("Replies"); + }); + + modelBuilder.Entity("sodoff.Model.PairData", b => + { + b.Navigation("Pairs"); + }); + + modelBuilder.Entity("sodoff.Model.RatingRank", b => + { + b.Navigation("Ratings"); + }); + + modelBuilder.Entity("sodoff.Model.Room", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("sodoff.Model.User", b => + { + b.Navigation("PairData"); + + b.Navigation("Sessions"); + + b.Navigation("Vikings"); + }); + + modelBuilder.Entity("sodoff.Model.Viking", b => + { + b.Navigation("AchievementPoints"); + + b.Navigation("AchievementTaskStates"); + + b.Navigation("BuddiesMade"); + + b.Navigation("BuddyList"); + + b.Navigation("Dragons"); + + b.Navigation("GameData"); + + b.Navigation("Images"); + + b.Navigation("InventoryItems"); + + b.Navigation("MMORoles"); + + b.Navigation("MessageBoard"); + + b.Navigation("MessagesMade"); + + b.Navigation("MissionStates"); + + b.Navigation("Neighborhood"); + + b.Navigation("PairData"); + + b.Navigation("Parties"); + + b.Navigation("ProfileAnswers"); + + b.Navigation("Ratings"); + + b.Navigation("Rooms"); + + b.Navigation("SavedData"); + + b.Navigation("SceneData"); + + b.Navigation("Sessions"); + + b.Navigation("TaskStatuses"); + + b.Navigation("UserBadgesCompleted"); + + b.Navigation("UserBans"); + + b.Navigation("UserMissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Model/ProductionDBContext.cs b/src/Model/ProductionDBContext.cs new file mode 100644 index 0000000..dec832a --- /dev/null +++ b/src/Model/ProductionDBContext.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Options; +using sodoff.Configuration; + +namespace sodoff.Model +{ + public class ProductionDBContext : DBContext + { + private readonly IOptions config; + public ProductionDBContext(IOptions config) : base(config) + { + this.config = config; + } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + #if USE_POSTGRESQL + if (config.Value.ProdDbProvider == DbProviders.PostgreSQL) + { + optionsBuilder.UseNpgsql(config.Value.ProdDbConnection).UseLazyLoadingProxies(); + return; + } + #endif + #if USE_MYSQL + if (config.Value.ProdDbProvider == DbProviders.MySQL) + { + optionsBuilder.UseMySQL(config.Value.ProdDbConnection).UseLazyLoadingProxies(); + return; + } + #endif + throw new Exception($"Unsupported Production DbProvider {config.Value.ProdDbProvider}"); + } + } +} diff --git a/src/Program.cs b/src/Program.cs index cb35b05..4b82672 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -21,6 +21,7 @@ builder.Services.AddControllers(options => { options.Filters.Add(); }); builder.Services.AddDbContext(); +builder.Services.AddDbContext(); // create Modding Service singleton here ... do this before start http server to avoid serve invalid assets list builder.Services.AddSingleton(new ModdingService()); @@ -63,11 +64,10 @@ var app = builder.Build(); using var scope = app.Services.CreateScope(); -if(app.Environment.IsDevelopment()) -{ - var migrations = scope.ServiceProvider.GetRequiredService().Database.GetPendingMigrations(); - if (migrations != null) await scope.ServiceProvider.GetRequiredService().Database.MigrateAsync(); -} +if (app.Environment.IsDevelopment()) + scope.ServiceProvider.GetRequiredService().Database.Migrate(); +else + scope.ServiceProvider.GetRequiredService().Database.Migrate(); // Configure the HTTP request pipeline. diff --git a/src/appsettings.json b/src/appsettings.json index de5849a..31a1d02 100644 --- a/src/appsettings.json +++ b/src/appsettings.json @@ -44,33 +44,39 @@ "// UseCache": "When true, downloading assets in partial mode will be stored in assets-cache for use in subsequent requests", "UseCache": true }, - "ApiServer": { - "// ResponseURL": "When not empty is used as server url in some responses. Otherwise will be auto detected.", - "ResponseURL": "", + "ApiServer": { + "// ResponseURL": "When not empty is used as server url in some responses. Otherwise will be auto detected.", + "ResponseURL": "", - "// MMOAdress": "MMO server address (IP or domain) to use in GetMMOServerInfo* responses.", - "MMOAdress": "127.0.0.1", + "// MMOAdress": "MMO server address (IP or domain) to use in GetMMOServerInfo* responses.", + "MMOAdress": "127.0.0.1", - "// MMOPort": "MMO server port to use in GetMMOServerInfo* responses.", - "MMOPort": 9933, + "// MMOPort": "MMO server port to use in GetMMOServerInfo* responses.", + "MMOPort": 9933, - "// MMOSupportMinVersion": "Minimum client version allowed to use MMO. For example: '0xa3a31a0a' mean SoD 3.31, '0xa0000000' mean all SoD version, 0 mean all games.", - "MMOSupportMinVersion": "0", - - "// LoadNonSoDData": "set to 'true' to support non SoD games, set to 'false' to reduce memory usage", - "LoadNonSoDData": true, + "// MMOSupportMinVersion": "Minimum client version allowed to use MMO. For example: '0xa3a31a0a' mean SoD 3.31, '0xa0000000' mean all SoD version, 0 mean all games.", + "MMOSupportMinVersion": "0", - "// DbProvider": "Select database backend to use: SQLite, PostgreSQL, MySQL (availability may depend on build options)", - "DbProvider": "SQLite", + "// LoadNonSoDData": "set to 'true' to support non SoD games, set to 'false' to reduce memory usage", + "LoadNonSoDData": true, - "// DbPath": "Path to SQLite database file. If empty, \"sodoff.db\" from current directory will be used.", - "DbPath": "", + "// DbProvider": "Select database backend to use: SQLite, PostgreSQL, MySQL (availability may depend on build options)", + "DbProvider": "SQLite", - "// DbConnection": "Database connection string for PostgreSQL and MySQL", - "// DbConnection PostgreSQL Example": "Host=127.0.0.1;Database=sodoffdb;Username=sodoffuser;Password=secret", - "// DbConnection MySQL Example": "Server=127.0.0.1;Database=sodoffdb;Uid=sodoffuser;Pwd=secret;Allow User Variables=True", - "DbConnection": "" - }, + "// ProdDbProvider": "Select production database backend to use: PostgreSQL, MySQL (availability may depend on build options)", + "ProdDbProvider": "MySQL", + + "// DbPath": "Path to SQLite database file. If empty, \"sodoff.db\" from current directory will be used.", + "DbPath": "", + + "// DbConnection": "Database connection string for PostgreSQL and MySQL", + "// DbConnection PostgreSQL Example": "Host=127.0.0.1;Database=sodoffdb;Username=sodoffuser;Password=secret", + "// DbConnection MySQL Example": "Server=127.0.0.1;Database=sodoffdb;Uid=sodoffuser;Pwd=secret;Allow User Variables=True", + "DbConnection": "", + + "// ProdDbConnection": "Database connection string for PostgreSQL and MySQL (examples above)", + "ProdDbConnection": "Server=172.21.0.3;Database=sodoffdb;Uid=sodoffuser;Pwd=8s7IvsrMQWASTXs;Allow User Variables=True" + }, "Logging": { "LogLevel": { "Default": "Information", diff --git a/src/sodoff.csproj b/src/sodoff.csproj index 823eb9a..5655edc 100644 --- a/src/sodoff.csproj +++ b/src/sodoff.csproj @@ -168,5 +168,7 @@ + +