diff --git a/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs b/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs index 1b18e6f8..abb6979e 100644 --- a/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs +++ b/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs @@ -3951,12 +3951,6 @@ namespace Iceshrimp.Backend.Core.Database.Migrations .HasColumnName("followingCount") .HasComment("The count of following."); - b.Property("HideOnlineStatus") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false) - .HasColumnName("hideOnlineStatus"); - b.Property("Host") .HasMaxLength(512) .HasColumnType("character varying(512)") @@ -4079,13 +4073,6 @@ namespace Iceshrimp.Backend.Core.Database.Migrations .HasColumnName("tags") .HasDefaultValueSql("'{}'::character varying[]"); - b.Property("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("UpdatedAt") .HasColumnType("timestamp with time zone") .HasColumnName("updatedAt") @@ -4133,9 +4120,6 @@ namespace Iceshrimp.Backend.Core.Database.Migrations b.HasIndex("Tags"); - b.HasIndex("Token") - .IsUnique(); - b.HasIndex("UpdatedAt"); b.HasIndex("Uri"); @@ -4611,7 +4595,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations .HasColumnType("character varying(32)") .HasColumnName("userId"); - b.Property("AlwaysMarkNsfw") + b.Property("AlwaysMarkSensitive") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false) diff --git a/Iceshrimp.Backend/Core/Database/Migrations/v2024.1-beta3/20240711213718_RemoveExtraneousUserColumns.cs b/Iceshrimp.Backend/Core/Database/Migrations/v2024.1-beta3/20240711213718_RemoveExtraneousUserColumns.cs new file mode 100644 index 00000000..1ea5f860 --- /dev/null +++ b/Iceshrimp.Backend/Core/Database/Migrations/v2024.1-beta3/20240711213718_RemoveExtraneousUserColumns.cs @@ -0,0 +1,55 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Infrastructure; + +#nullable disable + +namespace Iceshrimp.Backend.Core.Database.Migrations +{ + /// + [DbContext(typeof(DatabaseContext))] + [Migration("20240711213718_RemoveExtraneousUserColumns")] + public partial class RemoveExtraneousUserColumns : Migration + { + /// + 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"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "hideOnlineStatus", + table: "user", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + 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); + } + } +} diff --git a/Iceshrimp.Backend/Core/Database/Tables/User.cs b/Iceshrimp.Backend/Core/Database/Tables/User.cs index bf4000a7..45953bc1 100644 --- a/Iceshrimp.Backend/Core/Database/Tables/User.cs +++ b/Iceshrimp.Backend/Core/Database/Tables/User.cs @@ -22,7 +22,6 @@ namespace Iceshrimp.Backend.Core.Database.Tables; [Index(nameof(Tags))] [Index(nameof(AvatarId), IsUnique = true)] [Index(nameof(BannerId), IsUnique = true)] -[Index(nameof(Token), IsUnique = true)] public class User : IEntity { /// @@ -183,13 +182,6 @@ public class User : IEntity [StringLength(512)] public string? Uri { get; set; } - /// - /// The native access token of the User. It will be null if the origin of the user is local. - /// - [Column("token")] - [StringLength(16)] - public string? Token { get; set; } - /// /// Whether the User is explorable. /// @@ -205,8 +197,6 @@ public class User : IEntity [Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; } - [Column("hideOnlineStatus")] public bool HideOnlineStatus { get; set; } - /// /// Whether the User is deleted. /// @@ -658,7 +648,6 @@ public class UserEntityTypeConfiguration : IEntityTypeConfiguration entity.Property(e => e.FollowingCount) .HasDefaultValue(0) .HasComment("The count of following."); - entity.Property(e => e.HideOnlineStatus).HasDefaultValue(false); entity.Property(e => e.Host) .HasComment("The host of the User. It will be null if the origin of the user is local."); entity.Property(e => e.Inbox) @@ -701,9 +690,6 @@ public class UserEntityTypeConfiguration : IEntityTypeConfiguration .HasDefaultValue(true) .HasComment("Whether to speak as a cat if isCat."); 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.Uri) .HasComment("The URI of the User. It will be null if the origin of the user is local.");