From f4cf2620d9b07a51cdf843cafecf131eb359b5c8 Mon Sep 17 00:00:00 2001 From: Sarah Faey Date: Tue, 22 Nov 2022 22:37:24 +0100 Subject: [PATCH] added database migrations --- Lieb/Data/DbInitializer.cs | 4 +- .../20221122212214_InitialCreate.Designer.cs | 695 ++++++++++++++++++ .../20221122212214_InitialCreate.cs | 499 +++++++++++++ Lieb/Migrations/LiebContextModelSnapshot.cs | 693 +++++++++++++++++ Lieb/Migrations/readme.txt | 7 + Lieb/Program.cs | 2 +- 6 files changed, 1897 insertions(+), 3 deletions(-) create mode 100644 Lieb/Migrations/20221122212214_InitialCreate.Designer.cs create mode 100644 Lieb/Migrations/20221122212214_InitialCreate.cs create mode 100644 Lieb/Migrations/LiebContextModelSnapshot.cs create mode 100644 Lieb/Migrations/readme.txt diff --git a/Lieb/Data/DbInitializer.cs b/Lieb/Data/DbInitializer.cs index 6ca0b2a..2ee24a9 100644 --- a/Lieb/Data/DbInitializer.cs +++ b/Lieb/Data/DbInitializer.cs @@ -40,8 +40,8 @@ namespace Lieb.Data GuildWars2Account bloodseeker = new GuildWars2Account() { AccountName = "Bloodseeker.2043" }; var users = new LiebUser[] { - new LiebUser{Id=0, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List(){ linaith, sarah} }, - //new LiebUser{Id=194863625477816321, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List(){ linaith, sarah} }, + //new LiebUser{Id=0, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List(){ linaith, sarah} }, + new LiebUser{Id=194863625477816321, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List(){ linaith, sarah} }, #if DEBUG //new LiebUser{Id=194455125769715713, Name="Lisa", GuildWars2Accounts = new List(){ hierpiepts}}, new LiebUser{Id=1, Name="Lisa", GuildWars2Accounts = new List(){ hierpiepts}}, diff --git a/Lieb/Migrations/20221122212214_InitialCreate.Designer.cs b/Lieb/Migrations/20221122212214_InitialCreate.Designer.cs new file mode 100644 index 0000000..8a42359 --- /dev/null +++ b/Lieb/Migrations/20221122212214_InitialCreate.Designer.cs @@ -0,0 +1,695 @@ +// +using System; +using Lieb.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Lieb.Migrations +{ + [DbContext(typeof(LiebContext))] + [Migration("20221122212214_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.10"); + + modelBuilder.Entity("Lieb.Models.DiscordSettings", b => + { + b.Property("DiscordSettingsId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChangeUserNames") + .HasColumnType("INTEGER"); + + b.Property("DiscordLogChannel") + .HasColumnType("INTEGER"); + + b.HasKey("DiscordSettingsId"); + + b.ToTable("DiscordSettings", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Equipped", b => + { + b.Property("EquippedId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CanTank") + .HasColumnType("INTEGER"); + + b.Property("GuildWars2AccountId") + .HasColumnType("INTEGER"); + + b.Property("GuildWars2BuildId") + .HasColumnType("INTEGER"); + + b.HasKey("EquippedId"); + + b.HasIndex("GuildWars2AccountId"); + + b.HasIndex("GuildWars2BuildId"); + + b.ToTable("Equipped", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Account", b => + { + b.Property("GuildWars2AccountId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AccountName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ApiKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LiebUserId") + .HasColumnType("INTEGER"); + + b.HasKey("GuildWars2AccountId"); + + b.HasIndex("LiebUserId"); + + b.ToTable("GuildWars2Account", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Build", b => + { + b.Property("GuildWars2BuildId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Alacrity") + .HasColumnType("INTEGER"); + + b.Property("BuildName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("TEXT"); + + b.Property("Class") + .HasColumnType("INTEGER"); + + b.Property("EliteSpecialization") + .HasColumnType("INTEGER"); + + b.Property("Heal") + .HasColumnType("INTEGER"); + + b.Property("Might") + .HasColumnType("INTEGER"); + + b.Property("Quickness") + .HasColumnType("INTEGER"); + + b.HasKey("GuildWars2BuildId"); + + b.ToTable("GuildWars2Build", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.DiscordRaidMessage", b => + { + b.Property("DiscordRaidMessageId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DiscordChannelId") + .HasColumnType("INTEGER"); + + b.Property("DiscordGuildId") + .HasColumnType("INTEGER"); + + b.Property("DiscordMessageId") + .HasColumnType("INTEGER"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.HasKey("DiscordRaidMessageId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.ToTable("DiscordRaidMessage", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.Raid", b => + { + b.Property("RaidId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EndTimeUTC") + .HasColumnType("TEXT"); + + b.Property("FreeForAllTimeUTC") + .HasColumnType("TEXT"); + + b.Property("Guild") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("MoveFlexUsers") + .HasColumnType("INTEGER"); + + b.Property("Organizer") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RaidOwnerId") + .HasColumnType("INTEGER"); + + b.Property("RaidType") + .HasColumnType("INTEGER"); + + b.Property("RequiredRole") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StartTimeUTC") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("VoiceChat") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("RaidId"); + + b.ToTable("Raid", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidLog", b => + { + b.Property("RaidLogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("LogEntry") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.Property("Time") + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("RaidLogId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.HasIndex("UserId"); + + b.ToTable("RaidLog", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidReminder", b => + { + b.Property("RaidReminderId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DiscordChannelId") + .HasColumnType("INTEGER"); + + b.Property("DiscordServerId") + .HasColumnType("INTEGER"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.Property("ReminderTimeUTC") + .HasColumnType("TEXT"); + + b.Property("Sent") + .HasColumnType("INTEGER"); + + b.Property("TimeType") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("RaidReminderId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.ToTable("RaidReminder", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidRole", b => + { + b.Property("RaidRoleId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsRandomSignUpRole") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.Property("Spots") + .HasColumnType("INTEGER"); + + b.HasKey("RaidRoleId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.ToTable("RaidRole", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidSignUp", b => + { + b.Property("RaidSignUpId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ExternalUserName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GuildWars2AccountId") + .HasColumnType("INTEGER"); + + b.Property("LiebUserId") + .HasColumnType("INTEGER"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidRoleId") + .HasColumnType("INTEGER"); + + b.Property("SignUpType") + .HasColumnType("INTEGER"); + + b.HasKey("RaidSignUpId"); + + b.HasIndex("GuildWars2AccountId"); + + b.HasIndex("LiebUserId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidRoleId"); + + b.ToTable("RaidSignUp", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidTemplate", b => + { + b.Property("RaidTemplateId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreateDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EndTime") + .HasColumnType("TEXT"); + + b.Property("FreeForAllTime") + .HasColumnType("TEXT"); + + b.Property("Guild") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Interval") + .HasColumnType("INTEGER"); + + b.Property("MoveFlexUsers") + .HasColumnType("INTEGER"); + + b.Property("Organizer") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RaidOwnerId") + .HasColumnType("INTEGER"); + + b.Property("RaidType") + .HasColumnType("INTEGER"); + + b.Property("RequiredRole") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StartTime") + .HasColumnType("TEXT"); + + b.Property("TimeZone") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("VoiceChat") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("RaidTemplateId"); + + b.ToTable("RaidTemplate", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.LiebRole", b => + { + b.Property("LiebRoleId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Level") + .HasColumnType("INTEGER"); + + b.Property("LevelToAssign") + .HasColumnType("INTEGER"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("LiebRoleId"); + + b.ToTable("LiebRole", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.LiebUser", b => + { + b.Property("Id") + .HasColumnType("INTEGER"); + + b.Property("BannedUntil") + .HasColumnType("TEXT"); + + b.Property("Birthday") + .HasColumnType("TEXT"); + + b.Property("MainGW2Account") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT"); + + b.Property("Pronouns") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("LiebUser", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.RoleAssignment", b => + { + b.Property("RoleAssignmentId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("LiebRoleId") + .HasColumnType("INTEGER"); + + b.Property("LiebUserId") + .HasColumnType("INTEGER"); + + b.HasKey("RoleAssignmentId"); + + b.HasIndex("LiebRoleId"); + + b.HasIndex("LiebUserId"); + + b.ToTable("RoleAssignment", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Equipped", b => + { + b.HasOne("Lieb.Models.GuildWars2.GuildWars2Account", "GuildWars2Account") + .WithMany("EquippedBuilds") + .HasForeignKey("GuildWars2AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.GuildWars2Build", "GuildWars2Build") + .WithMany("EquippedRoles") + .HasForeignKey("GuildWars2BuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GuildWars2Account"); + + b.Navigation("GuildWars2Build"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Account", b => + { + b.HasOne("Lieb.Models.LiebUser", null) + .WithMany("GuildWars2Accounts") + .HasForeignKey("LiebUserId"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.DiscordRaidMessage", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("DiscordRaidMessages") + .HasForeignKey("RaidId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", null) + .WithMany("DiscordRaidMessages") + .HasForeignKey("RaidTemplateId"); + + b.Navigation("Raid"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidLog", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("RaidLogs") + .HasForeignKey("RaidId"); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", "RaidTemplate") + .WithMany("TemplateLogs") + .HasForeignKey("RaidTemplateId"); + + b.HasOne("Lieb.Models.LiebUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Raid"); + + b.Navigation("RaidTemplate"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidReminder", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("Reminders") + .HasForeignKey("RaidId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", null) + .WithMany("Reminders") + .HasForeignKey("RaidTemplateId"); + + b.Navigation("Raid"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidRole", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", null) + .WithMany("Roles") + .HasForeignKey("RaidId"); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", null) + .WithMany("Roles") + .HasForeignKey("RaidTemplateId"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidSignUp", b => + { + b.HasOne("Lieb.Models.GuildWars2.GuildWars2Account", "GuildWars2Account") + .WithMany() + .HasForeignKey("GuildWars2AccountId"); + + b.HasOne("Lieb.Models.LiebUser", "LiebUser") + .WithMany() + .HasForeignKey("LiebUserId"); + + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("SignUps") + .HasForeignKey("RaidId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidRole", "RaidRole") + .WithMany() + .HasForeignKey("RaidRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GuildWars2Account"); + + b.Navigation("LiebUser"); + + b.Navigation("Raid"); + + b.Navigation("RaidRole"); + }); + + modelBuilder.Entity("Lieb.Models.RoleAssignment", b => + { + b.HasOne("Lieb.Models.LiebRole", "LiebRole") + .WithMany("RoleAssignments") + .HasForeignKey("LiebRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.LiebUser", "LiebUser") + .WithMany("RoleAssignments") + .HasForeignKey("LiebUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LiebRole"); + + b.Navigation("LiebUser"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Account", b => + { + b.Navigation("EquippedBuilds"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Build", b => + { + b.Navigation("EquippedRoles"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.Raid", b => + { + b.Navigation("DiscordRaidMessages"); + + b.Navigation("RaidLogs"); + + b.Navigation("Reminders"); + + b.Navigation("Roles"); + + b.Navigation("SignUps"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidTemplate", b => + { + b.Navigation("DiscordRaidMessages"); + + b.Navigation("Reminders"); + + b.Navigation("Roles"); + + b.Navigation("TemplateLogs"); + }); + + modelBuilder.Entity("Lieb.Models.LiebRole", b => + { + b.Navigation("RoleAssignments"); + }); + + modelBuilder.Entity("Lieb.Models.LiebUser", b => + { + b.Navigation("GuildWars2Accounts"); + + b.Navigation("RoleAssignments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Lieb/Migrations/20221122212214_InitialCreate.cs b/Lieb/Migrations/20221122212214_InitialCreate.cs new file mode 100644 index 0000000..3ae0ecc --- /dev/null +++ b/Lieb/Migrations/20221122212214_InitialCreate.cs @@ -0,0 +1,499 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Lieb.Migrations +{ + public partial class InitialCreate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "DiscordSettings", + columns: table => new + { + DiscordSettingsId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DiscordLogChannel = table.Column(type: "INTEGER", nullable: false), + ChangeUserNames = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DiscordSettings", x => x.DiscordSettingsId); + }); + + migrationBuilder.CreateTable( + name: "GuildWars2Build", + columns: table => new + { + GuildWars2BuildId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + BuildName = table.Column(type: "TEXT", maxLength: 60, nullable: false), + Might = table.Column(type: "INTEGER", nullable: false), + Quickness = table.Column(type: "INTEGER", nullable: false), + Alacrity = table.Column(type: "INTEGER", nullable: false), + Heal = table.Column(type: "INTEGER", nullable: false), + Class = table.Column(type: "INTEGER", nullable: false), + EliteSpecialization = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_GuildWars2Build", x => x.GuildWars2BuildId); + }); + + migrationBuilder.CreateTable( + name: "LiebRole", + columns: table => new + { + LiebRoleId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleName = table.Column(type: "TEXT", maxLength: 40, nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + Level = table.Column(type: "INTEGER", nullable: false), + LevelToAssign = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LiebRole", x => x.LiebRoleId); + }); + + migrationBuilder.CreateTable( + name: "LiebUser", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 40, nullable: false), + Pronouns = table.Column(type: "TEXT", maxLength: 60, nullable: false), + Birthday = table.Column(type: "TEXT", nullable: true), + BannedUntil = table.Column(type: "TEXT", nullable: true), + MainGW2Account = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LiebUser", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Raid", + columns: table => new + { + RaidId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + StartTimeUTC = table.Column(type: "TEXT", nullable: false), + EndTimeUTC = table.Column(type: "TEXT", nullable: false), + FreeForAllTimeUTC = table.Column(type: "TEXT", nullable: false), + Title = table.Column(type: "TEXT", maxLength: 100, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 1000, nullable: false), + Organizer = table.Column(type: "TEXT", maxLength: 50, nullable: false), + Guild = table.Column(type: "TEXT", maxLength: 50, nullable: false), + VoiceChat = table.Column(type: "TEXT", maxLength: 50, nullable: false), + RaidType = table.Column(type: "INTEGER", nullable: false), + RequiredRole = table.Column(type: "TEXT", nullable: false), + MoveFlexUsers = table.Column(type: "INTEGER", nullable: false), + RaidOwnerId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Raid", x => x.RaidId); + }); + + migrationBuilder.CreateTable( + name: "RaidTemplate", + columns: table => new + { + RaidTemplateId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + StartTime = table.Column(type: "TEXT", nullable: false), + EndTime = table.Column(type: "TEXT", nullable: false), + FreeForAllTime = table.Column(type: "TEXT", nullable: false), + TimeZone = table.Column(type: "TEXT", nullable: false), + Interval = table.Column(type: "INTEGER", nullable: false), + CreateDaysBefore = table.Column(type: "INTEGER", nullable: false), + Title = table.Column(type: "TEXT", maxLength: 100, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 1000, nullable: false), + Organizer = table.Column(type: "TEXT", maxLength: 50, nullable: false), + Guild = table.Column(type: "TEXT", maxLength: 50, nullable: false), + VoiceChat = table.Column(type: "TEXT", maxLength: 50, nullable: false), + RaidType = table.Column(type: "INTEGER", nullable: false), + RequiredRole = table.Column(type: "TEXT", nullable: false), + MoveFlexUsers = table.Column(type: "INTEGER", nullable: false), + RaidOwnerId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RaidTemplate", x => x.RaidTemplateId); + }); + + migrationBuilder.CreateTable( + name: "GuildWars2Account", + columns: table => new + { + GuildWars2AccountId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ApiKey = table.Column(type: "TEXT", nullable: false), + AccountName = table.Column(type: "TEXT", nullable: false), + LiebUserId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GuildWars2Account", x => x.GuildWars2AccountId); + table.ForeignKey( + name: "FK_GuildWars2Account_LiebUser_LiebUserId", + column: x => x.LiebUserId, + principalTable: "LiebUser", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "RoleAssignment", + columns: table => new + { + RoleAssignmentId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + LiebRoleId = table.Column(type: "INTEGER", nullable: false), + LiebUserId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RoleAssignment", x => x.RoleAssignmentId); + table.ForeignKey( + name: "FK_RoleAssignment_LiebRole_LiebRoleId", + column: x => x.LiebRoleId, + principalTable: "LiebRole", + principalColumn: "LiebRoleId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RoleAssignment_LiebUser_LiebUserId", + column: x => x.LiebUserId, + principalTable: "LiebUser", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DiscordRaidMessage", + columns: table => new + { + DiscordRaidMessageId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RaidId = table.Column(type: "INTEGER", nullable: false), + DiscordMessageId = table.Column(type: "INTEGER", nullable: false), + DiscordChannelId = table.Column(type: "INTEGER", nullable: false), + DiscordGuildId = table.Column(type: "INTEGER", nullable: false), + RaidTemplateId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DiscordRaidMessage", x => x.DiscordRaidMessageId); + table.ForeignKey( + name: "FK_DiscordRaidMessage_Raid_RaidId", + column: x => x.RaidId, + principalTable: "Raid", + principalColumn: "RaidId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_DiscordRaidMessage_RaidTemplate_RaidTemplateId", + column: x => x.RaidTemplateId, + principalTable: "RaidTemplate", + principalColumn: "RaidTemplateId"); + }); + + migrationBuilder.CreateTable( + name: "RaidLog", + columns: table => new + { + RaidLogId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Type = table.Column(type: "INTEGER", nullable: false), + UserId = table.Column(type: "INTEGER", nullable: false), + RaidId = table.Column(type: "INTEGER", nullable: true), + RaidTemplateId = table.Column(type: "INTEGER", nullable: true), + LogEntry = table.Column(type: "TEXT", nullable: false), + Time = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RaidLog", x => x.RaidLogId); + table.ForeignKey( + name: "FK_RaidLog_LiebUser_UserId", + column: x => x.UserId, + principalTable: "LiebUser", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RaidLog_Raid_RaidId", + column: x => x.RaidId, + principalTable: "Raid", + principalColumn: "RaidId"); + table.ForeignKey( + name: "FK_RaidLog_RaidTemplate_RaidTemplateId", + column: x => x.RaidTemplateId, + principalTable: "RaidTemplate", + principalColumn: "RaidTemplateId"); + }); + + migrationBuilder.CreateTable( + name: "RaidReminder", + columns: table => new + { + RaidReminderId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Type = table.Column(type: "INTEGER", nullable: false), + TimeType = table.Column(type: "INTEGER", nullable: false), + Message = table.Column(type: "TEXT", maxLength: 1000, nullable: false), + ReminderTimeUTC = table.Column(type: "TEXT", nullable: false), + DiscordServerId = table.Column(type: "INTEGER", nullable: false), + DiscordChannelId = table.Column(type: "INTEGER", nullable: false), + Sent = table.Column(type: "INTEGER", nullable: false), + RaidId = table.Column(type: "INTEGER", nullable: false), + RaidTemplateId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RaidReminder", x => x.RaidReminderId); + table.ForeignKey( + name: "FK_RaidReminder_Raid_RaidId", + column: x => x.RaidId, + principalTable: "Raid", + principalColumn: "RaidId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RaidReminder_RaidTemplate_RaidTemplateId", + column: x => x.RaidTemplateId, + principalTable: "RaidTemplate", + principalColumn: "RaidTemplateId"); + }); + + migrationBuilder.CreateTable( + name: "RaidRole", + columns: table => new + { + RaidRoleId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Spots = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 40, nullable: false), + Description = table.Column(type: "TEXT", maxLength: 200, nullable: false), + IsRandomSignUpRole = table.Column(type: "INTEGER", nullable: false), + RaidId = table.Column(type: "INTEGER", nullable: true), + RaidTemplateId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RaidRole", x => x.RaidRoleId); + table.ForeignKey( + name: "FK_RaidRole_Raid_RaidId", + column: x => x.RaidId, + principalTable: "Raid", + principalColumn: "RaidId"); + table.ForeignKey( + name: "FK_RaidRole_RaidTemplate_RaidTemplateId", + column: x => x.RaidTemplateId, + principalTable: "RaidTemplate", + principalColumn: "RaidTemplateId"); + }); + + migrationBuilder.CreateTable( + name: "Equipped", + columns: table => new + { + EquippedId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CanTank = table.Column(type: "INTEGER", nullable: false), + GuildWars2AccountId = table.Column(type: "INTEGER", nullable: false), + GuildWars2BuildId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Equipped", x => x.EquippedId); + table.ForeignKey( + name: "FK_Equipped_GuildWars2Account_GuildWars2AccountId", + column: x => x.GuildWars2AccountId, + principalTable: "GuildWars2Account", + principalColumn: "GuildWars2AccountId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Equipped_GuildWars2Build_GuildWars2BuildId", + column: x => x.GuildWars2BuildId, + principalTable: "GuildWars2Build", + principalColumn: "GuildWars2BuildId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "RaidSignUp", + columns: table => new + { + RaidSignUpId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RaidId = table.Column(type: "INTEGER", nullable: false), + LiebUserId = table.Column(type: "INTEGER", nullable: true), + GuildWars2AccountId = table.Column(type: "INTEGER", nullable: true), + RaidRoleId = table.Column(type: "INTEGER", nullable: false), + ExternalUserName = table.Column(type: "TEXT", nullable: false), + SignUpType = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RaidSignUp", x => x.RaidSignUpId); + table.ForeignKey( + name: "FK_RaidSignUp_GuildWars2Account_GuildWars2AccountId", + column: x => x.GuildWars2AccountId, + principalTable: "GuildWars2Account", + principalColumn: "GuildWars2AccountId"); + table.ForeignKey( + name: "FK_RaidSignUp_LiebUser_LiebUserId", + column: x => x.LiebUserId, + principalTable: "LiebUser", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_RaidSignUp_Raid_RaidId", + column: x => x.RaidId, + principalTable: "Raid", + principalColumn: "RaidId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RaidSignUp_RaidRole_RaidRoleId", + column: x => x.RaidRoleId, + principalTable: "RaidRole", + principalColumn: "RaidRoleId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_DiscordRaidMessage_RaidId", + table: "DiscordRaidMessage", + column: "RaidId"); + + migrationBuilder.CreateIndex( + name: "IX_DiscordRaidMessage_RaidTemplateId", + table: "DiscordRaidMessage", + column: "RaidTemplateId"); + + migrationBuilder.CreateIndex( + name: "IX_Equipped_GuildWars2AccountId", + table: "Equipped", + column: "GuildWars2AccountId"); + + migrationBuilder.CreateIndex( + name: "IX_Equipped_GuildWars2BuildId", + table: "Equipped", + column: "GuildWars2BuildId"); + + migrationBuilder.CreateIndex( + name: "IX_GuildWars2Account_LiebUserId", + table: "GuildWars2Account", + column: "LiebUserId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidLog_RaidId", + table: "RaidLog", + column: "RaidId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidLog_RaidTemplateId", + table: "RaidLog", + column: "RaidTemplateId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidLog_UserId", + table: "RaidLog", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidReminder_RaidId", + table: "RaidReminder", + column: "RaidId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidReminder_RaidTemplateId", + table: "RaidReminder", + column: "RaidTemplateId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidRole_RaidId", + table: "RaidRole", + column: "RaidId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidRole_RaidTemplateId", + table: "RaidRole", + column: "RaidTemplateId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidSignUp_GuildWars2AccountId", + table: "RaidSignUp", + column: "GuildWars2AccountId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidSignUp_LiebUserId", + table: "RaidSignUp", + column: "LiebUserId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidSignUp_RaidId", + table: "RaidSignUp", + column: "RaidId"); + + migrationBuilder.CreateIndex( + name: "IX_RaidSignUp_RaidRoleId", + table: "RaidSignUp", + column: "RaidRoleId"); + + migrationBuilder.CreateIndex( + name: "IX_RoleAssignment_LiebRoleId", + table: "RoleAssignment", + column: "LiebRoleId"); + + migrationBuilder.CreateIndex( + name: "IX_RoleAssignment_LiebUserId", + table: "RoleAssignment", + column: "LiebUserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DiscordRaidMessage"); + + migrationBuilder.DropTable( + name: "DiscordSettings"); + + migrationBuilder.DropTable( + name: "Equipped"); + + migrationBuilder.DropTable( + name: "RaidLog"); + + migrationBuilder.DropTable( + name: "RaidReminder"); + + migrationBuilder.DropTable( + name: "RaidSignUp"); + + migrationBuilder.DropTable( + name: "RoleAssignment"); + + migrationBuilder.DropTable( + name: "GuildWars2Build"); + + migrationBuilder.DropTable( + name: "GuildWars2Account"); + + migrationBuilder.DropTable( + name: "RaidRole"); + + migrationBuilder.DropTable( + name: "LiebRole"); + + migrationBuilder.DropTable( + name: "LiebUser"); + + migrationBuilder.DropTable( + name: "Raid"); + + migrationBuilder.DropTable( + name: "RaidTemplate"); + } + } +} diff --git a/Lieb/Migrations/LiebContextModelSnapshot.cs b/Lieb/Migrations/LiebContextModelSnapshot.cs new file mode 100644 index 0000000..ec70dda --- /dev/null +++ b/Lieb/Migrations/LiebContextModelSnapshot.cs @@ -0,0 +1,693 @@ +// +using System; +using Lieb.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Lieb.Migrations +{ + [DbContext(typeof(LiebContext))] + partial class LiebContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.10"); + + modelBuilder.Entity("Lieb.Models.DiscordSettings", b => + { + b.Property("DiscordSettingsId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChangeUserNames") + .HasColumnType("INTEGER"); + + b.Property("DiscordLogChannel") + .HasColumnType("INTEGER"); + + b.HasKey("DiscordSettingsId"); + + b.ToTable("DiscordSettings", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Equipped", b => + { + b.Property("EquippedId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CanTank") + .HasColumnType("INTEGER"); + + b.Property("GuildWars2AccountId") + .HasColumnType("INTEGER"); + + b.Property("GuildWars2BuildId") + .HasColumnType("INTEGER"); + + b.HasKey("EquippedId"); + + b.HasIndex("GuildWars2AccountId"); + + b.HasIndex("GuildWars2BuildId"); + + b.ToTable("Equipped", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Account", b => + { + b.Property("GuildWars2AccountId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AccountName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ApiKey") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LiebUserId") + .HasColumnType("INTEGER"); + + b.HasKey("GuildWars2AccountId"); + + b.HasIndex("LiebUserId"); + + b.ToTable("GuildWars2Account", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Build", b => + { + b.Property("GuildWars2BuildId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Alacrity") + .HasColumnType("INTEGER"); + + b.Property("BuildName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("TEXT"); + + b.Property("Class") + .HasColumnType("INTEGER"); + + b.Property("EliteSpecialization") + .HasColumnType("INTEGER"); + + b.Property("Heal") + .HasColumnType("INTEGER"); + + b.Property("Might") + .HasColumnType("INTEGER"); + + b.Property("Quickness") + .HasColumnType("INTEGER"); + + b.HasKey("GuildWars2BuildId"); + + b.ToTable("GuildWars2Build", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.DiscordRaidMessage", b => + { + b.Property("DiscordRaidMessageId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DiscordChannelId") + .HasColumnType("INTEGER"); + + b.Property("DiscordGuildId") + .HasColumnType("INTEGER"); + + b.Property("DiscordMessageId") + .HasColumnType("INTEGER"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.HasKey("DiscordRaidMessageId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.ToTable("DiscordRaidMessage", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.Raid", b => + { + b.Property("RaidId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EndTimeUTC") + .HasColumnType("TEXT"); + + b.Property("FreeForAllTimeUTC") + .HasColumnType("TEXT"); + + b.Property("Guild") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("MoveFlexUsers") + .HasColumnType("INTEGER"); + + b.Property("Organizer") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RaidOwnerId") + .HasColumnType("INTEGER"); + + b.Property("RaidType") + .HasColumnType("INTEGER"); + + b.Property("RequiredRole") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StartTimeUTC") + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("VoiceChat") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("RaidId"); + + b.ToTable("Raid", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidLog", b => + { + b.Property("RaidLogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("LogEntry") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.Property("Time") + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("RaidLogId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.HasIndex("UserId"); + + b.ToTable("RaidLog", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidReminder", b => + { + b.Property("RaidReminderId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DiscordChannelId") + .HasColumnType("INTEGER"); + + b.Property("DiscordServerId") + .HasColumnType("INTEGER"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.Property("ReminderTimeUTC") + .HasColumnType("TEXT"); + + b.Property("Sent") + .HasColumnType("INTEGER"); + + b.Property("TimeType") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("RaidReminderId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.ToTable("RaidReminder", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidRole", b => + { + b.Property("RaidRoleId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("IsRandomSignUpRole") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidTemplateId") + .HasColumnType("INTEGER"); + + b.Property("Spots") + .HasColumnType("INTEGER"); + + b.HasKey("RaidRoleId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidTemplateId"); + + b.ToTable("RaidRole", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidSignUp", b => + { + b.Property("RaidSignUpId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ExternalUserName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("GuildWars2AccountId") + .HasColumnType("INTEGER"); + + b.Property("LiebUserId") + .HasColumnType("INTEGER"); + + b.Property("RaidId") + .HasColumnType("INTEGER"); + + b.Property("RaidRoleId") + .HasColumnType("INTEGER"); + + b.Property("SignUpType") + .HasColumnType("INTEGER"); + + b.HasKey("RaidSignUpId"); + + b.HasIndex("GuildWars2AccountId"); + + b.HasIndex("LiebUserId"); + + b.HasIndex("RaidId"); + + b.HasIndex("RaidRoleId"); + + b.ToTable("RaidSignUp", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidTemplate", b => + { + b.Property("RaidTemplateId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreateDaysBefore") + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("TEXT"); + + b.Property("EndTime") + .HasColumnType("TEXT"); + + b.Property("FreeForAllTime") + .HasColumnType("TEXT"); + + b.Property("Guild") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Interval") + .HasColumnType("INTEGER"); + + b.Property("MoveFlexUsers") + .HasColumnType("INTEGER"); + + b.Property("Organizer") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("RaidOwnerId") + .HasColumnType("INTEGER"); + + b.Property("RaidType") + .HasColumnType("INTEGER"); + + b.Property("RequiredRole") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("StartTime") + .HasColumnType("TEXT"); + + b.Property("TimeZone") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("VoiceChat") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("RaidTemplateId"); + + b.ToTable("RaidTemplate", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.LiebRole", b => + { + b.Property("LiebRoleId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Level") + .HasColumnType("INTEGER"); + + b.Property("LevelToAssign") + .HasColumnType("INTEGER"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("LiebRoleId"); + + b.ToTable("LiebRole", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.LiebUser", b => + { + b.Property("Id") + .HasColumnType("INTEGER"); + + b.Property("BannedUntil") + .HasColumnType("TEXT"); + + b.Property("Birthday") + .HasColumnType("TEXT"); + + b.Property("MainGW2Account") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT"); + + b.Property("Pronouns") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("LiebUser", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.RoleAssignment", b => + { + b.Property("RoleAssignmentId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("LiebRoleId") + .HasColumnType("INTEGER"); + + b.Property("LiebUserId") + .HasColumnType("INTEGER"); + + b.HasKey("RoleAssignmentId"); + + b.HasIndex("LiebRoleId"); + + b.HasIndex("LiebUserId"); + + b.ToTable("RoleAssignment", (string)null); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Equipped", b => + { + b.HasOne("Lieb.Models.GuildWars2.GuildWars2Account", "GuildWars2Account") + .WithMany("EquippedBuilds") + .HasForeignKey("GuildWars2AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.GuildWars2Build", "GuildWars2Build") + .WithMany("EquippedRoles") + .HasForeignKey("GuildWars2BuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GuildWars2Account"); + + b.Navigation("GuildWars2Build"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Account", b => + { + b.HasOne("Lieb.Models.LiebUser", null) + .WithMany("GuildWars2Accounts") + .HasForeignKey("LiebUserId"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.DiscordRaidMessage", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("DiscordRaidMessages") + .HasForeignKey("RaidId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", null) + .WithMany("DiscordRaidMessages") + .HasForeignKey("RaidTemplateId"); + + b.Navigation("Raid"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidLog", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("RaidLogs") + .HasForeignKey("RaidId"); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", "RaidTemplate") + .WithMany("TemplateLogs") + .HasForeignKey("RaidTemplateId"); + + b.HasOne("Lieb.Models.LiebUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Raid"); + + b.Navigation("RaidTemplate"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidReminder", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("Reminders") + .HasForeignKey("RaidId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", null) + .WithMany("Reminders") + .HasForeignKey("RaidTemplateId"); + + b.Navigation("Raid"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidRole", b => + { + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", null) + .WithMany("Roles") + .HasForeignKey("RaidId"); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidTemplate", null) + .WithMany("Roles") + .HasForeignKey("RaidTemplateId"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidSignUp", b => + { + b.HasOne("Lieb.Models.GuildWars2.GuildWars2Account", "GuildWars2Account") + .WithMany() + .HasForeignKey("GuildWars2AccountId"); + + b.HasOne("Lieb.Models.LiebUser", "LiebUser") + .WithMany() + .HasForeignKey("LiebUserId"); + + b.HasOne("Lieb.Models.GuildWars2.Raid.Raid", "Raid") + .WithMany("SignUps") + .HasForeignKey("RaidId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.GuildWars2.Raid.RaidRole", "RaidRole") + .WithMany() + .HasForeignKey("RaidRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GuildWars2Account"); + + b.Navigation("LiebUser"); + + b.Navigation("Raid"); + + b.Navigation("RaidRole"); + }); + + modelBuilder.Entity("Lieb.Models.RoleAssignment", b => + { + b.HasOne("Lieb.Models.LiebRole", "LiebRole") + .WithMany("RoleAssignments") + .HasForeignKey("LiebRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lieb.Models.LiebUser", "LiebUser") + .WithMany("RoleAssignments") + .HasForeignKey("LiebUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LiebRole"); + + b.Navigation("LiebUser"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Account", b => + { + b.Navigation("EquippedBuilds"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Build", b => + { + b.Navigation("EquippedRoles"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.Raid", b => + { + b.Navigation("DiscordRaidMessages"); + + b.Navigation("RaidLogs"); + + b.Navigation("Reminders"); + + b.Navigation("Roles"); + + b.Navigation("SignUps"); + }); + + modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidTemplate", b => + { + b.Navigation("DiscordRaidMessages"); + + b.Navigation("Reminders"); + + b.Navigation("Roles"); + + b.Navigation("TemplateLogs"); + }); + + modelBuilder.Entity("Lieb.Models.LiebRole", b => + { + b.Navigation("RoleAssignments"); + }); + + modelBuilder.Entity("Lieb.Models.LiebUser", b => + { + b.Navigation("GuildWars2Accounts"); + + b.Navigation("RoleAssignments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Lieb/Migrations/readme.txt b/Lieb/Migrations/readme.txt new file mode 100644 index 0000000..5261ae2 --- /dev/null +++ b/Lieb/Migrations/readme.txt @@ -0,0 +1,7 @@ +https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/migrations?view=aspnetcore-6.0&tabs=visual-studio-code + +open ProjectFolder in Terminal +dotnet ef migrations add InitialCreate + +remove migrations with +dotnet ef migrations remove \ No newline at end of file diff --git a/Lieb/Program.cs b/Lieb/Program.cs index 75e3c23..776f58d 100644 --- a/Lieb/Program.cs +++ b/Lieb/Program.cs @@ -101,7 +101,7 @@ using (var scope = app.Services.CreateScope()) var services = scope.ServiceProvider; var context = services.GetRequiredService(); - context.Database.EnsureCreated(); + context.Database.Migrate(); DbInitializer.Initialize(context); }