[backend/database] Recreate Pronouns column in UserProfile with jsonb

This commit is contained in:
pancakes 2025-01-27 17:12:55 +10:00 committed by Laura Hausmann
parent 664fb73ebb
commit 98611179ea
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
3 changed files with 39 additions and 0 deletions

View file

@ -4656,6 +4656,10 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
.HasColumnType("character varying(32)")
.HasColumnName("pinnedPageId");
b.Property<Dictionary<string, string>>("Pronouns")
.HasColumnType("jsonb")
.HasColumnName("pronouns");
b.Property<string>("Url")
.HasMaxLength(512)
.HasColumnType("character varying(512)")

View file

@ -0,0 +1,32 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Iceshrimp.Backend.Core.Database.Migrations
{
/// <inheritdoc />
[DbContext(typeof(DatabaseContext))]
[Migration("20250127070810_Pronouns")]
public partial class Pronouns : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Dictionary<string, string>>(
name: "pronouns",
table: "user_profile",
type: "jsonb",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "pronouns",
table: "user_profile");
}
}
}

View file

@ -71,6 +71,9 @@ public class UserProfile
[Column("mentions", TypeName = "jsonb")]
public List<Note.MentionedUser> Mentions { get; set; } = null!;
[Column("pronouns", TypeName = "jsonb")]
public Dictionary<string, string>? Pronouns { get; set; }
[ForeignKey(nameof(PinnedPageId))]
[InverseProperty(nameof(Page.UserProfile))]
public virtual Page? PinnedPage { get; set; }