<commit_before>﻿using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

namespace Modix.Data.Migrations
{
    public partial class DesignatedChannels : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ConfigurationActions_ModerationLogChannelMappings_Moderatio~",
                table: "ConfigurationActions");

            migrationBuilder.DropTable(
                name: "ModerationLogChannelMappings");

            migrationBuilder.RenameColumn(
                name: "CreateActionID",
                table: "ModerationMuteRoleMappings",
                newName: "CreateActionId");

            migrationBuilder.RenameIndex(
                name: "IX_ModerationMuteRoleMappings_CreateActionID",
                table: "ModerationMuteRoleMappings",
                newName: "IX_ModerationMuteRoleMappings_CreateActionId");

            migrationBuilder.RenameColumn(
                name: "ModerationLogChannelMappingId",
                table: "ConfigurationActions",
                newName: "DesignatedChannelMappingId");

            migrationBuilder.RenameIndex(
                name: "IX_ConfigurationActions_ModerationLogChannelMappingId",
                table: "ConfigurationActions",
                newName: "IX_ConfigurationActions_DesignatedChannelMappingId");

            migrationBuilder.CreateTable(
                name: "DesignatedChannelMappings",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    GuildId = table.Column<long>(nullable: false),
                    ChannelId = table.Column<long>(nullable: false),
                    ChannelDesignation = table.Column<string>(nullable: false),
                    CreateActionId = table.Column<long>(nullable: false),
                    DeleteActionId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DesignatedChannelMappings", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DesignatedChannelMappings_ConfigurationActions_CreateAction~",
                        column: x => x.CreateActionId,
                        principalTable: "ConfigurationActions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_DesignatedChannelMappings_ConfigurationActions_DeleteAction~",
                        column: x => x.DeleteActionId,
                        principalTable: "ConfigurationActions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_DesignatedChannelMappings_CreateActionId",
                table: "DesignatedChannelMappings",
                column: "CreateActionId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_DesignatedChannelMappings_DeleteActionId",
                table: "DesignatedChannelMappings",
                column: "DeleteActionId",
                unique: true);

            migrationBuilder.AddForeignKey(<commit_msg>Added data migration for ModerationLogChannelMappings<commit_after>﻿using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

namespace Modix.Data.Migrations
{
    public partial class DesignatedChannels : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ConfigurationActions_ModerationLogChannelMappings_Moderatio~",
                table: "ConfigurationActions");

            migrationBuilder.RenameColumn(
                name: "CreateActionID",
                table: "ModerationMuteRoleMappings",
                newName: "CreateActionId");

            migrationBuilder.RenameIndex(
                name: "IX_ModerationMuteRoleMappings_CreateActionID",
                table: "ModerationMuteRoleMappings",
                newName: "IX_ModerationMuteRoleMappings_CreateActionId");

            migrationBuilder.RenameColumn(
                name: "ModerationLogChannelMappingId",
                table: "ConfigurationActions",
                newName: "DesignatedChannelMappingId");

            migrationBuilder.RenameIndex(
                name: "IX_ConfigurationActions_ModerationLogChannelMappingId",
                table: "ConfigurationActions",
                newName: "IX_ConfigurationActions_DesignatedChannelMappingId");

            migrationBuilder.CreateTable(
                name: "DesignatedChannelMappings",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    GuildId = table.Column<long>(nullable: false),
                    ChannelId = table.Column<long>(nullable: false),
                    ChannelDesignation = table.Column<string>(nullable: false),
                    CreateActionId = table.Column<long>(nullable: false),
                    DeleteActionId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DesignatedChannelMappings", x => x.Id);
                    table.ForeignKey(
                        name: "FK_DesignatedChannelMappings_ConfigurationActions_CreateAction~",
                        column: x => x.CreateActionId,
                        principalTable: "ConfigurationActions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_DesignatedChannelMappings_ConfigurationActions_DeleteAction~",
                        column: x => x.DeleteActionId,
                        principalTable: "ConfigurationActions",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_DesignatedChannelMappings_CreateActionId",
                table: "DesignatedChannelMappings",
                column: "CreateActionId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_DesignatedChannelMappings_DeleteActionId",
                table: "DesignatedChannelMappings",
                column: "DeleteActionId",
                unique: true);

            migrationBuilder.Sql(
                @"INSERT INTO `DesignatedChannelMappings` (`Id`, `GuildId`, `ChannelId`, `ChannelDesignation`, `CreateActionId`)
                  SELECT `Id`, `GuildId`, `LogChannelId`, 'ModerationLog', `CreateActionID`
                  FROM `ModerationLogChannelMappings`;"
                .Replace('`', '"'));

            migrationBuilder.DropTable(
                name: "ModerationLogChannelMappings");

            migrationBuilder.AddForeignKey(
{'fraction_non_alphanumeric': 0.07764924877011035, 'fraction_numerical': 0.0, 'mean_word_length': 1.8742835307604127, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4820950', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1665, 'n_words': 273}