diff --git a/ChaosBot.UnitTests/ChaosBot.UnitTests.csproj b/ChaosBot.UnitTests/ChaosBot.UnitTests.csproj index dc245de..cdada84 100644 --- a/ChaosBot.UnitTests/ChaosBot.UnitTests.csproj +++ b/ChaosBot.UnitTests/ChaosBot.UnitTests.csproj @@ -7,10 +7,15 @@ - + + + + + + diff --git a/ChaosBot/ChaosBot.csproj b/ChaosBot/ChaosBot.csproj index 442502b..cf65c22 100644 --- a/ChaosBot/ChaosBot.csproj +++ b/ChaosBot/ChaosBot.csproj @@ -9,11 +9,16 @@ + + + + - + + @@ -22,4 +27,8 @@ + + + + diff --git a/ChaosBot/Models/LodestoneCharacter.cs b/ChaosBot/Models/LodestoneCharacter.cs new file mode 100644 index 0000000..2b21535 --- /dev/null +++ b/ChaosBot/Models/LodestoneCharacter.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace ChaosBot.Models +{ + public partial class LodestoneCharacter + { + public int? Id { get; set; } + public string Name { get; set; } + public string Avatar { get; set; } + public long? UserId { get; set; } + } +} diff --git a/ChaosBot/Models/LodestoneFreeCompany.cs b/ChaosBot/Models/LodestoneFreeCompany.cs new file mode 100644 index 0000000..369ca90 --- /dev/null +++ b/ChaosBot/Models/LodestoneFreeCompany.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace ChaosBot.Models +{ + public partial class LodestoneFreeCompany + { + public string Id { get; set; } + public string Name { get; set; } + } +} diff --git a/ChaosBot/Models/PointsTable.cs b/ChaosBot/Models/PointsTable.cs new file mode 100644 index 0000000..c7695f2 --- /dev/null +++ b/ChaosBot/Models/PointsTable.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace ChaosBot.Models +{ + public partial class PointsTable + { + public int? Id { get; set; } + public int? Points { get; set; } + public long? UserId { get; set; } + public long? GuildId { get; set; } + } +} diff --git a/ChaosBot/Models/RaffleTable.cs b/ChaosBot/Models/RaffleTable.cs new file mode 100644 index 0000000..2c4b180 --- /dev/null +++ b/ChaosBot/Models/RaffleTable.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace ChaosBot.Models +{ + public partial class RaffleTable + { + public int? Id { get; set; } + public long? UserId { get; set; } + public long? GuildId { get; set; } + } +} diff --git a/ChaosBot/Models/ServerConfigurationFlag.cs b/ChaosBot/Models/ServerConfigurationFlag.cs new file mode 100644 index 0000000..5acfd9a --- /dev/null +++ b/ChaosBot/Models/ServerConfigurationFlag.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +#nullable disable + +namespace ChaosBot.Models +{ + public partial class ServerConfigurationFlag + { + public string Key { get; set; } + public string SerializedValue { get; set; } + public long? GuildId { get; set; } + } +} diff --git a/ChaosBot/Models/chaosbotContext.cs b/ChaosBot/Models/chaosbotContext.cs new file mode 100644 index 0000000..6d68ac5 --- /dev/null +++ b/ChaosBot/Models/chaosbotContext.cs @@ -0,0 +1,167 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; + +#nullable disable + +namespace ChaosBot.Models +{ + public partial class chaosbotContext : DbContext + { + public chaosbotContext() + { + } + + public chaosbotContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet LodestoneCharacters { get; set; } + public virtual DbSet LodestoneFreeCompanies { get; set; } + public virtual DbSet PointsTables { get; set; } + public virtual DbSet RaffleTables { get; set; } + public virtual DbSet ServerConfigurationFlags { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. + optionsBuilder.UseMySql($"server={Program.LoadConfiguration("Database:Host")};port={Program.LoadConfiguration("Database:Port")};user={Program.LoadConfiguration("Database:User")};password={Program.LoadConfiguration("Database:Pass")};database={Program.LoadConfiguration("Database:Name")}", x => x.ServerVersion("5.5.64-mariadb")); + } + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToTable("LodestoneCharacter"); + + entity.Property(e => e.Avatar) + .HasColumnType("text") + .HasColumnName("avatar") + .HasCharSet("latin1") + .HasCollation("latin1_swedish_ci") + .HasAnnotation("Relational:ColumnType", "text"); + + entity.Property(e => e.Id) + .HasColumnType("int(11)") + .HasColumnName("id") + .HasAnnotation("Relational:ColumnType", "int(11)"); + + entity.Property(e => e.Name) + .HasColumnType("text") + .HasColumnName("name") + .HasCharSet("latin1") + .HasCollation("latin1_swedish_ci") + .HasAnnotation("Relational:ColumnType", "text"); + + entity.Property(e => e.UserId) + .HasColumnType("bigint(20)") + .HasColumnName("userId") + .HasAnnotation("Relational:ColumnType", "bigint(20)"); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToTable("LodestoneFreeCompany"); + + entity.Property(e => e.Id) + .HasColumnType("text") + .HasColumnName("id") + .HasCharSet("latin1") + .HasCollation("latin1_swedish_ci") + .HasAnnotation("Relational:ColumnType", "text"); + + entity.Property(e => e.Name) + .HasColumnType("text") + .HasColumnName("name") + .HasCharSet("latin1") + .HasCollation("latin1_swedish_ci") + .HasAnnotation("Relational:ColumnType", "text"); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToTable("PointsTable"); + + entity.Property(e => e.GuildId) + .HasColumnType("bigint(20)") + .HasColumnName("guildId") + .HasAnnotation("Relational:ColumnType", "bigint(20)"); + + entity.Property(e => e.Id) + .HasColumnType("int(11)") + .HasColumnName("id") + .HasAnnotation("Relational:ColumnType", "int(11)"); + + entity.Property(e => e.Points) + .HasColumnType("int(11)") + .HasColumnName("points") + .HasAnnotation("Relational:ColumnType", "int(11)"); + + entity.Property(e => e.UserId) + .HasColumnType("bigint(20)") + .HasColumnName("userId") + .HasAnnotation("Relational:ColumnType", "bigint(20)"); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToTable("RaffleTable"); + + entity.Property(e => e.GuildId) + .HasColumnType("bigint(20)") + .HasColumnName("guildId") + .HasAnnotation("Relational:ColumnType", "bigint(20)"); + + entity.Property(e => e.Id) + .HasColumnType("int(11)") + .HasColumnName("id") + .HasAnnotation("Relational:ColumnType", "int(11)"); + + entity.Property(e => e.UserId) + .HasColumnType("bigint(20)") + .HasColumnName("userId") + .HasAnnotation("Relational:ColumnType", "bigint(20)"); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.Property(e => e.GuildId) + .HasColumnType("bigint(20)") + .HasColumnName("guildId") + .HasAnnotation("Relational:ColumnType", "bigint(20)"); + + entity.Property(e => e.Key) + .HasColumnType("text") + .HasColumnName("key") + .HasCharSet("latin1") + .HasCollation("latin1_swedish_ci") + .HasAnnotation("Relational:ColumnType", "text"); + + entity.Property(e => e.SerializedValue) + .HasColumnType("text") + .HasColumnName("serializedValue") + .HasCharSet("latin1") + .HasCollation("latin1_swedish_ci") + .HasAnnotation("Relational:ColumnType", "text"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); + } +}