Changes in database for tags to be array integers instead of strings

This commit is contained in:
CakeAndBanana
2025-10-19 18:36:08 +02:00
parent c30190704f
commit ad00f7b078
5 changed files with 1235 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LightlessSyncServer.Migrations
{
/// <inheritdoc />
public partial class AddAndChangeTagsUserGroupProfile : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int[]>(
name: "tags",
table: "user_profile_data",
type: "integer[]",
nullable: true);
migrationBuilder.AlterColumn<int[]>(
name: "tags",
table: "group_profiles",
type: "integer[]",
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "tags",
table: "user_profile_data");
migrationBuilder.AlterColumn<string>(
name: "tags",
table: "group_profiles",
type: "text",
nullable: true,
oldClrType: typeof(int[]),
oldType: "integer[]",
oldNullable: true);
}
}
}

View File

@@ -605,8 +605,8 @@ namespace LightlessSyncServer.Migrations
.HasColumnType("boolean") .HasColumnType("boolean")
.HasColumnName("profile_disabled"); .HasColumnName("profile_disabled");
b.Property<string>("Tags") b.PrimitiveCollection<int[]>("Tags")
.HasColumnType("text") .HasColumnType("integer[]")
.HasColumnName("tags"); .HasColumnName("tags");
b.HasKey("GroupGID") b.HasKey("GroupGID")
@@ -840,6 +840,10 @@ namespace LightlessSyncServer.Migrations
.HasColumnType("boolean") .HasColumnType("boolean")
.HasColumnName("profile_disabled"); .HasColumnName("profile_disabled");
b.PrimitiveCollection<int[]>("Tags")
.HasColumnType("integer[]")
.HasColumnName("tags");
b.Property<string>("UserDescription") b.Property<string>("UserDescription")
.HasColumnType("text") .HasColumnType("text")
.HasColumnName("user_description"); .HasColumnName("user_description");

View File

@@ -13,7 +13,7 @@ public class GroupProfile
public string GroupGID { get; set; } public string GroupGID { get; set; }
public Group Group { get; set; } public Group Group { get; set; }
public string Description { get; set; } public string Description { get; set; }
public string Tags { get; set; } public int[] Tags { get; set; }
public string Base64GroupProfileImage { get; set; } public string Base64GroupProfileImage { get; set; }
public bool IsNSFW { get; set; } = false; public bool IsNSFW { get; set; } = false;
public bool ProfileDisabled { get; set; } = false; public bool ProfileDisabled { get; set; } = false;

View File

@@ -12,6 +12,7 @@ public class UserProfileData
public User User { get; set; } public User User { get; set; }
public string UserDescription { get; set; } public string UserDescription { get; set; }
public int[] Tags { get; set; }
[Required] [Required]
[Key] [Key]