[backend/database] Normalize note text & user bio line endings
This commit is contained in:
parent
9865f3dde7
commit
2453e0f673
1 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
[DbContext(typeof(DatabaseContext))]
|
||||||
|
[Migration("20241214231301_NormalizeMfmLineEndings")]
|
||||||
|
public partial class NormalizeMfmLineEndings : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql("""
|
||||||
|
UPDATE "note" SET "text" = regexp_replace("text", '\r\n', '\n', 'g') WHERE "text" ~ '\r\n';
|
||||||
|
UPDATE "note" SET "text" = regexp_replace("text", '\r', '\n', 'g') WHERE "text" ~ '\r';
|
||||||
|
UPDATE "user_profile" SET "description" = regexp_replace("description", '\r\n', '\n', 'g') WHERE "description" ~ '\r\n';
|
||||||
|
UPDATE "user_profile" SET "description" = regexp_replace("description", '\r', '\n', 'g') WHERE "description" ~ '\r';
|
||||||
|
""");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue