diff --git a/MitternachtWeb/Areas/Guild/Controllers/QuotesController.cs b/MitternachtWeb/Areas/Guild/Controllers/QuotesController.cs index 2fabd244d..75c9d7c14 100644 --- a/MitternachtWeb/Areas/Guild/Controllers/QuotesController.cs +++ b/MitternachtWeb/Areas/Guild/Controllers/QuotesController.cs @@ -17,7 +17,7 @@ public QuotesController(DbService db) { public IActionResult Index() { if(PermissionReadQuotes) { using var uow = _db.UnitOfWork; - var quotes = uow.Quotes.GetAllForGuild(GuildId).Select(q => { + var quotes = uow.Quotes.GetAllForGuild(GuildId).ToList().Select(q => { var user = Guild.GetUser(q.AuthorId); return new Quote { diff --git a/MitternachtWeb/Areas/Guild/Controllers/VerificationsController.cs b/MitternachtWeb/Areas/Guild/Controllers/VerificationsController.cs index 66bf86252..44986e1fb 100644 --- a/MitternachtWeb/Areas/Guild/Controllers/VerificationsController.cs +++ b/MitternachtWeb/Areas/Guild/Controllers/VerificationsController.cs @@ -18,7 +18,7 @@ public VerificationsController(DbService db) { public IActionResult Index() { if(PermissionReadVerifications) { using var uow = _db.UnitOfWork; - var verifications = uow.VerifiedUsers.GetVerifiedUsers(GuildId).Select(v => { + var verifications = uow.VerifiedUsers.GetVerifiedUsers(GuildId).ToList().Select(v => { var user = Guild.GetUser(v.UserId); return new Verification { diff --git a/MitternachtWeb/Areas/Guild/Controllers/WarnsController.cs b/MitternachtWeb/Areas/Guild/Controllers/WarnsController.cs index b36393cfa..73c7ed5bb 100644 --- a/MitternachtWeb/Areas/Guild/Controllers/WarnsController.cs +++ b/MitternachtWeb/Areas/Guild/Controllers/WarnsController.cs @@ -19,7 +19,7 @@ public WarnsController(DbService db) { public IActionResult Index() { if(PermissionReadWarns) { using var uow = _db.UnitOfWork; - var warns = uow.Warnings.GetForGuild(GuildId).Select((Func)(w => { + var warns = uow.Warnings.GetForGuild(GuildId).ToList().Select((Func)(w => { var user = Guild.GetUser(w.UserId); return new Warn { diff --git a/src/MitternachtBot/Migrations/Mitternacht/20200703220636_InitialMigration.Designer.cs b/src/MitternachtBot/Migrations/Mitternacht/20200703220636_InitialMigration.Designer.cs new file mode 100644 index 000000000..14d77c4d4 --- /dev/null +++ b/src/MitternachtBot/Migrations/Mitternacht/20200703220636_InitialMigration.Designer.cs @@ -0,0 +1,2260 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Mitternacht.Services.Database; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Mitternacht.Migrations.Mitternacht +{ + [DbContext(typeof(MitternachtContext))] + [Migration("20200703220636_InitialMigration")] + partial class InitialMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiRaidSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Action") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Seconds") + .HasColumnType("integer"); + + b.Property("UserThreshold") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId") + .IsUnique(); + + b.ToTable("AntiRaidSetting"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamIgnore", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AntiSpamSettingId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("AntiSpamSettingId"); + + b.ToTable("AntiSpamIgnore"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Action") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("MessageThreshold") + .HasColumnType("integer"); + + b.Property("MuteTime") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId") + .IsUnique(); + + b.ToTable("AntiSpamSetting"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BirthDateModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BirthdayMessageEnabled") + .HasColumnType("boolean"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Day") + .HasColumnType("integer"); + + b.Property("Month") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("Year") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("BirthDates"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlacklistItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ItemId") + .HasColumnType("numeric(20,0)"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("BlacklistItem"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlockedCmdOrMdl", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("BotConfigId1") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.HasIndex("BotConfigId1"); + + b.ToTable("BlockedCmdOrMdl"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BotConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BetflipMultiplier") + .HasColumnType("real"); + + b.Property("Betroll100Multiplier") + .HasColumnType("real"); + + b.Property("Betroll67Multiplier") + .HasColumnType("real"); + + b.Property("Betroll91Multiplier") + .HasColumnType("real"); + + b.Property("BufferSize") + .HasColumnType("numeric(20,0)"); + + b.Property("CurrencyDropAmount") + .HasColumnType("integer"); + + b.Property("CurrencyDropAmountMax") + .HasColumnType("integer"); + + b.Property("CurrencyGenerationChance") + .HasColumnType("real"); + + b.Property("CurrencyGenerationCooldown") + .HasColumnType("integer"); + + b.Property("CurrencyName") + .HasColumnType("text"); + + b.Property("CurrencyPluralName") + .HasColumnType("text"); + + b.Property("CurrencySign") + .HasColumnType("text"); + + b.Property("CustomReactionsStartWith") + .HasColumnType("boolean"); + + b.Property("DMHelpString") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DefaultPrefix") + .HasColumnType("text"); + + b.Property("DmCommandsOwnerOnly") + .HasColumnType("boolean"); + + b.Property("ErrorColor") + .HasColumnType("text"); + + b.Property("FirstAprilHereChance") + .HasColumnType("double precision"); + + b.Property("ForwardMessages") + .HasColumnType("boolean"); + + b.Property("ForwardToAllOwners") + .HasColumnType("boolean"); + + b.Property("HelpString") + .HasColumnType("text"); + + b.Property("LastTimeBirthdaysChecked") + .HasColumnType("timestamp without time zone"); + + b.Property("Locale") + .HasColumnType("text"); + + b.Property("LogUsernames") + .HasColumnType("boolean"); + + b.Property("MigrationVersion") + .HasColumnType("integer"); + + b.Property("MinimumBetAmount") + .HasColumnType("integer"); + + b.Property("OkColor") + .HasColumnType("text"); + + b.Property("PermissionVersion") + .HasColumnType("integer"); + + b.Property("RemindMessageFormat") + .HasColumnType("text"); + + b.Property("RotatingStatuses") + .HasColumnType("boolean"); + + b.Property("TriviaCurrencyReward") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("BotConfig"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandAlias", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Mapping") + .HasColumnType("text"); + + b.Property("Trigger") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("CommandAlias"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandCooldown", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CommandName") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Seconds") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("CommandCooldown"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandPrice", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("CommandName") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Price") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.HasIndex("Price") + .IsUnique(); + + b.ToTable("CommandPrice"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Currency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Amount") + .HasColumnType("bigint"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Currency"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CurrencyTransaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Amount") + .HasColumnType("bigint"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Reason") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("CurrencyTransactions"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CustomReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AutoDeleteTrigger") + .HasColumnType("boolean"); + + b.Property("ContainsAnywhere") + .HasColumnType("boolean"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DmResponse") + .HasColumnType("boolean"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("IsRegex") + .HasColumnType("boolean"); + + b.Property("OwnerOnly") + .HasColumnType("boolean"); + + b.Property("Response") + .HasColumnType("text"); + + b.Property("Trigger") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CustomReactions"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.DailyMoney", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LastTimeGotten") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("DailyMoney"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.DailyMoneyStats", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("MoneyReceived") + .HasColumnType("bigint"); + + b.Property("TimeReceived") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("DailyMoneyStats"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Donator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Donators"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.EightBallResponse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("EightBallResponse"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilterChannelId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("GuildConfigId1") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.HasIndex("GuildConfigId1"); + + b.ToTable("FilterChannelId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilteredWord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Word") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("FilteredWord"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FollowedStream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Username") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("FollowedStream"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GCChannelId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("GCChannelId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AdditionalVerificationUsers") + .HasColumnType("text"); + + b.Property("AutoAssignRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("AutoDeleteByeMessages") + .HasColumnType("boolean"); + + b.Property("AutoDeleteByeMessagesTimer") + .HasColumnType("integer"); + + b.Property("AutoDeleteGreetMessages") + .HasColumnType("boolean"); + + b.Property("AutoDeleteGreetMessagesTimer") + .HasColumnType("integer"); + + b.Property("AutoDeleteSelfAssignedRoleMessages") + .HasColumnType("boolean"); + + b.Property("BirthdayMessage") + .HasColumnType("text"); + + b.Property("BirthdayMessageChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("BirthdayMoney") + .HasColumnType("bigint"); + + b.Property("BirthdayRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("BirthdaysEnabled") + .HasColumnType("boolean"); + + b.Property("ByeMessageChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelByeMessageText") + .HasColumnType("text"); + + b.Property("ChannelGreetMessageText") + .HasColumnType("text"); + + b.Property("CleverbotEnabled") + .HasColumnType("boolean"); + + b.Property("CountToNumberChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("CountToNumberMessageChance") + .HasColumnType("double precision"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DefaultMusicVolume") + .HasColumnType("real"); + + b.Property("DeleteMessageOnCommand") + .HasColumnType("boolean"); + + b.Property("DmGreetMessageText") + .HasColumnType("text"); + + b.Property("ExclusiveSelfAssignedRoles") + .HasColumnType("boolean"); + + b.Property("FilterInvites") + .HasColumnType("boolean"); + + b.Property("FilterWords") + .HasColumnType("boolean"); + + b.Property("FilterZalgo") + .HasColumnType("boolean"); + + b.Property("ForumNotificationChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("GameVoiceChannel") + .HasColumnType("numeric(20,0)"); + + b.Property("GommeTeamMemberRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("GreetMessageChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Locale") + .HasColumnType("text"); + + b.Property("LogSettingId") + .HasColumnType("integer"); + + b.Property("LogUsernameHistory") + .HasColumnType("boolean"); + + b.Property("MessageXpCharCountMax") + .HasColumnType("integer"); + + b.Property("MessageXpCharCountMin") + .HasColumnType("integer"); + + b.Property("MessageXpTimeDifference") + .HasColumnType("double precision"); + + b.Property("MuteRoleName") + .HasColumnType("text"); + + b.Property("PermissionRole") + .HasColumnType("text"); + + b.Property("Prefix") + .HasColumnType("text"); + + b.Property("RootPermissionId") + .HasColumnType("integer"); + + b.Property("SendChannelByeMessage") + .HasColumnType("boolean"); + + b.Property("SendChannelGreetMessage") + .HasColumnType("boolean"); + + b.Property("SendDmGreetMessage") + .HasColumnType("boolean"); + + b.Property("SupportChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("TeamUpdateChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("TeamUpdateMessagePrefix") + .HasColumnType("text"); + + b.Property("TimeZoneId") + .HasColumnType("text"); + + b.Property("TurnToXpMultiplier") + .HasColumnType("double precision"); + + b.Property("VerboseErrors") + .HasColumnType("boolean"); + + b.Property("VerbosePermissions") + .HasColumnType("boolean"); + + b.Property("VerificationPasswordChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("VerificationTutorialText") + .HasColumnType("text"); + + b.Property("VerifiedRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("VerifyString") + .HasColumnType("text"); + + b.Property("VipRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("VoicePlusTextEnabled") + .HasColumnType("boolean"); + + b.Property("WarningsInitialized") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("GuildId") + .IsUnique(); + + b.HasIndex("LogSettingId"); + + b.HasIndex("RootPermissionId"); + + b.ToTable("GuildConfigs"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildRepeater", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Interval") + .HasColumnType("interval"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("StartTimeOfDay") + .HasColumnType("interval"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("GuildRepeater"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredLogChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LogSettingId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LogSettingId"); + + b.ToTable("IgnoredLogChannel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredVoicePresenceChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LogSettingId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LogSettingId"); + + b.ToTable("IgnoredVoicePresenceChannel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.LevelModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CurrentXP") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("TotalXP") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("timestamp") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "UserId") + .IsUnique(); + + b.ToTable("LevelModel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.LogSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelCreated") + .HasColumnType("boolean"); + + b.Property("ChannelCreatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelDestroyed") + .HasColumnType("boolean"); + + b.Property("ChannelDestroyedId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelUpdated") + .HasColumnType("boolean"); + + b.Property("ChannelUpdatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("IsLogging") + .HasColumnType("boolean"); + + b.Property("LogOtherId") + .HasColumnType("numeric(20,0)"); + + b.Property("LogUserPresence") + .HasColumnType("boolean"); + + b.Property("LogUserPresenceId") + .HasColumnType("numeric(20,0)"); + + b.Property("LogVoicePresence") + .HasColumnType("boolean"); + + b.Property("LogVoicePresenceId") + .HasColumnType("numeric(20,0)"); + + b.Property("LogVoicePresenceTTSId") + .HasColumnType("numeric(20,0)"); + + b.Property("MessageDeleted") + .HasColumnType("boolean"); + + b.Property("MessageDeletedId") + .HasColumnType("numeric(20,0)"); + + b.Property("MessageUpdated") + .HasColumnType("boolean"); + + b.Property("MessageUpdatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserBanned") + .HasColumnType("boolean"); + + b.Property("UserBannedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserJoined") + .HasColumnType("boolean"); + + b.Property("UserJoinedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserLeft") + .HasColumnType("boolean"); + + b.Property("UserLeftId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserMutedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserPresenceChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserUnbanned") + .HasColumnType("boolean"); + + b.Property("UserUnbannedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserUpdated") + .HasColumnType("boolean"); + + b.Property("UserUpdatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("VerificationMessages") + .HasColumnType("numeric(20,0)"); + + b.Property("VerificationSteps") + .HasColumnType("numeric(20,0)"); + + b.Property("VoicePresenceChannelId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("LogSetting"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.MessageXpRestriction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "ChannelId") + .IsUnique(); + + b.ToTable("MessageXpRestrictions"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ModulePrefix", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ModuleName") + .HasColumnType("text"); + + b.Property("Prefix") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("ModulePrefix"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.MutedUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("MutedUserId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.NsfwBlacklitedTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Tag") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("NsfwBlacklitedTag"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("NextId") + .HasColumnType("integer"); + + b.Property("PrimaryTarget") + .HasColumnType("integer"); + + b.Property("PrimaryTargetId") + .HasColumnType("numeric(20,0)"); + + b.Property("SecondaryTarget") + .HasColumnType("integer"); + + b.Property("SecondaryTargetName") + .HasColumnType("text"); + + b.Property("State") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("NextId") + .IsUnique(); + + b.ToTable("Permission"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permissionv2", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Index") + .HasColumnType("integer"); + + b.Property("PrimaryTarget") + .HasColumnType("integer"); + + b.Property("PrimaryTargetId") + .HasColumnType("numeric(20,0)"); + + b.Property("SecondaryTarget") + .HasColumnType("integer"); + + b.Property("SecondaryTargetName") + .HasColumnType("text"); + + b.Property("State") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("Permissionv2"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.PlayingStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Status") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("PlayingStatus"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Quote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AuthorId") + .HasColumnType("numeric(20,0)"); + + b.Property("AuthorName") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Keyword") + .IsRequired() + .HasColumnType("text"); + + b.Property("Text") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Quotes"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RaceAnimal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Icon") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("RaceAnimal"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Reminder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("IsPrivate") + .HasColumnType("boolean"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("ServerId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("When") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Reminders"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RewardedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AmountRewardedThisMonth") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LastReward") + .HasColumnType("timestamp without time zone"); + + b.Property("PatreonUserId") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("RewardedUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RoleLevelBinding", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("MinimumLevel") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId") + .IsUnique(); + + b.ToTable("RoleLevelBinding"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RoleMoney", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Money") + .HasColumnType("bigint"); + + b.Property("Priority") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId") + .IsUnique(); + + b.ToTable("RoleMoney"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SelfAssignedRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "RoleId") + .IsUnique(); + + b.ToTable("SelfAssignableRoles"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AuthorId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Index") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("RoleName") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("ShopEntry"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntryItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ShopEntryId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ShopEntryId"); + + b.ToTable("ShopEntryItem"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("SlowmodeIgnoredRole"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("SlowmodeIgnoredUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StartupCommand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelName") + .HasColumnType("text"); + + b.Property("CommandText") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("GuildName") + .HasColumnType("text"); + + b.Property("Index") + .HasColumnType("integer"); + + b.Property("VoiceChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("VoiceChannelName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("StartupCommand"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleBlacklistedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("StreamRoleSettingsId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("Username") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StreamRoleSettingsId"); + + b.ToTable("StreamRoleBlacklistedUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("FromRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Keyword") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId") + .IsUnique(); + + b.ToTable("StreamRoleSettings"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleWhitelistedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("StreamRoleSettingsId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("Username") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StreamRoleSettingsId"); + + b.ToTable("StreamRoleWhitelistedUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.TeamUpdateRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Rankname") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "Rankname") + .IsUnique(); + + b.ToTable("TeamUpdateRank"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.UnmuteTimer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("UnmuteAt") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("UnmuteTimer"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.UsernameHistoryModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DateReplaced") + .HasColumnType("timestamp without time zone"); + + b.Property("DateSet") + .HasColumnType("timestamp without time zone"); + + b.Property("DiscordDiscriminator") + .HasColumnType("integer"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("UsernameHistory"); + + b.HasDiscriminator("Discriminator").HasValue("UsernameHistoryModel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VcRoleInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("VoiceChannelId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("VcRoleInfo"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VerifiedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ForumUserId") + .HasColumnType("bigint"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "UserId") + .IsUnique(); + + b.ToTable("VerifiedUsers"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VoiceChannelStats", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("TimeInVoiceChannel") + .HasColumnType("double precision"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "GuildId") + .IsUnique(); + + b.ToTable("VoiceChannelStats"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Warning", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Forgiven") + .HasColumnType("boolean"); + + b.Property("ForgivenBy") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Moderator") + .HasColumnType("text"); + + b.Property("Reason") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("Warnings"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.WarningPunishment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Punishment") + .HasColumnType("integer"); + + b.Property("Time") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("WarningPunishment"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ZalgoFilterChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("ZalgoFilterChannel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.NicknameHistoryModel", b => + { + b.HasBaseType("Mitternacht.Services.Database.Models.UsernameHistoryModel"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.HasDiscriminator().HasValue("NicknameHistoryModel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiRaidSetting", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", "GuildConfig") + .WithOne("AntiRaidSetting") + .HasForeignKey("Mitternacht.Services.Database.Models.AntiRaidSetting", "GuildConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamIgnore", b => + { + b.HasOne("Mitternacht.Services.Database.Models.AntiSpamSetting", null) + .WithMany("IgnoredChannels") + .HasForeignKey("AntiSpamSettingId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamSetting", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", "GuildConfig") + .WithOne("AntiSpamSetting") + .HasForeignKey("Mitternacht.Services.Database.Models.AntiSpamSetting", "GuildConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlacklistItem", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("Blacklist") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlockedCmdOrMdl", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("BlockedCommands") + .HasForeignKey("BotConfigId"); + + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("BlockedModules") + .HasForeignKey("BotConfigId1"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandAlias", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("CommandAliases") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandCooldown", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("CommandCooldowns") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandPrice", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("CommandPrices") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.EightBallResponse", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("EightBallResponses") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilterChannelId", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilterInvitesChannelIds") + .HasForeignKey("GuildConfigId"); + + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilterWordsChannelIds") + .HasForeignKey("GuildConfigId1"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilteredWord", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilteredWords") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FollowedStream", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FollowedStreams") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GCChannelId", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("GenerateCurrencyChannelIds") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildConfig", b => + { + b.HasOne("Mitternacht.Services.Database.Models.LogSetting", "LogSetting") + .WithMany() + .HasForeignKey("LogSettingId"); + + b.HasOne("Mitternacht.Services.Database.Models.Permission", "RootPermission") + .WithMany() + .HasForeignKey("RootPermissionId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildRepeater", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("GuildRepeaters") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredLogChannel", b => + { + b.HasOne("Mitternacht.Services.Database.Models.LogSetting", "LogSetting") + .WithMany("IgnoredChannels") + .HasForeignKey("LogSettingId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredVoicePresenceChannel", b => + { + b.HasOne("Mitternacht.Services.Database.Models.LogSetting", "LogSetting") + .WithMany("IgnoredVoicePresenceChannelIds") + .HasForeignKey("LogSettingId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ModulePrefix", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("ModulePrefixes") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.MutedUserId", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("MutedUsers") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.NsfwBlacklitedTag", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("NsfwBlacklistedTags") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permission", b => + { + b.HasOne("Mitternacht.Services.Database.Models.Permission", "Next") + .WithOne("Previous") + .HasForeignKey("Mitternacht.Services.Database.Models.Permission", "NextId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permissionv2", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("Permissions") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.PlayingStatus", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("RotatingStatusMessages") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RaceAnimal", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("RaceAnimals") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntry", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("ShopEntries") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntryItem", b => + { + b.HasOne("Mitternacht.Services.Database.Models.ShopEntry", null) + .WithMany("Items") + .HasForeignKey("ShopEntryId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredRole", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("SlowmodeIgnoredRoles") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredUser", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("SlowmodeIgnoredUsers") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StartupCommand", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("StartupCommands") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleBlacklistedUser", b => + { + b.HasOne("Mitternacht.Services.Database.Models.StreamRoleSettings", null) + .WithMany("Blacklist") + .HasForeignKey("StreamRoleSettingsId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleSettings", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", "GuildConfig") + .WithOne("StreamRole") + .HasForeignKey("Mitternacht.Services.Database.Models.StreamRoleSettings", "GuildConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleWhitelistedUser", b => + { + b.HasOne("Mitternacht.Services.Database.Models.StreamRoleSettings", null) + .WithMany("Whitelist") + .HasForeignKey("StreamRoleSettingsId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.UnmuteTimer", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("UnmuteTimers") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VcRoleInfo", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("VcRoleInfos") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.WarningPunishment", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("WarnPunishments") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ZalgoFilterChannel", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilterZalgoChannelIds") + .HasForeignKey("GuildConfigId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/MitternachtBot/Migrations/Mitternacht/20200703220636_InitialMigration.cs b/src/MitternachtBot/Migrations/Mitternacht/20200703220636_InitialMigration.cs new file mode 100644 index 000000000..17c19a1ad --- /dev/null +++ b/src/MitternachtBot/Migrations/Mitternacht/20200703220636_InitialMigration.cs @@ -0,0 +1,1784 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Mitternacht.Migrations.Mitternacht +{ + public partial class InitialMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "BirthDates", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + Day = table.Column(nullable: false), + Month = table.Column(nullable: false), + Year = table.Column(nullable: true), + BirthdayMessageEnabled = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BirthDates", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BotConfig", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + BufferSize = table.Column(nullable: false), + ForwardMessages = table.Column(nullable: false), + ForwardToAllOwners = table.Column(nullable: false), + CurrencyGenerationChance = table.Column(nullable: false), + CurrencyGenerationCooldown = table.Column(nullable: false), + RotatingStatuses = table.Column(nullable: false), + RemindMessageFormat = table.Column(nullable: true), + CurrencySign = table.Column(nullable: true), + CurrencyName = table.Column(nullable: true), + CurrencyPluralName = table.Column(nullable: true), + TriviaCurrencyReward = table.Column(nullable: false), + MinimumBetAmount = table.Column(nullable: false), + BetflipMultiplier = table.Column(nullable: false), + CurrencyDropAmount = table.Column(nullable: false), + CurrencyDropAmountMax = table.Column(nullable: true), + Betroll67Multiplier = table.Column(nullable: false), + Betroll91Multiplier = table.Column(nullable: false), + Betroll100Multiplier = table.Column(nullable: false), + DMHelpString = table.Column(nullable: true), + HelpString = table.Column(nullable: true), + OkColor = table.Column(nullable: true), + ErrorColor = table.Column(nullable: true), + Locale = table.Column(nullable: true), + DefaultPrefix = table.Column(nullable: true), + CustomReactionsStartWith = table.Column(nullable: false), + LogUsernames = table.Column(nullable: false), + LastTimeBirthdaysChecked = table.Column(nullable: false), + FirstAprilHereChance = table.Column(nullable: false), + DmCommandsOwnerOnly = table.Column(nullable: false), + PermissionVersion = table.Column(nullable: false), + MigrationVersion = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BotConfig", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Currency", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + Amount = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Currency", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CurrencyTransactions", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Amount = table.Column(nullable: false), + Reason = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CurrencyTransactions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CustomReactions", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: true), + Response = table.Column(nullable: true), + Trigger = table.Column(nullable: true), + IsRegex = table.Column(nullable: false), + OwnerOnly = table.Column(nullable: false), + AutoDeleteTrigger = table.Column(nullable: false), + DmResponse = table.Column(nullable: false), + ContainsAnywhere = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CustomReactions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "DailyMoney", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + LastTimeGotten = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DailyMoney", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "DailyMoneyStats", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + TimeReceived = table.Column(nullable: false), + MoneyReceived = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DailyMoneyStats", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Donators", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + Name = table.Column(nullable: true), + Amount = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Donators", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "LevelModel", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + UserId = table.Column(nullable: false), + TotalXP = table.Column(nullable: false), + timestamp = table.Column(nullable: false), + CurrentXP = table.Column(nullable: false), + Level = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LevelModel", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "LogSetting", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + LogOtherId = table.Column(nullable: true), + MessageUpdatedId = table.Column(nullable: true), + MessageDeletedId = table.Column(nullable: true), + UserJoinedId = table.Column(nullable: true), + UserLeftId = table.Column(nullable: true), + UserBannedId = table.Column(nullable: true), + UserUnbannedId = table.Column(nullable: true), + UserUpdatedId = table.Column(nullable: true), + ChannelCreatedId = table.Column(nullable: true), + ChannelDestroyedId = table.Column(nullable: true), + ChannelUpdatedId = table.Column(nullable: true), + UserMutedId = table.Column(nullable: true), + LogUserPresenceId = table.Column(nullable: true), + LogVoicePresenceId = table.Column(nullable: true), + LogVoicePresenceTTSId = table.Column(nullable: true), + VerificationSteps = table.Column(nullable: true), + VerificationMessages = table.Column(nullable: true), + IsLogging = table.Column(nullable: false), + ChannelId = table.Column(nullable: false), + MessageUpdated = table.Column(nullable: false), + MessageDeleted = table.Column(nullable: false), + UserJoined = table.Column(nullable: false), + UserLeft = table.Column(nullable: false), + UserBanned = table.Column(nullable: false), + UserUnbanned = table.Column(nullable: false), + UserUpdated = table.Column(nullable: false), + ChannelCreated = table.Column(nullable: false), + ChannelDestroyed = table.Column(nullable: false), + ChannelUpdated = table.Column(nullable: false), + LogUserPresence = table.Column(nullable: false), + UserPresenceChannelId = table.Column(nullable: false), + LogVoicePresence = table.Column(nullable: false), + VoicePresenceChannelId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LogSetting", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "MessageXpRestrictions", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + ChannelId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MessageXpRestrictions", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Permission", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + NextId = table.Column(nullable: true), + PrimaryTarget = table.Column(nullable: false), + PrimaryTargetId = table.Column(nullable: false), + SecondaryTarget = table.Column(nullable: false), + SecondaryTargetName = table.Column(nullable: true), + State = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Permission", x => x.Id); + table.ForeignKey( + name: "FK_Permission_Permission_NextId", + column: x => x.NextId, + principalTable: "Permission", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Quotes", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + Keyword = table.Column(nullable: false), + AuthorName = table.Column(nullable: false), + AuthorId = table.Column(nullable: false), + Text = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Quotes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Reminders", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + When = table.Column(nullable: false), + ChannelId = table.Column(nullable: false), + ServerId = table.Column(nullable: false), + UserId = table.Column(nullable: false), + Message = table.Column(nullable: true), + IsPrivate = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Reminders", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "RewardedUser", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + PatreonUserId = table.Column(nullable: true), + AmountRewardedThisMonth = table.Column(nullable: false), + LastReward = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RewardedUser", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "RoleLevelBinding", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + RoleId = table.Column(nullable: false), + MinimumLevel = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RoleLevelBinding", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "RoleMoney", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + RoleId = table.Column(nullable: false), + Money = table.Column(nullable: false), + Priority = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RoleMoney", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "SelfAssignableRoles", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + RoleId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SelfAssignableRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "TeamUpdateRank", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + Rankname = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TeamUpdateRank", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "UsernameHistory", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + Name = table.Column(nullable: true), + DiscordDiscriminator = table.Column(nullable: false), + DateSet = table.Column(nullable: false), + DateReplaced = table.Column(nullable: true), + Discriminator = table.Column(nullable: false), + GuildId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_UsernameHistory", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "VerifiedUsers", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + UserId = table.Column(nullable: false), + ForumUserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VerifiedUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "VoiceChannelStats", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + GuildId = table.Column(nullable: false), + TimeInVoiceChannel = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VoiceChannelStats", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Warnings", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + UserId = table.Column(nullable: false), + Reason = table.Column(nullable: true), + Forgiven = table.Column(nullable: false), + ForgivenBy = table.Column(nullable: true), + Moderator = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Warnings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "BlacklistItem", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + ItemId = table.Column(nullable: false), + Type = table.Column(nullable: false), + BotConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BlacklistItem", x => x.Id); + table.ForeignKey( + name: "FK_BlacklistItem_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "BlockedCmdOrMdl", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Name = table.Column(nullable: true), + BotConfigId = table.Column(nullable: true), + BotConfigId1 = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BlockedCmdOrMdl", x => x.Id); + table.ForeignKey( + name: "FK_BlockedCmdOrMdl_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_BlockedCmdOrMdl_BotConfig_BotConfigId1", + column: x => x.BotConfigId1, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CommandPrice", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Price = table.Column(nullable: false), + CommandName = table.Column(nullable: true), + BotConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CommandPrice", x => x.Id); + table.ForeignKey( + name: "FK_CommandPrice_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "EightBallResponse", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Text = table.Column(nullable: true), + BotConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_EightBallResponse", x => x.Id); + table.ForeignKey( + name: "FK_EightBallResponse_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ModulePrefix", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + ModuleName = table.Column(nullable: true), + Prefix = table.Column(nullable: true), + BotConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ModulePrefix", x => x.Id); + table.ForeignKey( + name: "FK_ModulePrefix_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "PlayingStatus", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Status = table.Column(nullable: true), + BotConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PlayingStatus", x => x.Id); + table.ForeignKey( + name: "FK_PlayingStatus_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "RaceAnimal", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Icon = table.Column(nullable: true), + Name = table.Column(nullable: true), + BotConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RaceAnimal", x => x.Id); + table.ForeignKey( + name: "FK_RaceAnimal_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "StartupCommand", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Index = table.Column(nullable: false), + CommandText = table.Column(nullable: true), + ChannelId = table.Column(nullable: false), + ChannelName = table.Column(nullable: true), + GuildId = table.Column(nullable: true), + GuildName = table.Column(nullable: true), + VoiceChannelId = table.Column(nullable: true), + VoiceChannelName = table.Column(nullable: true), + BotConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_StartupCommand", x => x.Id); + table.ForeignKey( + name: "FK_StartupCommand_BotConfig_BotConfigId", + column: x => x.BotConfigId, + principalTable: "BotConfig", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "IgnoredLogChannel", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + LogSettingId = table.Column(nullable: true), + ChannelId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IgnoredLogChannel", x => x.Id); + table.ForeignKey( + name: "FK_IgnoredLogChannel_LogSetting_LogSettingId", + column: x => x.LogSettingId, + principalTable: "LogSetting", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "IgnoredVoicePresenceChannel", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + LogSettingId = table.Column(nullable: true), + ChannelId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IgnoredVoicePresenceChannel", x => x.Id); + table.ForeignKey( + name: "FK_IgnoredVoicePresenceChannel_LogSetting_LogSettingId", + column: x => x.LogSettingId, + principalTable: "LogSetting", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "GuildConfigs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + Prefix = table.Column(nullable: true), + DeleteMessageOnCommand = table.Column(nullable: false), + AutoAssignRoleId = table.Column(nullable: false), + AutoDeleteGreetMessagesTimer = table.Column(nullable: false), + AutoDeleteByeMessagesTimer = table.Column(nullable: false), + GreetMessageChannelId = table.Column(nullable: false), + ByeMessageChannelId = table.Column(nullable: false), + SendDmGreetMessage = table.Column(nullable: false), + DmGreetMessageText = table.Column(nullable: true), + SendChannelGreetMessage = table.Column(nullable: false), + ChannelGreetMessageText = table.Column(nullable: true), + SendChannelByeMessage = table.Column(nullable: false), + ChannelByeMessageText = table.Column(nullable: true), + ExclusiveSelfAssignedRoles = table.Column(nullable: false), + AutoDeleteSelfAssignedRoleMessages = table.Column(nullable: false), + DefaultMusicVolume = table.Column(nullable: false), + VoicePlusTextEnabled = table.Column(nullable: false), + CleverbotEnabled = table.Column(nullable: false), + MuteRoleName = table.Column(nullable: true), + Locale = table.Column(nullable: true), + TimeZoneId = table.Column(nullable: true), + GameVoiceChannel = table.Column(nullable: true), + VerboseErrors = table.Column(nullable: false), + VerifiedRoleId = table.Column(nullable: true), + VerifyString = table.Column(nullable: true), + VerificationTutorialText = table.Column(nullable: true), + AdditionalVerificationUsers = table.Column(nullable: true), + VerificationPasswordChannelId = table.Column(nullable: true), + TurnToXpMultiplier = table.Column(nullable: false), + MessageXpTimeDifference = table.Column(nullable: false), + MessageXpCharCountMin = table.Column(nullable: false), + MessageXpCharCountMax = table.Column(nullable: false), + LogUsernameHistory = table.Column(nullable: true), + BirthdayRoleId = table.Column(nullable: true), + BirthdayMessage = table.Column(nullable: true), + BirthdayMessageChannelId = table.Column(nullable: true), + BirthdaysEnabled = table.Column(nullable: false), + BirthdayMoney = table.Column(nullable: true), + GommeTeamMemberRoleId = table.Column(nullable: true), + VipRoleId = table.Column(nullable: true), + TeamUpdateChannelId = table.Column(nullable: true), + TeamUpdateMessagePrefix = table.Column(nullable: true), + CountToNumberChannelId = table.Column(nullable: true), + CountToNumberMessageChance = table.Column(nullable: false), + ForumNotificationChannelId = table.Column(nullable: true), + RootPermissionId = table.Column(nullable: true), + VerbosePermissions = table.Column(nullable: false), + PermissionRole = table.Column(nullable: true), + FilterInvites = table.Column(nullable: false), + FilterWords = table.Column(nullable: false), + FilterZalgo = table.Column(nullable: false), + LogSettingId = table.Column(nullable: true), + WarningsInitialized = table.Column(nullable: false), + AutoDeleteGreetMessages = table.Column(nullable: false), + AutoDeleteByeMessages = table.Column(nullable: false), + SupportChannelId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GuildConfigs", x => x.Id); + table.ForeignKey( + name: "FK_GuildConfigs_LogSetting_LogSettingId", + column: x => x.LogSettingId, + principalTable: "LogSetting", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_GuildConfigs_Permission_RootPermissionId", + column: x => x.RootPermissionId, + principalTable: "Permission", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AntiRaidSetting", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: false), + UserThreshold = table.Column(nullable: false), + Seconds = table.Column(nullable: false), + Action = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AntiRaidSetting", x => x.Id); + table.ForeignKey( + name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AntiSpamSetting", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: false), + Action = table.Column(nullable: false), + MessageThreshold = table.Column(nullable: false), + MuteTime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AntiSpamSetting", x => x.Id); + table.ForeignKey( + name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CommandAlias", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Trigger = table.Column(nullable: true), + Mapping = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CommandAlias", x => x.Id); + table.ForeignKey( + name: "FK_CommandAlias_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CommandCooldown", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Seconds = table.Column(nullable: false), + CommandName = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CommandCooldown", x => x.Id); + table.ForeignKey( + name: "FK_CommandCooldown_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "FilterChannelId", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + ChannelId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true), + GuildConfigId1 = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_FilterChannelId", x => x.Id); + table.ForeignKey( + name: "FK_FilterChannelId_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_FilterChannelId_GuildConfigs_GuildConfigId1", + column: x => x.GuildConfigId1, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "FilteredWord", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Word = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_FilteredWord", x => x.Id); + table.ForeignKey( + name: "FK_FilteredWord_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "FollowedStream", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + ChannelId = table.Column(nullable: false), + Username = table.Column(nullable: true), + Type = table.Column(nullable: false), + GuildId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_FollowedStream", x => x.Id); + table.ForeignKey( + name: "FK_FollowedStream_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "GCChannelId", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + ChannelId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GCChannelId", x => x.Id); + table.ForeignKey( + name: "FK_GCChannelId_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "GuildRepeater", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildId = table.Column(nullable: false), + ChannelId = table.Column(nullable: false), + Message = table.Column(nullable: true), + Interval = table.Column(nullable: false), + StartTimeOfDay = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_GuildRepeater", x => x.Id); + table.ForeignKey( + name: "FK_GuildRepeater_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "MutedUserId", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_MutedUserId", x => x.Id); + table.ForeignKey( + name: "FK_MutedUserId_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "NsfwBlacklitedTag", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Tag = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_NsfwBlacklitedTag", x => x.Id); + table.ForeignKey( + name: "FK_NsfwBlacklitedTag_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Permissionv2", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: true), + Index = table.Column(nullable: false), + PrimaryTarget = table.Column(nullable: false), + PrimaryTargetId = table.Column(nullable: false), + SecondaryTarget = table.Column(nullable: false), + SecondaryTargetName = table.Column(nullable: true), + State = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Permissionv2", x => x.Id); + table.ForeignKey( + name: "FK_Permissionv2_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShopEntry", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Index = table.Column(nullable: false), + Price = table.Column(nullable: false), + Name = table.Column(nullable: true), + AuthorId = table.Column(nullable: false), + Type = table.Column(nullable: false), + RoleName = table.Column(nullable: true), + RoleId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopEntry", x => x.Id); + table.ForeignKey( + name: "FK_ShopEntry_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "SlowmodeIgnoredRole", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + RoleId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SlowmodeIgnoredRole", x => x.Id); + table.ForeignKey( + name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "SlowmodeIgnoredUser", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SlowmodeIgnoredUser", x => x.Id); + table.ForeignKey( + name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "StreamRoleSettings", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + GuildConfigId = table.Column(nullable: false), + Enabled = table.Column(nullable: false), + AddRoleId = table.Column(nullable: false), + FromRoleId = table.Column(nullable: false), + Keyword = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_StreamRoleSettings", x => x.Id); + table.ForeignKey( + name: "FK_StreamRoleSettings_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "UnmuteTimer", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + UnmuteAt = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_UnmuteTimer", x => x.Id); + table.ForeignKey( + name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "VcRoleInfo", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + VoiceChannelId = table.Column(nullable: false), + RoleId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_VcRoleInfo", x => x.Id); + table.ForeignKey( + name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "WarningPunishment", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Count = table.Column(nullable: false), + Time = table.Column(nullable: false), + Punishment = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_WarningPunishment", x => x.Id); + table.ForeignKey( + name: "FK_WarningPunishment_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ZalgoFilterChannel", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + ChannelId = table.Column(nullable: false), + GuildConfigId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ZalgoFilterChannel", x => x.Id); + table.ForeignKey( + name: "FK_ZalgoFilterChannel_GuildConfigs_GuildConfigId", + column: x => x.GuildConfigId, + principalTable: "GuildConfigs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AntiSpamIgnore", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + ChannelId = table.Column(nullable: false), + AntiSpamSettingId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AntiSpamIgnore", x => x.Id); + table.ForeignKey( + name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId", + column: x => x.AntiSpamSettingId, + principalTable: "AntiSpamSetting", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShopEntryItem", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + Text = table.Column(nullable: true), + ShopEntryId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopEntryItem", x => x.Id); + table.ForeignKey( + name: "FK_ShopEntryItem_ShopEntry_ShopEntryId", + column: x => x.ShopEntryId, + principalTable: "ShopEntry", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "StreamRoleBlacklistedUser", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + Username = table.Column(nullable: true), + StreamRoleSettingsId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_StreamRoleBlacklistedUser", x => x.Id); + table.ForeignKey( + name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSett~", + column: x => x.StreamRoleSettingsId, + principalTable: "StreamRoleSettings", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "StreamRoleWhitelistedUser", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateAdded = table.Column(nullable: true), + UserId = table.Column(nullable: false), + Username = table.Column(nullable: true), + StreamRoleSettingsId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_StreamRoleWhitelistedUser", x => x.Id); + table.ForeignKey( + name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSett~", + column: x => x.StreamRoleSettingsId, + principalTable: "StreamRoleSettings", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_AntiRaidSetting_GuildConfigId", + table: "AntiRaidSetting", + column: "GuildConfigId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AntiSpamIgnore_AntiSpamSettingId", + table: "AntiSpamIgnore", + column: "AntiSpamSettingId"); + + migrationBuilder.CreateIndex( + name: "IX_AntiSpamSetting_GuildConfigId", + table: "AntiSpamSetting", + column: "GuildConfigId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_BirthDates_UserId", + table: "BirthDates", + column: "UserId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_BlacklistItem_BotConfigId", + table: "BlacklistItem", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_BlockedCmdOrMdl_BotConfigId", + table: "BlockedCmdOrMdl", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_BlockedCmdOrMdl_BotConfigId1", + table: "BlockedCmdOrMdl", + column: "BotConfigId1"); + + migrationBuilder.CreateIndex( + name: "IX_CommandAlias_GuildConfigId", + table: "CommandAlias", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_CommandCooldown_GuildConfigId", + table: "CommandCooldown", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_CommandPrice_BotConfigId", + table: "CommandPrice", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_CommandPrice_Price", + table: "CommandPrice", + column: "Price", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Currency_UserId", + table: "Currency", + column: "UserId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_DailyMoney_UserId", + table: "DailyMoney", + column: "UserId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Donators_UserId", + table: "Donators", + column: "UserId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_EightBallResponse_BotConfigId", + table: "EightBallResponse", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterChannelId_GuildConfigId", + table: "FilterChannelId", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_FilterChannelId_GuildConfigId1", + table: "FilterChannelId", + column: "GuildConfigId1"); + + migrationBuilder.CreateIndex( + name: "IX_FilteredWord_GuildConfigId", + table: "FilteredWord", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_FollowedStream_GuildConfigId", + table: "FollowedStream", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_GCChannelId_GuildConfigId", + table: "GCChannelId", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_GuildConfigs_GuildId", + table: "GuildConfigs", + column: "GuildId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_GuildConfigs_LogSettingId", + table: "GuildConfigs", + column: "LogSettingId"); + + migrationBuilder.CreateIndex( + name: "IX_GuildConfigs_RootPermissionId", + table: "GuildConfigs", + column: "RootPermissionId"); + + migrationBuilder.CreateIndex( + name: "IX_GuildRepeater_GuildConfigId", + table: "GuildRepeater", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_IgnoredLogChannel_LogSettingId", + table: "IgnoredLogChannel", + column: "LogSettingId"); + + migrationBuilder.CreateIndex( + name: "IX_IgnoredVoicePresenceChannel_LogSettingId", + table: "IgnoredVoicePresenceChannel", + column: "LogSettingId"); + + migrationBuilder.CreateIndex( + name: "IX_LevelModel_GuildId_UserId", + table: "LevelModel", + columns: new[] { "GuildId", "UserId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_MessageXpRestrictions_GuildId_ChannelId", + table: "MessageXpRestrictions", + columns: new[] { "GuildId", "ChannelId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ModulePrefix_BotConfigId", + table: "ModulePrefix", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_MutedUserId_GuildConfigId", + table: "MutedUserId", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_NsfwBlacklitedTag_GuildConfigId", + table: "NsfwBlacklitedTag", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_Permission_NextId", + table: "Permission", + column: "NextId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Permissionv2_GuildConfigId", + table: "Permissionv2", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_PlayingStatus_BotConfigId", + table: "PlayingStatus", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_RaceAnimal_BotConfigId", + table: "RaceAnimal", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_RewardedUser_UserId", + table: "RewardedUser", + column: "UserId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_RoleLevelBinding_RoleId", + table: "RoleLevelBinding", + column: "RoleId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_RoleMoney_RoleId", + table: "RoleMoney", + column: "RoleId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_SelfAssignableRoles_GuildId_RoleId", + table: "SelfAssignableRoles", + columns: new[] { "GuildId", "RoleId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ShopEntry_GuildConfigId", + table: "ShopEntry", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopEntryItem_ShopEntryId", + table: "ShopEntryItem", + column: "ShopEntryId"); + + migrationBuilder.CreateIndex( + name: "IX_SlowmodeIgnoredRole_GuildConfigId", + table: "SlowmodeIgnoredRole", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_SlowmodeIgnoredUser_GuildConfigId", + table: "SlowmodeIgnoredUser", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_StartupCommand_BotConfigId", + table: "StartupCommand", + column: "BotConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_StreamRoleBlacklistedUser_StreamRoleSettingsId", + table: "StreamRoleBlacklistedUser", + column: "StreamRoleSettingsId"); + + migrationBuilder.CreateIndex( + name: "IX_StreamRoleSettings_GuildConfigId", + table: "StreamRoleSettings", + column: "GuildConfigId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_StreamRoleWhitelistedUser_StreamRoleSettingsId", + table: "StreamRoleWhitelistedUser", + column: "StreamRoleSettingsId"); + + migrationBuilder.CreateIndex( + name: "IX_TeamUpdateRank_GuildId_Rankname", + table: "TeamUpdateRank", + columns: new[] { "GuildId", "Rankname" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_UnmuteTimer_GuildConfigId", + table: "UnmuteTimer", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_VcRoleInfo_GuildConfigId", + table: "VcRoleInfo", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_VerifiedUsers_GuildId_UserId", + table: "VerifiedUsers", + columns: new[] { "GuildId", "UserId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_VoiceChannelStats_UserId_GuildId", + table: "VoiceChannelStats", + columns: new[] { "UserId", "GuildId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_WarningPunishment_GuildConfigId", + table: "WarningPunishment", + column: "GuildConfigId"); + + migrationBuilder.CreateIndex( + name: "IX_ZalgoFilterChannel_GuildConfigId", + table: "ZalgoFilterChannel", + column: "GuildConfigId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AntiRaidSetting"); + + migrationBuilder.DropTable( + name: "AntiSpamIgnore"); + + migrationBuilder.DropTable( + name: "BirthDates"); + + migrationBuilder.DropTable( + name: "BlacklistItem"); + + migrationBuilder.DropTable( + name: "BlockedCmdOrMdl"); + + migrationBuilder.DropTable( + name: "CommandAlias"); + + migrationBuilder.DropTable( + name: "CommandCooldown"); + + migrationBuilder.DropTable( + name: "CommandPrice"); + + migrationBuilder.DropTable( + name: "Currency"); + + migrationBuilder.DropTable( + name: "CurrencyTransactions"); + + migrationBuilder.DropTable( + name: "CustomReactions"); + + migrationBuilder.DropTable( + name: "DailyMoney"); + + migrationBuilder.DropTable( + name: "DailyMoneyStats"); + + migrationBuilder.DropTable( + name: "Donators"); + + migrationBuilder.DropTable( + name: "EightBallResponse"); + + migrationBuilder.DropTable( + name: "FilterChannelId"); + + migrationBuilder.DropTable( + name: "FilteredWord"); + + migrationBuilder.DropTable( + name: "FollowedStream"); + + migrationBuilder.DropTable( + name: "GCChannelId"); + + migrationBuilder.DropTable( + name: "GuildRepeater"); + + migrationBuilder.DropTable( + name: "IgnoredLogChannel"); + + migrationBuilder.DropTable( + name: "IgnoredVoicePresenceChannel"); + + migrationBuilder.DropTable( + name: "LevelModel"); + + migrationBuilder.DropTable( + name: "MessageXpRestrictions"); + + migrationBuilder.DropTable( + name: "ModulePrefix"); + + migrationBuilder.DropTable( + name: "MutedUserId"); + + migrationBuilder.DropTable( + name: "NsfwBlacklitedTag"); + + migrationBuilder.DropTable( + name: "Permissionv2"); + + migrationBuilder.DropTable( + name: "PlayingStatus"); + + migrationBuilder.DropTable( + name: "Quotes"); + + migrationBuilder.DropTable( + name: "RaceAnimal"); + + migrationBuilder.DropTable( + name: "Reminders"); + + migrationBuilder.DropTable( + name: "RewardedUser"); + + migrationBuilder.DropTable( + name: "RoleLevelBinding"); + + migrationBuilder.DropTable( + name: "RoleMoney"); + + migrationBuilder.DropTable( + name: "SelfAssignableRoles"); + + migrationBuilder.DropTable( + name: "ShopEntryItem"); + + migrationBuilder.DropTable( + name: "SlowmodeIgnoredRole"); + + migrationBuilder.DropTable( + name: "SlowmodeIgnoredUser"); + + migrationBuilder.DropTable( + name: "StartupCommand"); + + migrationBuilder.DropTable( + name: "StreamRoleBlacklistedUser"); + + migrationBuilder.DropTable( + name: "StreamRoleWhitelistedUser"); + + migrationBuilder.DropTable( + name: "TeamUpdateRank"); + + migrationBuilder.DropTable( + name: "UnmuteTimer"); + + migrationBuilder.DropTable( + name: "UsernameHistory"); + + migrationBuilder.DropTable( + name: "VcRoleInfo"); + + migrationBuilder.DropTable( + name: "VerifiedUsers"); + + migrationBuilder.DropTable( + name: "VoiceChannelStats"); + + migrationBuilder.DropTable( + name: "WarningPunishment"); + + migrationBuilder.DropTable( + name: "Warnings"); + + migrationBuilder.DropTable( + name: "ZalgoFilterChannel"); + + migrationBuilder.DropTable( + name: "AntiSpamSetting"); + + migrationBuilder.DropTable( + name: "ShopEntry"); + + migrationBuilder.DropTable( + name: "BotConfig"); + + migrationBuilder.DropTable( + name: "StreamRoleSettings"); + + migrationBuilder.DropTable( + name: "GuildConfigs"); + + migrationBuilder.DropTable( + name: "LogSetting"); + + migrationBuilder.DropTable( + name: "Permission"); + } + } +} diff --git a/src/MitternachtBot/Migrations/Mitternacht/MitternachtContextModelSnapshot.cs b/src/MitternachtBot/Migrations/Mitternacht/MitternachtContextModelSnapshot.cs new file mode 100644 index 000000000..bc0d768e4 --- /dev/null +++ b/src/MitternachtBot/Migrations/Mitternacht/MitternachtContextModelSnapshot.cs @@ -0,0 +1,2258 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Mitternacht.Services.Database; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace Mitternacht.Migrations.Mitternacht +{ + [DbContext(typeof(MitternachtContext))] + partial class MitternachtContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiRaidSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Action") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Seconds") + .HasColumnType("integer"); + + b.Property("UserThreshold") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId") + .IsUnique(); + + b.ToTable("AntiRaidSetting"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamIgnore", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AntiSpamSettingId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("AntiSpamSettingId"); + + b.ToTable("AntiSpamIgnore"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Action") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("MessageThreshold") + .HasColumnType("integer"); + + b.Property("MuteTime") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId") + .IsUnique(); + + b.ToTable("AntiSpamSetting"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BirthDateModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BirthdayMessageEnabled") + .HasColumnType("boolean"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Day") + .HasColumnType("integer"); + + b.Property("Month") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("Year") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("BirthDates"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlacklistItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ItemId") + .HasColumnType("numeric(20,0)"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("BlacklistItem"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlockedCmdOrMdl", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("BotConfigId1") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.HasIndex("BotConfigId1"); + + b.ToTable("BlockedCmdOrMdl"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BotConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BetflipMultiplier") + .HasColumnType("real"); + + b.Property("Betroll100Multiplier") + .HasColumnType("real"); + + b.Property("Betroll67Multiplier") + .HasColumnType("real"); + + b.Property("Betroll91Multiplier") + .HasColumnType("real"); + + b.Property("BufferSize") + .HasColumnType("numeric(20,0)"); + + b.Property("CurrencyDropAmount") + .HasColumnType("integer"); + + b.Property("CurrencyDropAmountMax") + .HasColumnType("integer"); + + b.Property("CurrencyGenerationChance") + .HasColumnType("real"); + + b.Property("CurrencyGenerationCooldown") + .HasColumnType("integer"); + + b.Property("CurrencyName") + .HasColumnType("text"); + + b.Property("CurrencyPluralName") + .HasColumnType("text"); + + b.Property("CurrencySign") + .HasColumnType("text"); + + b.Property("CustomReactionsStartWith") + .HasColumnType("boolean"); + + b.Property("DMHelpString") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DefaultPrefix") + .HasColumnType("text"); + + b.Property("DmCommandsOwnerOnly") + .HasColumnType("boolean"); + + b.Property("ErrorColor") + .HasColumnType("text"); + + b.Property("FirstAprilHereChance") + .HasColumnType("double precision"); + + b.Property("ForwardMessages") + .HasColumnType("boolean"); + + b.Property("ForwardToAllOwners") + .HasColumnType("boolean"); + + b.Property("HelpString") + .HasColumnType("text"); + + b.Property("LastTimeBirthdaysChecked") + .HasColumnType("timestamp without time zone"); + + b.Property("Locale") + .HasColumnType("text"); + + b.Property("LogUsernames") + .HasColumnType("boolean"); + + b.Property("MigrationVersion") + .HasColumnType("integer"); + + b.Property("MinimumBetAmount") + .HasColumnType("integer"); + + b.Property("OkColor") + .HasColumnType("text"); + + b.Property("PermissionVersion") + .HasColumnType("integer"); + + b.Property("RemindMessageFormat") + .HasColumnType("text"); + + b.Property("RotatingStatuses") + .HasColumnType("boolean"); + + b.Property("TriviaCurrencyReward") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("BotConfig"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandAlias", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Mapping") + .HasColumnType("text"); + + b.Property("Trigger") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("CommandAlias"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandCooldown", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CommandName") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Seconds") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("CommandCooldown"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandPrice", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("CommandName") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Price") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.HasIndex("Price") + .IsUnique(); + + b.ToTable("CommandPrice"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Currency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Amount") + .HasColumnType("bigint"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Currency"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CurrencyTransaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Amount") + .HasColumnType("bigint"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Reason") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("CurrencyTransactions"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CustomReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AutoDeleteTrigger") + .HasColumnType("boolean"); + + b.Property("ContainsAnywhere") + .HasColumnType("boolean"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DmResponse") + .HasColumnType("boolean"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("IsRegex") + .HasColumnType("boolean"); + + b.Property("OwnerOnly") + .HasColumnType("boolean"); + + b.Property("Response") + .HasColumnType("text"); + + b.Property("Trigger") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CustomReactions"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.DailyMoney", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LastTimeGotten") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("DailyMoney"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.DailyMoneyStats", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("MoneyReceived") + .HasColumnType("bigint"); + + b.Property("TimeReceived") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("DailyMoneyStats"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Donator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Donators"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.EightBallResponse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("EightBallResponse"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilterChannelId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("GuildConfigId1") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.HasIndex("GuildConfigId1"); + + b.ToTable("FilterChannelId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilteredWord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Word") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("FilteredWord"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FollowedStream", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("Username") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("FollowedStream"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GCChannelId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("GCChannelId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AdditionalVerificationUsers") + .HasColumnType("text"); + + b.Property("AutoAssignRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("AutoDeleteByeMessages") + .HasColumnType("boolean"); + + b.Property("AutoDeleteByeMessagesTimer") + .HasColumnType("integer"); + + b.Property("AutoDeleteGreetMessages") + .HasColumnType("boolean"); + + b.Property("AutoDeleteGreetMessagesTimer") + .HasColumnType("integer"); + + b.Property("AutoDeleteSelfAssignedRoleMessages") + .HasColumnType("boolean"); + + b.Property("BirthdayMessage") + .HasColumnType("text"); + + b.Property("BirthdayMessageChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("BirthdayMoney") + .HasColumnType("bigint"); + + b.Property("BirthdayRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("BirthdaysEnabled") + .HasColumnType("boolean"); + + b.Property("ByeMessageChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelByeMessageText") + .HasColumnType("text"); + + b.Property("ChannelGreetMessageText") + .HasColumnType("text"); + + b.Property("CleverbotEnabled") + .HasColumnType("boolean"); + + b.Property("CountToNumberChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("CountToNumberMessageChance") + .HasColumnType("double precision"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DefaultMusicVolume") + .HasColumnType("real"); + + b.Property("DeleteMessageOnCommand") + .HasColumnType("boolean"); + + b.Property("DmGreetMessageText") + .HasColumnType("text"); + + b.Property("ExclusiveSelfAssignedRoles") + .HasColumnType("boolean"); + + b.Property("FilterInvites") + .HasColumnType("boolean"); + + b.Property("FilterWords") + .HasColumnType("boolean"); + + b.Property("FilterZalgo") + .HasColumnType("boolean"); + + b.Property("ForumNotificationChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("GameVoiceChannel") + .HasColumnType("numeric(20,0)"); + + b.Property("GommeTeamMemberRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("GreetMessageChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Locale") + .HasColumnType("text"); + + b.Property("LogSettingId") + .HasColumnType("integer"); + + b.Property("LogUsernameHistory") + .HasColumnType("boolean"); + + b.Property("MessageXpCharCountMax") + .HasColumnType("integer"); + + b.Property("MessageXpCharCountMin") + .HasColumnType("integer"); + + b.Property("MessageXpTimeDifference") + .HasColumnType("double precision"); + + b.Property("MuteRoleName") + .HasColumnType("text"); + + b.Property("PermissionRole") + .HasColumnType("text"); + + b.Property("Prefix") + .HasColumnType("text"); + + b.Property("RootPermissionId") + .HasColumnType("integer"); + + b.Property("SendChannelByeMessage") + .HasColumnType("boolean"); + + b.Property("SendChannelGreetMessage") + .HasColumnType("boolean"); + + b.Property("SendDmGreetMessage") + .HasColumnType("boolean"); + + b.Property("SupportChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("TeamUpdateChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("TeamUpdateMessagePrefix") + .HasColumnType("text"); + + b.Property("TimeZoneId") + .HasColumnType("text"); + + b.Property("TurnToXpMultiplier") + .HasColumnType("double precision"); + + b.Property("VerboseErrors") + .HasColumnType("boolean"); + + b.Property("VerbosePermissions") + .HasColumnType("boolean"); + + b.Property("VerificationPasswordChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("VerificationTutorialText") + .HasColumnType("text"); + + b.Property("VerifiedRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("VerifyString") + .HasColumnType("text"); + + b.Property("VipRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("VoicePlusTextEnabled") + .HasColumnType("boolean"); + + b.Property("WarningsInitialized") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("GuildId") + .IsUnique(); + + b.HasIndex("LogSettingId"); + + b.HasIndex("RootPermissionId"); + + b.ToTable("GuildConfigs"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildRepeater", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Interval") + .HasColumnType("interval"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("StartTimeOfDay") + .HasColumnType("interval"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("GuildRepeater"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredLogChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LogSettingId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LogSettingId"); + + b.ToTable("IgnoredLogChannel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredVoicePresenceChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LogSettingId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LogSettingId"); + + b.ToTable("IgnoredVoicePresenceChannel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.LevelModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CurrentXP") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("TotalXP") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("timestamp") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "UserId") + .IsUnique(); + + b.ToTable("LevelModel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.LogSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelCreated") + .HasColumnType("boolean"); + + b.Property("ChannelCreatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelDestroyed") + .HasColumnType("boolean"); + + b.Property("ChannelDestroyedId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelUpdated") + .HasColumnType("boolean"); + + b.Property("ChannelUpdatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("IsLogging") + .HasColumnType("boolean"); + + b.Property("LogOtherId") + .HasColumnType("numeric(20,0)"); + + b.Property("LogUserPresence") + .HasColumnType("boolean"); + + b.Property("LogUserPresenceId") + .HasColumnType("numeric(20,0)"); + + b.Property("LogVoicePresence") + .HasColumnType("boolean"); + + b.Property("LogVoicePresenceId") + .HasColumnType("numeric(20,0)"); + + b.Property("LogVoicePresenceTTSId") + .HasColumnType("numeric(20,0)"); + + b.Property("MessageDeleted") + .HasColumnType("boolean"); + + b.Property("MessageDeletedId") + .HasColumnType("numeric(20,0)"); + + b.Property("MessageUpdated") + .HasColumnType("boolean"); + + b.Property("MessageUpdatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserBanned") + .HasColumnType("boolean"); + + b.Property("UserBannedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserJoined") + .HasColumnType("boolean"); + + b.Property("UserJoinedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserLeft") + .HasColumnType("boolean"); + + b.Property("UserLeftId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserMutedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserPresenceChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserUnbanned") + .HasColumnType("boolean"); + + b.Property("UserUnbannedId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserUpdated") + .HasColumnType("boolean"); + + b.Property("UserUpdatedId") + .HasColumnType("numeric(20,0)"); + + b.Property("VerificationMessages") + .HasColumnType("numeric(20,0)"); + + b.Property("VerificationSteps") + .HasColumnType("numeric(20,0)"); + + b.Property("VoicePresenceChannelId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("LogSetting"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.MessageXpRestriction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "ChannelId") + .IsUnique(); + + b.ToTable("MessageXpRestrictions"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ModulePrefix", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ModuleName") + .HasColumnType("text"); + + b.Property("Prefix") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("ModulePrefix"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.MutedUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("MutedUserId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.NsfwBlacklitedTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Tag") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("NsfwBlacklitedTag"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("NextId") + .HasColumnType("integer"); + + b.Property("PrimaryTarget") + .HasColumnType("integer"); + + b.Property("PrimaryTargetId") + .HasColumnType("numeric(20,0)"); + + b.Property("SecondaryTarget") + .HasColumnType("integer"); + + b.Property("SecondaryTargetName") + .HasColumnType("text"); + + b.Property("State") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("NextId") + .IsUnique(); + + b.ToTable("Permission"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permissionv2", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Index") + .HasColumnType("integer"); + + b.Property("PrimaryTarget") + .HasColumnType("integer"); + + b.Property("PrimaryTargetId") + .HasColumnType("numeric(20,0)"); + + b.Property("SecondaryTarget") + .HasColumnType("integer"); + + b.Property("SecondaryTargetName") + .HasColumnType("text"); + + b.Property("State") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("Permissionv2"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.PlayingStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Status") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("PlayingStatus"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Quote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AuthorId") + .HasColumnType("numeric(20,0)"); + + b.Property("AuthorName") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Keyword") + .IsRequired() + .HasColumnType("text"); + + b.Property("Text") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Quotes"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RaceAnimal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Icon") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("RaceAnimal"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Reminder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("IsPrivate") + .HasColumnType("boolean"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("ServerId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("When") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Reminders"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RewardedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AmountRewardedThisMonth") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("LastReward") + .HasColumnType("timestamp without time zone"); + + b.Property("PatreonUserId") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("RewardedUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RoleLevelBinding", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("MinimumLevel") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId") + .IsUnique(); + + b.ToTable("RoleLevelBinding"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RoleMoney", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Money") + .HasColumnType("bigint"); + + b.Property("Priority") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId") + .IsUnique(); + + b.ToTable("RoleMoney"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SelfAssignedRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "RoleId") + .IsUnique(); + + b.ToTable("SelfAssignableRoles"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AuthorId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Index") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("RoleName") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("ShopEntry"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntryItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ShopEntryId") + .HasColumnType("integer"); + + b.Property("Text") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ShopEntryId"); + + b.ToTable("ShopEntryItem"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("SlowmodeIgnoredRole"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("SlowmodeIgnoredUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StartupCommand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BotConfigId") + .HasColumnType("integer"); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("ChannelName") + .HasColumnType("text"); + + b.Property("CommandText") + .HasColumnType("text"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("GuildName") + .HasColumnType("text"); + + b.Property("Index") + .HasColumnType("integer"); + + b.Property("VoiceChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("VoiceChannelName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BotConfigId"); + + b.ToTable("StartupCommand"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleBlacklistedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("StreamRoleSettingsId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("Username") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StreamRoleSettingsId"); + + b.ToTable("StreamRoleBlacklistedUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AddRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Enabled") + .HasColumnType("boolean"); + + b.Property("FromRoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Keyword") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId") + .IsUnique(); + + b.ToTable("StreamRoleSettings"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleWhitelistedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("StreamRoleSettingsId") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.Property("Username") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("StreamRoleSettingsId"); + + b.ToTable("StreamRoleWhitelistedUser"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.TeamUpdateRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Rankname") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "Rankname") + .IsUnique(); + + b.ToTable("TeamUpdateRank"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.UnmuteTimer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("UnmuteAt") + .HasColumnType("timestamp without time zone"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("UnmuteTimer"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.UsernameHistoryModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("DateReplaced") + .HasColumnType("timestamp without time zone"); + + b.Property("DateSet") + .HasColumnType("timestamp without time zone"); + + b.Property("DiscordDiscriminator") + .HasColumnType("integer"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("UsernameHistory"); + + b.HasDiscriminator("Discriminator").HasValue("UsernameHistoryModel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VcRoleInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("numeric(20,0)"); + + b.Property("VoiceChannelId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("VcRoleInfo"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VerifiedUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("ForumUserId") + .HasColumnType("bigint"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("GuildId", "UserId") + .IsUnique(); + + b.ToTable("VerifiedUsers"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VoiceChannelStats", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("TimeInVoiceChannel") + .HasColumnType("double precision"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "GuildId") + .IsUnique(); + + b.ToTable("VoiceChannelStats"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Warning", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("Forgiven") + .HasColumnType("boolean"); + + b.Property("ForgivenBy") + .HasColumnType("text"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.Property("Moderator") + .HasColumnType("text"); + + b.Property("Reason") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("numeric(20,0)"); + + b.HasKey("Id"); + + b.ToTable("Warnings"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.WarningPunishment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.Property("Punishment") + .HasColumnType("integer"); + + b.Property("Time") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("WarningPunishment"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ZalgoFilterChannel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ChannelId") + .HasColumnType("numeric(20,0)"); + + b.Property("DateAdded") + .HasColumnType("timestamp without time zone"); + + b.Property("GuildConfigId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GuildConfigId"); + + b.ToTable("ZalgoFilterChannel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.NicknameHistoryModel", b => + { + b.HasBaseType("Mitternacht.Services.Database.Models.UsernameHistoryModel"); + + b.Property("GuildId") + .HasColumnType("numeric(20,0)"); + + b.HasDiscriminator().HasValue("NicknameHistoryModel"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiRaidSetting", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", "GuildConfig") + .WithOne("AntiRaidSetting") + .HasForeignKey("Mitternacht.Services.Database.Models.AntiRaidSetting", "GuildConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamIgnore", b => + { + b.HasOne("Mitternacht.Services.Database.Models.AntiSpamSetting", null) + .WithMany("IgnoredChannels") + .HasForeignKey("AntiSpamSettingId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.AntiSpamSetting", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", "GuildConfig") + .WithOne("AntiSpamSetting") + .HasForeignKey("Mitternacht.Services.Database.Models.AntiSpamSetting", "GuildConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlacklistItem", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("Blacklist") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.BlockedCmdOrMdl", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("BlockedCommands") + .HasForeignKey("BotConfigId"); + + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("BlockedModules") + .HasForeignKey("BotConfigId1"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandAlias", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("CommandAliases") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandCooldown", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("CommandCooldowns") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.CommandPrice", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("CommandPrices") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.EightBallResponse", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("EightBallResponses") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilterChannelId", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilterInvitesChannelIds") + .HasForeignKey("GuildConfigId"); + + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilterWordsChannelIds") + .HasForeignKey("GuildConfigId1"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FilteredWord", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilteredWords") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.FollowedStream", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FollowedStreams") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GCChannelId", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("GenerateCurrencyChannelIds") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildConfig", b => + { + b.HasOne("Mitternacht.Services.Database.Models.LogSetting", "LogSetting") + .WithMany() + .HasForeignKey("LogSettingId"); + + b.HasOne("Mitternacht.Services.Database.Models.Permission", "RootPermission") + .WithMany() + .HasForeignKey("RootPermissionId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.GuildRepeater", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("GuildRepeaters") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredLogChannel", b => + { + b.HasOne("Mitternacht.Services.Database.Models.LogSetting", "LogSetting") + .WithMany("IgnoredChannels") + .HasForeignKey("LogSettingId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.IgnoredVoicePresenceChannel", b => + { + b.HasOne("Mitternacht.Services.Database.Models.LogSetting", "LogSetting") + .WithMany("IgnoredVoicePresenceChannelIds") + .HasForeignKey("LogSettingId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ModulePrefix", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("ModulePrefixes") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.MutedUserId", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("MutedUsers") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.NsfwBlacklitedTag", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("NsfwBlacklistedTags") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permission", b => + { + b.HasOne("Mitternacht.Services.Database.Models.Permission", "Next") + .WithOne("Previous") + .HasForeignKey("Mitternacht.Services.Database.Models.Permission", "NextId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.Permissionv2", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("Permissions") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.PlayingStatus", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("RotatingStatusMessages") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.RaceAnimal", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("RaceAnimals") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntry", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("ShopEntries") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ShopEntryItem", b => + { + b.HasOne("Mitternacht.Services.Database.Models.ShopEntry", null) + .WithMany("Items") + .HasForeignKey("ShopEntryId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredRole", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("SlowmodeIgnoredRoles") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.SlowmodeIgnoredUser", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("SlowmodeIgnoredUsers") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StartupCommand", b => + { + b.HasOne("Mitternacht.Services.Database.Models.BotConfig", null) + .WithMany("StartupCommands") + .HasForeignKey("BotConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleBlacklistedUser", b => + { + b.HasOne("Mitternacht.Services.Database.Models.StreamRoleSettings", null) + .WithMany("Blacklist") + .HasForeignKey("StreamRoleSettingsId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleSettings", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", "GuildConfig") + .WithOne("StreamRole") + .HasForeignKey("Mitternacht.Services.Database.Models.StreamRoleSettings", "GuildConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.StreamRoleWhitelistedUser", b => + { + b.HasOne("Mitternacht.Services.Database.Models.StreamRoleSettings", null) + .WithMany("Whitelist") + .HasForeignKey("StreamRoleSettingsId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.UnmuteTimer", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("UnmuteTimers") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.VcRoleInfo", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("VcRoleInfos") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.WarningPunishment", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("WarnPunishments") + .HasForeignKey("GuildConfigId"); + }); + + modelBuilder.Entity("Mitternacht.Services.Database.Models.ZalgoFilterChannel", b => + { + b.HasOne("Mitternacht.Services.Database.Models.GuildConfig", null) + .WithMany("FilterZalgoChannelIds") + .HasForeignKey("GuildConfigId"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/MitternachtBot/Services/Database/IUnitOfWork.cs b/src/MitternachtBot/Services/Database/IUnitOfWork.cs index 77cccdab5..26da4ecca 100644 --- a/src/MitternachtBot/Services/Database/IUnitOfWork.cs +++ b/src/MitternachtBot/Services/Database/IUnitOfWork.cs @@ -6,7 +6,7 @@ namespace Mitternacht.Services.Database { public interface IUnitOfWork : IDisposable { - NadekoContext Context { get; } + MitternachtContext Context { get; } IQuoteRepository Quotes { get; } IGuildConfigRepository GuildConfigs { get; } diff --git a/src/MitternachtBot/Services/Database/MitternachtContext.cs b/src/MitternachtBot/Services/Database/MitternachtContext.cs new file mode 100644 index 000000000..7d474e555 --- /dev/null +++ b/src/MitternachtBot/Services/Database/MitternachtContext.cs @@ -0,0 +1,168 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using Mitternacht.Extensions; +using Mitternacht.Services.Database.Models; + +namespace Mitternacht.Services.Database { + public class MitternachtContextFactory : IDesignTimeDbContextFactory { + public MitternachtContext CreateDbContext(string[] args) { + var optionsBuilder = new DbContextOptionsBuilder(); + optionsBuilder.UseNpgsql("Host=127.0.0.1;Port=5432;Database=mitternachtbot_development;Username=mitternachtbottest;Password=mitternachtbottestpassword;"); + var ctx = new MitternachtContext(optionsBuilder.Options); + ctx.Database.SetCommandTimeout(60); + return ctx; + } + } + + public class MitternachtContext : DbContext { + public DbSet BirthDates { get; set; } + public DbSet BotConfig { get; set; } + public DbSet Currency { get; set; } + public DbSet CurrencyTransactions { get; set; } + public DbSet CustomReactions { get; set; } + public DbSet DailyMoney { get; set; } + public DbSet DailyMoneyStats { get; set; } + public DbSet Donators { get; set; } + public DbSet GuildConfigs { get; set; } + public DbSet LevelModel { get; set; } + public DbSet MessageXpRestrictions { get; set; } + public DbSet NicknameHistory { get; set; } + public DbSet Quotes { get; set; } + public DbSet Reminders { get; set; } + public DbSet RoleLevelBinding { get; set; } + public DbSet RoleMoney { get; set; } + public DbSet SelfAssignableRoles { get; set; } + public DbSet TeamUpdateRank { get; set; } + public DbSet UsernameHistory { get; set; } + public DbSet VerifiedUsers { get; set; } + public DbSet VoiceChannelStats { get; set; } + public DbSet Warnings { get; set; } + + public MitternachtContext() { + + } + + public MitternachtContext(DbContextOptions options) : base(options) { + } + + public void EnsureSeedData() { + if(BotConfig.Any()) + return; + var bc = new BotConfig(); + + bc.RaceAnimals.AddRange(new HashSet { + new RaceAnimal { Icon = "🐼", Name = "Panda" }, + new RaceAnimal { Icon = "🐻", Name = "Bear" }, + new RaceAnimal { Icon = "🐧", Name = "Pengu" }, + new RaceAnimal { Icon = "🐨", Name = "Koala" }, + new RaceAnimal { Icon = "🐬", Name = "Dolphin" }, + new RaceAnimal { Icon = "🐞", Name = "Ladybird" }, + new RaceAnimal { Icon = "🦀", Name = "Crab" }, + new RaceAnimal { Icon = "🦄", Name = "Unicorn" } + }); + bc.EightBallResponses.AddRange(new HashSet { + new EightBallResponse { Text = "Most definitely yes" }, + new EightBallResponse { Text = "For sure" }, + new EightBallResponse { Text = "Totally!" }, + new EightBallResponse { Text = "Of course!" }, + new EightBallResponse { Text = "As I see it, yes" }, + new EightBallResponse { Text = "My sources say yes" }, + new EightBallResponse { Text = "Yes" }, + new EightBallResponse { Text = "Most likely" }, + new EightBallResponse { Text = "Perhaps" }, + new EightBallResponse { Text = "Maybe" }, + new EightBallResponse { Text = "Not sure" }, + new EightBallResponse { Text = "It is uncertain" }, + new EightBallResponse { Text = "Ask me again later" }, + new EightBallResponse { Text = "Don't count on it" }, + new EightBallResponse { Text = "Probably not" }, + new EightBallResponse { Text = "Very doubtful" }, + new EightBallResponse { Text = "Most likely no" }, + new EightBallResponse { Text = "Nope" }, + new EightBallResponse { Text = "No" }, + new EightBallResponse { Text = "My sources say no" }, + new EightBallResponse { Text = "Dont even think about it" }, + new EightBallResponse { Text = "Definitely no" }, + new EightBallResponse { Text = "NO - It may cause disease contraction" } + }); + + BotConfig.Add(bc); + + SaveChanges(); + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) { + modelBuilder.Entity() + .HasIndex(d => d.UserId) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(c => c.UserId) + .IsUnique(); + modelBuilder.Entity() + .HasIndex(c => c.RoleId) + .IsUnique(); + modelBuilder.Entity() + .HasIndex(c => new { c.GuildId, c.UserId }) + .IsUnique(); + modelBuilder.Entity() + .HasIndex(c => c.RoleId) + .IsUnique(); + modelBuilder.Entity() + .HasIndex(c => new { c.GuildId, c.ChannelId }) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(c => c.GuildId) + .IsUnique(); + modelBuilder.Entity() + .HasOne(x => x.GuildConfig) + .WithOne(x => x.AntiSpamSetting); + modelBuilder.Entity() + .HasOne(x => x.GuildConfig) + .WithOne(x => x.AntiRaidSetting); + modelBuilder.Entity() + .HasOne(x => x.GuildConfig) + .WithOne(x => x.StreamRole); + + modelBuilder.Entity() + .HasIndex(s => (new { s.GuildId, s.RoleId })) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(c => c.UserId) + .IsUnique(); + + modelBuilder.Entity() + .HasOne(p => p.Next) + .WithOne(p => p.Previous) + .IsRequired(false); + + modelBuilder.Entity() + .HasIndex(cp => cp.Price) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(x => x.UserId) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(vu => new { vu.GuildId, vu.UserId }) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(bdm => bdm.UserId) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(vcs => new { vcs.UserId, vcs.GuildId }) + .IsUnique(); + + modelBuilder.Entity() + .HasIndex(tur => new { tur.GuildId, tur.Rankname }) + .IsUnique(); + } + } +} diff --git a/src/MitternachtBot/Services/Database/UnitOfWork.cs b/src/MitternachtBot/Services/Database/UnitOfWork.cs index 4a79d6248..694daffd9 100644 --- a/src/MitternachtBot/Services/Database/UnitOfWork.cs +++ b/src/MitternachtBot/Services/Database/UnitOfWork.cs @@ -5,7 +5,7 @@ namespace Mitternacht.Services.Database { public class UnitOfWork : IUnitOfWork { - public NadekoContext Context { get; } + public MitternachtContext Context { get; } private IQuoteRepository _quotes; public IQuoteRepository Quotes => _quotes ??= new QuoteRepository(Context); @@ -52,7 +52,7 @@ public class UnitOfWork : IUnitOfWork { private ITeamUpdateRankRepository _teamUpdateRank; public ITeamUpdateRankRepository TeamUpdateRank => _teamUpdateRank ??= new TeamUpdateRankRepository(Context); - public UnitOfWork(NadekoContext context) { + public UnitOfWork(MitternachtContext context) { Context = context; } diff --git a/src/MitternachtBot/Services/DbService.cs b/src/MitternachtBot/Services/DbService.cs index c58f3fc8c..61e5fee3c 100644 --- a/src/MitternachtBot/Services/DbService.cs +++ b/src/MitternachtBot/Services/DbService.cs @@ -1,36 +1,120 @@ using Microsoft.EntityFrameworkCore; using Mitternacht.Services.Database; +using Mitternacht.Services.Database.Models; +using NLog; +using System; +using System.Linq; namespace Mitternacht.Services { public class DbService { - private readonly DbContextOptions _options; + private readonly DbContextOptions _optionsSqlite; + private readonly DbContextOptions _optionsPostgres; public DbService(IBotCredentials creds) { - var optionsBuilder = new DbContextOptionsBuilder(); - optionsBuilder.UseSqlite(creds.DbConnectionString); - _options = optionsBuilder.Options; + var optionsBuilderSqlite = new DbContextOptionsBuilder(); + optionsBuilderSqlite.UseSqlite(creds.DbConnectionString); + _optionsSqlite = optionsBuilderSqlite.Options; + + var optionsBuilderPostgres = new DbContextOptionsBuilder(); + optionsBuilderPostgres.UseNpgsql(creds.DbConnection); + _optionsPostgres = optionsBuilderPostgres.Options; } - public NadekoContext GetDbContext() { - var context = new NadekoContext(_options); + public MitternachtContext GetDbContext() { + var context = new MitternachtContext(_optionsPostgres); context.Database.SetCommandTimeout(60); - context.Database.Migrate(); + MigrateSqliteToPostgresOrMigrate(context); context.EnsureSeedData(); - //set important sqlite stuffs - var conn = context.Database.GetDbConnection(); - conn.Open(); + return context; + } + + private NadekoContext GetDbContextSqlite() { + var context = new NadekoContext(_optionsSqlite); + if(context.Database.CanConnect()) { + context.Database.SetCommandTimeout(60); + context.Database.Migrate(); + context.EnsureSeedData(); + + //set important sqlite stuffs + var conn = context.Database.GetDbConnection(); + conn.Open(); - context.Database.ExecuteSqlRaw("PRAGMA journal_mode=WAL"); - using(var com = conn.CreateCommand()) { - com.CommandText = "PRAGMA journal_mode=WAL; PRAGMA synchronous=OFF"; - com.ExecuteNonQuery(); + context.Database.ExecuteSqlRaw("PRAGMA journal_mode=WAL"); + using(var com = conn.CreateCommand()) { + com.CommandText = "PRAGMA journal_mode=WAL; PRAGMA synchronous=OFF"; + com.ExecuteNonQuery(); + } + + return context; + } else { + return null; } + } - return context; + private void MigrateSqliteToPostgresOrMigrate(MitternachtContext pgsql) { + NadekoContext sqlite; + var logger = LogManager.GetCurrentClassLogger(); + + if(pgsql.Database.GetAppliedMigrations().Count() == 0 && (sqlite = GetDbContextSqlite()) != null) { + logger.Info("Performing first MitternachtContext migration, copying data from SQLite database to PostgreSQL..."); + + pgsql.Database.Migrate(); + + static void CopyData(DbSet source, DbSet destination) where T : DbEntity { + destination.AddRange(source.AsEnumerable().OrderBy((Func)(t => t.DateAdded ?? DateTime.MinValue)).ToList()); + } + + var dbEntities = 0; + var nonDbEntities = 0; + + void stateChanged(object obj, Microsoft.EntityFrameworkCore.ChangeTracking.EntityStateChangedEventArgs e) { + if(e.OldState == EntityState.Added || e.NewState == EntityState.Added) { + if(e.Entry.Entity is DbEntity dbEntity) { + dbEntities++; + dbEntity.Id = 0; + } else { + nonDbEntities++; + } + } + } + pgsql.ChangeTracker.StateChanged += stateChanged; + + CopyData(sqlite.BirthDates, pgsql.BirthDates); + CopyData(sqlite.BotConfig, pgsql.BotConfig); + CopyData(sqlite.Currency, pgsql.Currency); + CopyData(sqlite.CurrencyTransactions, pgsql.CurrencyTransactions); + CopyData(sqlite.CustomReactions, pgsql.CustomReactions); + CopyData(sqlite.DailyMoney, pgsql.DailyMoney); + CopyData(sqlite.DailyMoneyStats, pgsql.DailyMoneyStats); + CopyData(sqlite.Donators, pgsql.Donators); + CopyData(sqlite.GuildConfigs, pgsql.GuildConfigs); + CopyData(sqlite.LevelModel, pgsql.LevelModel); + CopyData(sqlite.MessageXpRestrictions, pgsql.MessageXpRestrictions); + CopyData(sqlite.NicknameHistory, pgsql.NicknameHistory); + CopyData(sqlite.Quotes, pgsql.Quotes); + CopyData(sqlite.Reminders, pgsql.Reminders); + CopyData(sqlite.RoleLevelBinding, pgsql.RoleLevelBinding); + CopyData(sqlite.RoleMoney, pgsql.RoleMoney); + CopyData(sqlite.SelfAssignableRoles, pgsql.SelfAssignableRoles); + CopyData(sqlite.TeamUpdateRank, pgsql.TeamUpdateRank); + CopyData(sqlite.UsernameHistory, pgsql.UsernameHistory); + CopyData(sqlite.VerifiedUsers, pgsql.VerifiedUsers); + CopyData(sqlite.VoiceChannelStats, pgsql.VoiceChannelStats); + CopyData(sqlite.Warnings, pgsql.Warnings); + + pgsql.SaveChanges(); + + LogManager.GetCurrentClassLogger().Info($"Copied {dbEntities} entities, found {nonDbEntities} non-DbEntities during the process."); + pgsql.ChangeTracker.StateChanged -= stateChanged; + } else { + pgsql.Database.Migrate(); + } } public IUnitOfWork UnitOfWork => new UnitOfWork(GetDbContext()); + + } } \ No newline at end of file diff --git a/src/MitternachtBot/Services/IBotCredentials.cs b/src/MitternachtBot/Services/IBotCredentials.cs index 1affc785f..9fe8ea400 100644 --- a/src/MitternachtBot/Services/IBotCredentials.cs +++ b/src/MitternachtBot/Services/IBotCredentials.cs @@ -7,7 +7,8 @@ public interface IBotCredentials { string Token { get; } ImmutableArray OwnerIds { get; } string DbConnectionString { get; } - + string DbConnection { get; } + string GoogleApiKey { get; } string MashapeKey { get; } string LoLApiKey { get; } diff --git a/src/MitternachtBot/Services/Impl/BotCredentials.cs b/src/MitternachtBot/Services/Impl/BotCredentials.cs index a1dbb3957..ead6598b9 100644 --- a/src/MitternachtBot/Services/Impl/BotCredentials.cs +++ b/src/MitternachtBot/Services/Impl/BotCredentials.cs @@ -11,6 +11,7 @@ public class BotCredentials : IBotCredentials { public ulong ClientId { get; set; } = 0; public string Token { get; set; } = ""; public string DbConnectionString { get; set; } = "Filename=./data/MitternachtBot.db"; + public string DbConnection { get; set; } = "Host=127.0.0.1;Port=5432;Database=mitternachtbot;Username=mitternachtbot;Password=mitternachtbotpassword;"; public ImmutableArray OwnerIds { get; set; } = new ulong[1].ToImmutableArray();