using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Nuuru.Server.Migrations.PostgreSQL
{
///
public partial class SetDefaultSearchQueryForExistingUsers : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn(
name: "DefaultSearchQuery",
table: "UserSettings",
type: "character varying(2000)",
maxLength: 2000,
nullable: false,
defaultValue: "-764 -764_(cult) -bbw -child_sexual_abuse_material -cum -daisys_destruction -diaper -dox -femboy -femdom -femquote -fetish -flag:minor_attracted_person -furfag -gangrape -gore -mass_shooter -mass_shooting -meta:flagspam -meta:pornographic_content -nsfw -o9a -order_of_nine_angles -pedophilia -pee -penis -peter_scully -porn -pussy -rape -school_shooter -school_shooting -self_harm -sex -sexy {-shroom ~ shroomcuck} {-soyjak_forum ~ shroomcuck} {-subnas:shrooma ~ shroomcuck} -total_nigger_death -vagina -zoophile -subvariant:shoyta -subvariant:soylita -meta:traced_from_literal_fetish_art -rating:explicit -rating:questionable",
oldClrType: typeof(string),
oldType: "character varying(500)",
oldMaxLength: 500);
// Append the new default query onto all existing users' queries
migrationBuilder.Sql(
"""
UPDATE "UserSettings"
SET "DefaultSearchQuery" = CASE
WHEN "DefaultSearchQuery" = '' THEN '-764 -764_(cult) -bbw -child_sexual_abuse_material -cum -daisys_destruction -diaper -dox -femboy -femdom -femquote -fetish -flag:minor_attracted_person -furfag -gangrape -gore -mass_shooter -mass_shooting -meta:flagspam -meta:pornographic_content -nsfw -o9a -order_of_nine_angles -pedophilia -pee -penis -peter_scully -porn -pussy -rape -school_shooter -school_shooting -self_harm -sex -sexy {-shroom ~ shroomcuck} {-soyjak_forum ~ shroomcuck} {-subnas:shrooma ~ shroomcuck} -total_nigger_death -vagina -zoophile -subvariant:shoyta -subvariant:soylita -meta:traced_from_literal_fetish_art -rating:explicit -rating:questionable'
ELSE "DefaultSearchQuery" || ' -764 -764_(cult) -bbw -child_sexual_abuse_material -cum -daisys_destruction -diaper -dox -femboy -femdom -femquote -fetish -flag:minor_attracted_person -furfag -gangrape -gore -mass_shooter -mass_shooting -meta:flagspam -meta:pornographic_content -nsfw -o9a -order_of_nine_angles -pedophilia -pee -penis -peter_scully -porn -pussy -rape -school_shooter -school_shooting -self_harm -sex -sexy {-shroom ~ shroomcuck} {-soyjak_forum ~ shroomcuck} {-subnas:shrooma ~ shroomcuck} -total_nigger_death -vagina -zoophile -subvariant:shoyta -subvariant:soylita -meta:traced_from_literal_fetish_art -rating:explicit -rating:questionable'
END
""");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn(
name: "DefaultSearchQuery",
table: "UserSettings",
type: "character varying(500)",
maxLength: 500,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(2000)",
oldMaxLength: 2000,
oldDefaultValue: "-764 -764_(cult) -bbw -child_sexual_abuse_material -cum -daisys_destruction -diaper -dox -femboy -femdom -femquote -fetish -flag:minor_attracted_person -furfag -gangrape -gore -mass_shooter -mass_shooting -meta:flagspam -meta:pornographic_content -nsfw -o9a -order_of_nine_angles -pedophilia -pee -penis -peter_scully -porn -pussy -rape -school_shooter -school_shooting -self_harm -sex -sexy {-shroom ~ shroomcuck} {-soyjak_forum ~ shroomcuck} {-subnas:shrooma ~ shroomcuck} -total_nigger_death -vagina -zoophile -subvariant:shoyta -subvariant:soylita -meta:traced_from_literal_fetish_art -rating:explicit -rating:questionable");
}
}
}