added database migrations

This commit is contained in:
Sarah Faey 2022-11-22 22:37:24 +01:00
parent 17d8983fb0
commit f4cf2620d9
6 changed files with 1897 additions and 3 deletions

View file

@ -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<GuildWars2Account>(){ linaith, sarah} },
//new LiebUser{Id=194863625477816321, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List<GuildWars2Account>(){ linaith, sarah} },
//new LiebUser{Id=0, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List<GuildWars2Account>(){ linaith, sarah} },
new LiebUser{Id=194863625477816321, Name="Sarah", Birthday=DateTime.Parse("1992-01-15"), GuildWars2Accounts = new List<GuildWars2Account>(){ linaith, sarah} },
#if DEBUG
//new LiebUser{Id=194455125769715713, Name="Lisa", GuildWars2Accounts = new List<GuildWars2Account>(){ hierpiepts}},
new LiebUser{Id=1, Name="Lisa", GuildWars2Accounts = new List<GuildWars2Account>(){ hierpiepts}},

View file

@ -0,0 +1,695 @@
// <auto-generated />
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<ulong>("DiscordSettingsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("ChangeUserNames")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordLogChannel")
.HasColumnType("INTEGER");
b.HasKey("DiscordSettingsId");
b.ToTable("DiscordSettings", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.Equipped", b =>
{
b.Property<int>("EquippedId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("CanTank")
.HasColumnType("INTEGER");
b.Property<int>("GuildWars2AccountId")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("GuildWars2AccountId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AccountName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ApiKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<ulong?>("LiebUserId")
.HasColumnType("INTEGER");
b.HasKey("GuildWars2AccountId");
b.HasIndex("LiebUserId");
b.ToTable("GuildWars2Account", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Build", b =>
{
b.Property<int>("GuildWars2BuildId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<short>("Alacrity")
.HasColumnType("INTEGER");
b.Property<string>("BuildName")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<int>("EliteSpecialization")
.HasColumnType("INTEGER");
b.Property<short>("Heal")
.HasColumnType("INTEGER");
b.Property<short>("Might")
.HasColumnType("INTEGER");
b.Property<short>("Quickness")
.HasColumnType("INTEGER");
b.HasKey("GuildWars2BuildId");
b.ToTable("GuildWars2Build", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.DiscordRaidMessage", b =>
{
b.Property<int>("DiscordRaidMessageId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordChannelId")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordGuildId")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordMessageId")
.HasColumnType("INTEGER");
b.Property<int>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("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<int>("RaidId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("EndTimeUTC")
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("FreeForAllTimeUTC")
.HasColumnType("TEXT");
b.Property<string>("Guild")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<bool>("MoveFlexUsers")
.HasColumnType("INTEGER");
b.Property<string>("Organizer")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<ulong>("RaidOwnerId")
.HasColumnType("INTEGER");
b.Property<int>("RaidType")
.HasColumnType("INTEGER");
b.Property<string>("RequiredRole")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("StartTimeUTC")
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("VoiceChat")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("RaidId");
b.ToTable("Raid", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidLog", b =>
{
b.Property<int>("RaidLogId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("LogEntry")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("RaidTemplateId")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset>("Time")
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<ulong>("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<int>("RaidReminderId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordChannelId")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordServerId")
.HasColumnType("INTEGER");
b.Property<string>("Message")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("RaidTemplateId")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset>("ReminderTimeUTC")
.HasColumnType("TEXT");
b.Property<bool>("Sent")
.HasColumnType("INTEGER");
b.Property<int>("TimeType")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("RaidRoleId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<bool>("IsRandomSignUpRole")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.Property<int?>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("RaidTemplateId")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("RaidSignUpId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ExternalUserName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("GuildWars2AccountId")
.HasColumnType("INTEGER");
b.Property<ulong?>("LiebUserId")
.HasColumnType("INTEGER");
b.Property<int>("RaidId")
.HasColumnType("INTEGER");
b.Property<int>("RaidRoleId")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("RaidTemplateId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CreateDaysBefore")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<DateTime>("EndTime")
.HasColumnType("TEXT");
b.Property<DateTime>("FreeForAllTime")
.HasColumnType("TEXT");
b.Property<string>("Guild")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("Interval")
.HasColumnType("INTEGER");
b.Property<bool>("MoveFlexUsers")
.HasColumnType("INTEGER");
b.Property<string>("Organizer")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<ulong>("RaidOwnerId")
.HasColumnType("INTEGER");
b.Property<int>("RaidType")
.HasColumnType("INTEGER");
b.Property<string>("RequiredRole")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("StartTime")
.HasColumnType("TEXT");
b.Property<string>("TimeZone")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("VoiceChat")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("RaidTemplateId");
b.ToTable("RaidTemplate", (string)null);
});
modelBuilder.Entity("Lieb.Models.LiebRole", b =>
{
b.Property<int>("LiebRoleId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Level")
.HasColumnType("INTEGER");
b.Property<int>("LevelToAssign")
.HasColumnType("INTEGER");
b.Property<string>("RoleName")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("LiebRoleId");
b.ToTable("LiebRole", (string)null);
});
modelBuilder.Entity("Lieb.Models.LiebUser", b =>
{
b.Property<ulong>("Id")
.HasColumnType("INTEGER");
b.Property<DateTime?>("BannedUntil")
.HasColumnType("TEXT");
b.Property<DateTime?>("Birthday")
.HasColumnType("TEXT");
b.Property<int>("MainGW2Account")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.Property<string>("Pronouns")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("LiebUser", (string)null);
});
modelBuilder.Entity("Lieb.Models.RoleAssignment", b =>
{
b.Property<int>("RoleAssignmentId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("LiebRoleId")
.HasColumnType("INTEGER");
b.Property<ulong>("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
}
}
}

View file

@ -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<ulong>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DiscordLogChannel = table.Column<ulong>(type: "INTEGER", nullable: false),
ChangeUserNames = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DiscordSettings", x => x.DiscordSettingsId);
});
migrationBuilder.CreateTable(
name: "GuildWars2Build",
columns: table => new
{
GuildWars2BuildId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
BuildName = table.Column<string>(type: "TEXT", maxLength: 60, nullable: false),
Might = table.Column<short>(type: "INTEGER", nullable: false),
Quickness = table.Column<short>(type: "INTEGER", nullable: false),
Alacrity = table.Column<short>(type: "INTEGER", nullable: false),
Heal = table.Column<short>(type: "INTEGER", nullable: false),
Class = table.Column<int>(type: "INTEGER", nullable: false),
EliteSpecialization = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GuildWars2Build", x => x.GuildWars2BuildId);
});
migrationBuilder.CreateTable(
name: "LiebRole",
columns: table => new
{
LiebRoleId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RoleName = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
Level = table.Column<int>(type: "INTEGER", nullable: false),
LevelToAssign = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LiebRole", x => x.LiebRoleId);
});
migrationBuilder.CreateTable(
name: "LiebUser",
columns: table => new
{
Id = table.Column<ulong>(type: "INTEGER", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
Pronouns = table.Column<string>(type: "TEXT", maxLength: 60, nullable: false),
Birthday = table.Column<DateTime>(type: "TEXT", nullable: true),
BannedUntil = table.Column<DateTime>(type: "TEXT", nullable: true),
MainGW2Account = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LiebUser", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Raid",
columns: table => new
{
RaidId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
StartTimeUTC = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
EndTimeUTC = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
FreeForAllTimeUTC = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
Title = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: false),
Organizer = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Guild = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
VoiceChat = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
RaidType = table.Column<int>(type: "INTEGER", nullable: false),
RequiredRole = table.Column<string>(type: "TEXT", nullable: false),
MoveFlexUsers = table.Column<bool>(type: "INTEGER", nullable: false),
RaidOwnerId = table.Column<ulong>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Raid", x => x.RaidId);
});
migrationBuilder.CreateTable(
name: "RaidTemplate",
columns: table => new
{
RaidTemplateId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
StartTime = table.Column<DateTime>(type: "TEXT", nullable: false),
EndTime = table.Column<DateTime>(type: "TEXT", nullable: false),
FreeForAllTime = table.Column<DateTime>(type: "TEXT", nullable: false),
TimeZone = table.Column<string>(type: "TEXT", nullable: false),
Interval = table.Column<int>(type: "INTEGER", nullable: false),
CreateDaysBefore = table.Column<int>(type: "INTEGER", nullable: false),
Title = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: false),
Organizer = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
Guild = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
VoiceChat = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
RaidType = table.Column<int>(type: "INTEGER", nullable: false),
RequiredRole = table.Column<string>(type: "TEXT", nullable: false),
MoveFlexUsers = table.Column<bool>(type: "INTEGER", nullable: false),
RaidOwnerId = table.Column<ulong>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RaidTemplate", x => x.RaidTemplateId);
});
migrationBuilder.CreateTable(
name: "GuildWars2Account",
columns: table => new
{
GuildWars2AccountId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ApiKey = table.Column<string>(type: "TEXT", nullable: false),
AccountName = table.Column<string>(type: "TEXT", nullable: false),
LiebUserId = table.Column<ulong>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
LiebRoleId = table.Column<int>(type: "INTEGER", nullable: false),
LiebUserId = table.Column<ulong>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RaidId = table.Column<int>(type: "INTEGER", nullable: false),
DiscordMessageId = table.Column<ulong>(type: "INTEGER", nullable: false),
DiscordChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
DiscordGuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
RaidTemplateId = table.Column<int>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Type = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<ulong>(type: "INTEGER", nullable: false),
RaidId = table.Column<int>(type: "INTEGER", nullable: true),
RaidTemplateId = table.Column<int>(type: "INTEGER", nullable: true),
LogEntry = table.Column<string>(type: "TEXT", nullable: false),
Time = table.Column<DateTimeOffset>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Type = table.Column<int>(type: "INTEGER", nullable: false),
TimeType = table.Column<int>(type: "INTEGER", nullable: false),
Message = table.Column<string>(type: "TEXT", maxLength: 1000, nullable: false),
ReminderTimeUTC = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
DiscordServerId = table.Column<ulong>(type: "INTEGER", nullable: false),
DiscordChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
Sent = table.Column<bool>(type: "INTEGER", nullable: false),
RaidId = table.Column<int>(type: "INTEGER", nullable: false),
RaidTemplateId = table.Column<int>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Spots = table.Column<int>(type: "INTEGER", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
IsRandomSignUpRole = table.Column<bool>(type: "INTEGER", nullable: false),
RaidId = table.Column<int>(type: "INTEGER", nullable: true),
RaidTemplateId = table.Column<int>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CanTank = table.Column<bool>(type: "INTEGER", nullable: false),
GuildWars2AccountId = table.Column<int>(type: "INTEGER", nullable: false),
GuildWars2BuildId = table.Column<int>(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<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
RaidId = table.Column<int>(type: "INTEGER", nullable: false),
LiebUserId = table.Column<ulong>(type: "INTEGER", nullable: true),
GuildWars2AccountId = table.Column<int>(type: "INTEGER", nullable: true),
RaidRoleId = table.Column<int>(type: "INTEGER", nullable: false),
ExternalUserName = table.Column<string>(type: "TEXT", nullable: false),
SignUpType = table.Column<int>(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");
}
}
}

View file

@ -0,0 +1,693 @@
// <auto-generated />
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<ulong>("DiscordSettingsId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("ChangeUserNames")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordLogChannel")
.HasColumnType("INTEGER");
b.HasKey("DiscordSettingsId");
b.ToTable("DiscordSettings", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.Equipped", b =>
{
b.Property<int>("EquippedId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("CanTank")
.HasColumnType("INTEGER");
b.Property<int>("GuildWars2AccountId")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("GuildWars2AccountId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AccountName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ApiKey")
.IsRequired()
.HasColumnType("TEXT");
b.Property<ulong?>("LiebUserId")
.HasColumnType("INTEGER");
b.HasKey("GuildWars2AccountId");
b.HasIndex("LiebUserId");
b.ToTable("GuildWars2Account", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.GuildWars2Build", b =>
{
b.Property<int>("GuildWars2BuildId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<short>("Alacrity")
.HasColumnType("INTEGER");
b.Property<string>("BuildName")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<int>("EliteSpecialization")
.HasColumnType("INTEGER");
b.Property<short>("Heal")
.HasColumnType("INTEGER");
b.Property<short>("Might")
.HasColumnType("INTEGER");
b.Property<short>("Quickness")
.HasColumnType("INTEGER");
b.HasKey("GuildWars2BuildId");
b.ToTable("GuildWars2Build", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.DiscordRaidMessage", b =>
{
b.Property<int>("DiscordRaidMessageId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordChannelId")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordGuildId")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordMessageId")
.HasColumnType("INTEGER");
b.Property<int>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("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<int>("RaidId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("EndTimeUTC")
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("FreeForAllTimeUTC")
.HasColumnType("TEXT");
b.Property<string>("Guild")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<bool>("MoveFlexUsers")
.HasColumnType("INTEGER");
b.Property<string>("Organizer")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<ulong>("RaidOwnerId")
.HasColumnType("INTEGER");
b.Property<int>("RaidType")
.HasColumnType("INTEGER");
b.Property<string>("RequiredRole")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTimeOffset>("StartTimeUTC")
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("VoiceChat")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("RaidId");
b.ToTable("Raid", (string)null);
});
modelBuilder.Entity("Lieb.Models.GuildWars2.Raid.RaidLog", b =>
{
b.Property<int>("RaidLogId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("LogEntry")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("RaidTemplateId")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset>("Time")
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<ulong>("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<int>("RaidReminderId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordChannelId")
.HasColumnType("INTEGER");
b.Property<ulong>("DiscordServerId")
.HasColumnType("INTEGER");
b.Property<string>("Message")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("RaidTemplateId")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset>("ReminderTimeUTC")
.HasColumnType("TEXT");
b.Property<bool>("Sent")
.HasColumnType("INTEGER");
b.Property<int>("TimeType")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("RaidRoleId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<bool>("IsRandomSignUpRole")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.Property<int?>("RaidId")
.HasColumnType("INTEGER");
b.Property<int?>("RaidTemplateId")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("RaidSignUpId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ExternalUserName")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("GuildWars2AccountId")
.HasColumnType("INTEGER");
b.Property<ulong?>("LiebUserId")
.HasColumnType("INTEGER");
b.Property<int>("RaidId")
.HasColumnType("INTEGER");
b.Property<int>("RaidRoleId")
.HasColumnType("INTEGER");
b.Property<int>("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<int>("RaidTemplateId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CreateDaysBefore")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<DateTime>("EndTime")
.HasColumnType("TEXT");
b.Property<DateTime>("FreeForAllTime")
.HasColumnType("TEXT");
b.Property<string>("Guild")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("Interval")
.HasColumnType("INTEGER");
b.Property<bool>("MoveFlexUsers")
.HasColumnType("INTEGER");
b.Property<string>("Organizer")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<ulong>("RaidOwnerId")
.HasColumnType("INTEGER");
b.Property<int>("RaidType")
.HasColumnType("INTEGER");
b.Property<string>("RequiredRole")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("StartTime")
.HasColumnType("TEXT");
b.Property<string>("TimeZone")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("VoiceChat")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("RaidTemplateId");
b.ToTable("RaidTemplate", (string)null);
});
modelBuilder.Entity("Lieb.Models.LiebRole", b =>
{
b.Property<int>("LiebRoleId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Level")
.HasColumnType("INTEGER");
b.Property<int>("LevelToAssign")
.HasColumnType("INTEGER");
b.Property<string>("RoleName")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("LiebRoleId");
b.ToTable("LiebRole", (string)null);
});
modelBuilder.Entity("Lieb.Models.LiebUser", b =>
{
b.Property<ulong>("Id")
.HasColumnType("INTEGER");
b.Property<DateTime?>("BannedUntil")
.HasColumnType("TEXT");
b.Property<DateTime?>("Birthday")
.HasColumnType("TEXT");
b.Property<int>("MainGW2Account")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT");
b.Property<string>("Pronouns")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("LiebUser", (string)null);
});
modelBuilder.Entity("Lieb.Models.RoleAssignment", b =>
{
b.Property<int>("RoleAssignmentId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("LiebRoleId")
.HasColumnType("INTEGER");
b.Property<ulong>("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
}
}
}

View file

@ -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

View file

@ -101,7 +101,7 @@ using (var scope = app.Services.CreateScope())
var services = scope.ServiceProvider;
var context = services.GetRequiredService<LiebContext>();
context.Database.EnsureCreated();
context.Database.Migrate();
DbInitializer.Initialize(context);
}