[backend/database] Remove extraneous user table columns
This commit is contained in:
parent
3ac63e1510
commit
0cd754f4c2
3 changed files with 56 additions and 31 deletions
|
@ -3951,12 +3951,6 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||||
.HasColumnName("followingCount")
|
.HasColumnName("followingCount")
|
||||||
.HasComment("The count of following.");
|
.HasComment("The count of following.");
|
||||||
|
|
||||||
b.Property<bool>("HideOnlineStatus")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(false)
|
|
||||||
.HasColumnName("hideOnlineStatus");
|
|
||||||
|
|
||||||
b.Property<string>("Host")
|
b.Property<string>("Host")
|
||||||
.HasMaxLength(512)
|
.HasMaxLength(512)
|
||||||
.HasColumnType("character varying(512)")
|
.HasColumnType("character varying(512)")
|
||||||
|
@ -4079,13 +4073,6 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||||
.HasColumnName("tags")
|
.HasColumnName("tags")
|
||||||
.HasDefaultValueSql("'{}'::character varying[]");
|
.HasDefaultValueSql("'{}'::character varying[]");
|
||||||
|
|
||||||
b.Property<string>("Token")
|
|
||||||
.HasMaxLength(16)
|
|
||||||
.HasColumnType("character(16)")
|
|
||||||
.HasColumnName("token")
|
|
||||||
.IsFixedLength()
|
|
||||||
.HasComment("The native access token of the User. It will be null if the origin of the user is local.");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("UpdatedAt")
|
b.Property<DateTime?>("UpdatedAt")
|
||||||
.HasColumnType("timestamp with time zone")
|
.HasColumnType("timestamp with time zone")
|
||||||
.HasColumnName("updatedAt")
|
.HasColumnName("updatedAt")
|
||||||
|
@ -4133,9 +4120,6 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||||
|
|
||||||
b.HasIndex("Tags");
|
b.HasIndex("Tags");
|
||||||
|
|
||||||
b.HasIndex("Token")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("UpdatedAt");
|
b.HasIndex("UpdatedAt");
|
||||||
|
|
||||||
b.HasIndex("Uri");
|
b.HasIndex("Uri");
|
||||||
|
@ -4611,7 +4595,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||||
.HasColumnType("character varying(32)")
|
.HasColumnType("character varying(32)")
|
||||||
.HasColumnName("userId");
|
.HasColumnName("userId");
|
||||||
|
|
||||||
b.Property<bool>("AlwaysMarkNsfw")
|
b.Property<bool>("AlwaysMarkSensitive")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("boolean")
|
||||||
.HasDefaultValue(false)
|
.HasDefaultValue(false)
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Iceshrimp.Backend.Core.Database.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
[DbContext(typeof(DatabaseContext))]
|
||||||
|
[Migration("20240711213718_RemoveExtraneousUserColumns")]
|
||||||
|
public partial class RemoveExtraneousUserColumns : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_user_token",
|
||||||
|
table: "user");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "hideOnlineStatus",
|
||||||
|
table: "user");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "token",
|
||||||
|
table: "user");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "hideOnlineStatus",
|
||||||
|
table: "user",
|
||||||
|
type: "boolean",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "token",
|
||||||
|
table: "user",
|
||||||
|
type: "character(16)",
|
||||||
|
fixedLength: true,
|
||||||
|
maxLength: 16,
|
||||||
|
nullable: true,
|
||||||
|
comment: "The native access token of the User. It will be null if the origin of the user is local.");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_user_token",
|
||||||
|
table: "user",
|
||||||
|
column: "token",
|
||||||
|
unique: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,6 @@ namespace Iceshrimp.Backend.Core.Database.Tables;
|
||||||
[Index(nameof(Tags))]
|
[Index(nameof(Tags))]
|
||||||
[Index(nameof(AvatarId), IsUnique = true)]
|
[Index(nameof(AvatarId), IsUnique = true)]
|
||||||
[Index(nameof(BannerId), IsUnique = true)]
|
[Index(nameof(BannerId), IsUnique = true)]
|
||||||
[Index(nameof(Token), IsUnique = true)]
|
|
||||||
public class User : IEntity
|
public class User : IEntity
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -183,13 +182,6 @@ public class User : IEntity
|
||||||
[StringLength(512)]
|
[StringLength(512)]
|
||||||
public string? Uri { get; set; }
|
public string? Uri { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The native access token of the User. It will be null if the origin of the user is local.
|
|
||||||
/// </summary>
|
|
||||||
[Column("token")]
|
|
||||||
[StringLength(16)]
|
|
||||||
public string? Token { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the User is explorable.
|
/// Whether the User is explorable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -205,8 +197,6 @@ public class User : IEntity
|
||||||
|
|
||||||
[Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; }
|
[Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; }
|
||||||
|
|
||||||
[Column("hideOnlineStatus")] public bool HideOnlineStatus { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the User is deleted.
|
/// Whether the User is deleted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -658,7 +648,6 @@ public class UserEntityTypeConfiguration : IEntityTypeConfiguration<User>
|
||||||
entity.Property(e => e.FollowingCount)
|
entity.Property(e => e.FollowingCount)
|
||||||
.HasDefaultValue(0)
|
.HasDefaultValue(0)
|
||||||
.HasComment("The count of following.");
|
.HasComment("The count of following.");
|
||||||
entity.Property(e => e.HideOnlineStatus).HasDefaultValue(false);
|
|
||||||
entity.Property(e => e.Host)
|
entity.Property(e => e.Host)
|
||||||
.HasComment("The host of the User. It will be null if the origin of the user is local.");
|
.HasComment("The host of the User. It will be null if the origin of the user is local.");
|
||||||
entity.Property(e => e.Inbox)
|
entity.Property(e => e.Inbox)
|
||||||
|
@ -701,9 +690,6 @@ public class UserEntityTypeConfiguration : IEntityTypeConfiguration<User>
|
||||||
.HasDefaultValue(true)
|
.HasDefaultValue(true)
|
||||||
.HasComment("Whether to speak as a cat if isCat.");
|
.HasComment("Whether to speak as a cat if isCat.");
|
||||||
entity.Property(e => e.Tags).HasDefaultValueSql("'{}'::character varying[]");
|
entity.Property(e => e.Tags).HasDefaultValueSql("'{}'::character varying[]");
|
||||||
entity.Property(e => e.Token)
|
|
||||||
.IsFixedLength()
|
|
||||||
.HasComment("The native access token of the User. It will be null if the origin of the user is local.");
|
|
||||||
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the User.");
|
entity.Property(e => e.UpdatedAt).HasComment("The updated date of the User.");
|
||||||
entity.Property(e => e.Uri)
|
entity.Property(e => e.Uri)
|
||||||
.HasComment("The URI of the User. It will be null if the origin of the user is local.");
|
.HasComment("The URI of the User. It will be null if the origin of the user is local.");
|
||||||
|
|
Loading…
Add table
Reference in a new issue