Reverted all v5 migrations back to v4

This commit is contained in:
Kwoth
2024-05-02 23:29:56 +00:00
parent 48e51784da
commit 4fc0cded15
152 changed files with 184332 additions and 48279 deletions

View File

@@ -0,0 +1,118 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NadekoBot.Migrations
{
public partial class crsrenametoexpressionspermrename : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Permissionv2_GuildConfigs_GuildConfigId",
table: "Permissionv2");
migrationBuilder.DropPrimaryKey(
name: "PK_Permissionv2",
table: "Permissionv2");
migrationBuilder.DropPrimaryKey(
name: "PK_CustomReactions",
table: "CustomReactions");
migrationBuilder.RenameTable(
name: "Permissionv2",
newName: "Permissions");
migrationBuilder.RenameTable(
name: "CustomReactions",
newName: "Expressions");
migrationBuilder.RenameIndex(
name: "IX_Permissionv2_GuildConfigId",
table: "Permissions",
newName: "IX_Permissions_GuildConfigId");
migrationBuilder.AddPrimaryKey(
name: "PK_Permissions",
table: "Permissions",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_Expressions",
table: "Expressions",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
migrationBuilder.Sql(@"UPDATE Permissions
SET SecondaryTargetName='ACTUALEXPRESSIONS'
WHERE SecondaryTargetName='ActualCustomReactions' COLLATE NOCASE;");
migrationBuilder.Sql(@"UPDATE Permissions
SET SecondaryTargetName='EXPRESSIONS'
WHERE SecondaryTargetName='CustomReactions' COLLATE NOCASE;");
migrationBuilder.Sql(@"UPDATE Permissions
SET SecondaryTargetName= case lower(SecondaryTargetName)
WHEN 'editcustreact' THEN 'expredit'
WHEN 'delcustreact' THEN 'exprdel'
WHEN 'listcustreact' THEN 'exprlist'
WHEN 'addcustreact' THEN 'expradd'
WHEN 'showcustreact' THEN 'exprshow'
ELSE SecondaryTargetName
END
WHERE lower(SecondaryTargetName) in ('editcustreact', 'delcustreact', 'listcustreact', 'addcustreact', 'showcustreact');");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Permissions_GuildConfigs_GuildConfigId",
table: "Permissions");
migrationBuilder.DropPrimaryKey(
name: "PK_Permissions",
table: "Permissions");
migrationBuilder.DropPrimaryKey(
name: "PK_Expressions",
table: "Expressions");
migrationBuilder.RenameTable(
name: "Permissions",
newName: "Permissionv2");
migrationBuilder.RenameTable(
name: "Expressions",
newName: "CustomReactions");
migrationBuilder.RenameIndex(
name: "IX_Permissions_GuildConfigId",
table: "Permissionv2",
newName: "IX_Permissionv2_GuildConfigId");
migrationBuilder.AddPrimaryKey(
name: "PK_Permissionv2",
table: "Permissionv2",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CustomReactions",
table: "CustomReactions",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Permissionv2_GuildConfigs_GuildConfigId",
table: "Permissionv2",
column: "GuildConfigId",
principalTable: "GuildConfigs",
principalColumn: "Id");
}
}
}