add: Added .cleanupguilddata command which will delete all guildconfigs, xp stats and other data related to any guild the bot is no longer in. This is a highly destructive and irreversible command.

dev: Added cascade deletes to any tables which have guildconfigs FK, as well as to some other missing places
This commit is contained in:
Kwoth
2024-05-18 16:09:54 +00:00
parent 03fb1a5ca2
commit 0c167a9382
28 changed files with 13286 additions and 273 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,701 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations
{
/// <inheritdoc />
public partial class guidlconfigcleanup : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting");
migrationBuilder.DropForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias");
migrationBuilder.DropForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown");
migrationBuilder.DropForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel");
migrationBuilder.DropForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem");
migrationBuilder.DropForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord");
migrationBuilder.DropForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream");
migrationBuilder.DropForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId");
migrationBuilder.DropForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId");
migrationBuilder.DropForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser");
migrationBuilder.DropForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer");
migrationBuilder.DropForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo");
migrationBuilder.DropForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment");
migrationBuilder.DropTable(
name: "IgnoredVoicePresenceCHannels");
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "GuildConfigId",
table: "DelMsgOnCmdChannel",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore",
column: "AntiSpamSettingId",
principalTable: "AntiSpamSetting",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem",
column: "XpSettingsId",
principalTable: "XpSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem",
column: "ShopEntryId",
principalTable: "ShopEntry",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore");
migrationBuilder.DropForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting");
migrationBuilder.DropForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias");
migrationBuilder.DropForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown");
migrationBuilder.DropForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel");
migrationBuilder.DropForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem");
migrationBuilder.DropForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord");
migrationBuilder.DropForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId");
migrationBuilder.DropForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream");
migrationBuilder.DropForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId");
migrationBuilder.DropForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId");
migrationBuilder.DropForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry");
migrationBuilder.DropForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole");
migrationBuilder.DropForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser");
migrationBuilder.DropForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser");
migrationBuilder.DropForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer");
migrationBuilder.DropForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer");
migrationBuilder.DropForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo");
migrationBuilder.DropForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment");
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AlterColumn<int>(
name: "StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AlterColumn<int>(
name: "GuildConfigId",
table: "DelMsgOnCmdChannel",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.CreateTable(
name: "IgnoredVoicePresenceCHannels",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
LogSettingId = table.Column<int>(type: "INTEGER", nullable: true),
ChannelId = table.Column<ulong>(type: "INTEGER", nullable: false),
DateAdded = table.Column<DateTime>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IgnoredVoicePresenceCHannels", x => x.Id);
table.ForeignKey(
name: "FK_IgnoredVoicePresenceCHannels_LogSettings_LogSettingId",
column: x => x.LogSettingId,
principalTable: "LogSettings",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_IgnoredVoicePresenceCHannels_LogSettingId",
table: "IgnoredVoicePresenceCHannels",
column: "LogSettingId");
migrationBuilder.AddForeignKey(
name: "FK_AntiRaidSetting_GuildConfigs_GuildConfigId",
table: "AntiRaidSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamIgnore_AntiSpamSetting_AntiSpamSettingId",
table: "AntiSpamIgnore",
column: "AntiSpamSettingId",
principalTable: "AntiSpamSetting",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_AntiSpamSetting_GuildConfigs_GuildConfigId",
table: "AntiSpamSetting",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandAlias_GuildConfigs_GuildConfigId",
table: "CommandAlias",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CommandCooldown_GuildConfigs_GuildConfigId",
table: "CommandCooldown",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_DelMsgOnCmdChannel_GuildConfigs_GuildConfigId",
table: "DelMsgOnCmdChannel",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ExcludedItem_XpSettings_XpSettingsId",
table: "ExcludedItem",
column: "XpSettingsId",
principalTable: "XpSettings",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilterChannelId_GuildConfigs_GuildConfigId",
table: "FilterChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilteredWord_GuildConfigs_GuildConfigId",
table: "FilteredWord",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilterLinksChannelId_GuildConfigs_GuildConfigId",
table: "FilterLinksChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FilterWordsChannelId_GuildConfigs_GuildConfigId",
table: "FilterWordsChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_FollowedStream_GuildConfigs_GuildConfigId",
table: "FollowedStream",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_GCChannelId_GuildConfigs_GuildConfigId",
table: "GCChannelId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_MutedUserId_GuildConfigs_GuildConfigId",
table: "MutedUserId",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ShopEntry_GuildConfigs_GuildConfigId",
table: "ShopEntry",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ShopEntryItem_ShopEntry_ShopEntryId",
table: "ShopEntryItem",
column: "ShopEntryId",
principalTable: "ShopEntry",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredRole_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredRole",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_SlowmodeIgnoredUser_GuildConfigs_GuildConfigId",
table: "SlowmodeIgnoredUser",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleBlacklistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleBlacklistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_StreamRoleWhitelistedUser_StreamRoleSettings_StreamRoleSettingsId",
table: "StreamRoleWhitelistedUser",
column: "StreamRoleSettingsId",
principalTable: "StreamRoleSettings",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UnbanTimer_GuildConfigs_GuildConfigId",
table: "UnbanTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UnmuteTimer_GuildConfigs_GuildConfigId",
table: "UnmuteTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UnroleTimer_GuildConfigs_GuildConfigId",
table: "UnroleTimer",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_VcRoleInfo_GuildConfigs_GuildConfigId",
table: "VcRoleInfo",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_WarningPunishment_GuildConfigs_GuildConfigId",
table: "WarningPunishment",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
}
}
}

View File

@@ -501,7 +501,7 @@ namespace NadekoBot.Migrations
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("GuildConfigId")
b.Property<int>("GuildConfigId")
.HasColumnType("INTEGER");
b.Property<bool>("State")
@@ -1059,28 +1059,6 @@ namespace NadekoBot.Migrations
b.ToTable("IgnoredLogChannels");
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<ulong>("ChannelId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("LogSettingId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("LogSettingId");
b.ToTable("IgnoredVoicePresenceCHannels");
});
modelBuilder.Entity("NadekoBot.Db.Models.ImageOnlyChannel", b =>
{
b.Property<int>("Id")
@@ -1867,7 +1845,7 @@ namespace NadekoBot.Migrations
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("INTEGER");
b.Property<ulong>("UserId")
@@ -1924,7 +1902,7 @@ namespace NadekoBot.Migrations
b.Property<DateTime?>("DateAdded")
.HasColumnType("TEXT");
b.Property<int?>("StreamRoleSettingsId")
b.Property<int>("StreamRoleSettingsId")
.HasColumnType("INTEGER");
b.Property<ulong>("UserId")
@@ -2397,31 +2375,28 @@ namespace NadekoBot.Migrations
modelBuilder.Entity("NadekoBot.Db.Models.AntiRaidSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiRaidSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiRaidSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamIgnore", b =>
{
b.HasOne("NadekoBot.Db.Models.AntiSpamSetting", null)
.WithMany("IgnoredChannels")
.HasForeignKey("AntiSpamSettingId");
.HasForeignKey("AntiSpamSettingId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.AntiSpamSetting", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithOne("AntiSpamSetting")
.HasForeignKey("NadekoBot.Db.Models.AntiSpamSetting", "GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GuildConfig");
});
modelBuilder.Entity("NadekoBot.Db.Models.AutoTranslateUser", b =>
@@ -2487,21 +2462,25 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandAliases")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.CommandCooldown", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("CommandCooldowns")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.DelMsgOnCmdChannel", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("DelMsgOnCmdChannels")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("NadekoBot.Db.Models.DiscordUser", b =>
@@ -2516,9 +2495,12 @@ namespace NadekoBot.Migrations
modelBuilder.Entity("NadekoBot.Db.Models.ExcludedItem", b =>
{
b.HasOne("NadekoBot.Db.Models.XpSettings", null)
b.HasOne("NadekoBot.Db.Models.XpSettings", "XpSettings")
.WithMany("ExclusionList")
.HasForeignKey("XpSettingsId");
.HasForeignKey("XpSettingsId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("XpSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.FeedSub", b =>
@@ -2536,42 +2518,48 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterInvitesChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FilterLinksChannelId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterLinksChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FilterWordsChannelId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilterWordsChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FilteredWord", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FilteredWords")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.FollowedStream", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("FollowedStreams")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.GCChannelId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", "GuildConfig")
.WithMany("GenerateCurrencyChannelIds")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("GuildConfig");
});
@@ -2607,27 +2595,20 @@ namespace NadekoBot.Migrations
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.IgnoredVoicePresenceChannel", b =>
{
b.HasOne("NadekoBot.Db.Models.LogSetting", "LogSetting")
.WithMany()
.HasForeignKey("LogSettingId");
b.Navigation("LogSetting");
});
modelBuilder.Entity("NadekoBot.Db.Models.MutedUserId", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("MutedUsers")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.Permissionv2", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("Permissions")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.PlaylistSong", b =>
@@ -2642,35 +2623,43 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("ShopEntries")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.ShopEntryItem", b =>
{
b.HasOne("NadekoBot.Db.Models.ShopEntry", null)
.WithMany("Items")
.HasForeignKey("ShopEntryId");
.HasForeignKey("ShopEntryId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.SlowmodeIgnoredRole", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredRoles")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.SlowmodeIgnoredUser", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("SlowmodeIgnoredUsers")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleBlacklistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Blacklist")
.HasForeignKey("StreamRoleSettingsId");
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleSettings", b =>
@@ -2686,9 +2675,13 @@ namespace NadekoBot.Migrations
modelBuilder.Entity("NadekoBot.Db.Models.StreamRoleWhitelistedUser", b =>
{
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", null)
b.HasOne("NadekoBot.Db.Models.StreamRoleSettings", "StreamRoleSettings")
.WithMany("Whitelist")
.HasForeignKey("StreamRoleSettingsId");
.HasForeignKey("StreamRoleSettingsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("StreamRoleSettings");
});
modelBuilder.Entity("NadekoBot.Db.Models.TodoModel", b =>
@@ -2703,28 +2696,32 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnbanTimer")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.UnmuteTimer", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnmuteTimers")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.UnroleTimer", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("UnroleTimer")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.VcRoleInfo", b =>
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("VcRoleInfos")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.WaifuInfo", b =>
@@ -2786,7 +2783,8 @@ namespace NadekoBot.Migrations
{
b.HasOne("NadekoBot.Db.Models.GuildConfig", null)
.WithMany("WarnPunishments")
.HasForeignKey("GuildConfigId");
.HasForeignKey("GuildConfigId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("NadekoBot.Db.Models.XpCurrencyReward", b =>