[backend/database] Add supportsHtmlFormatting & supportsHtmlFormatting columns to the oauth_token table

This commit is contained in:
Laura Hausmann 2024-02-24 21:26:06 +01:00
parent e9267c4c3e
commit da83fd9ec7
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
5 changed files with 6200 additions and 1 deletions

View file

@ -751,9 +751,14 @@ public class DatabaseContext(DbContextOptions<DatabaseContext> options)
entity.Property(e => e.RedirectUri).HasComment("The redirect URI of the OAuth token"); entity.Property(e => e.RedirectUri).HasComment("The redirect URI of the OAuth token");
entity.Property(e => e.Scopes).HasComment("The scopes requested by the OAuth token"); entity.Property(e => e.Scopes).HasComment("The scopes requested by the OAuth token");
entity.Property(e => e.Token).HasComment("The OAuth token"); entity.Property(e => e.Token).HasComment("The OAuth token");
entity.Property(e => e.SupportsHtmlFormatting)
.HasComment("Whether the client supports HTML inline formatting (bold, italic, strikethrough, ...)")
.HasDefaultValue(true);
entity.Property(e => e.AutoDetectQuotes)
.HasComment("Whether the backend should automatically detect quote posts coming from this client")
.HasDefaultValue(true);
entity.HasOne(d => d.App).WithMany(p => p.OauthTokens); entity.HasOne(d => d.App).WithMany(p => p.OauthTokens);
entity.HasOne(d => d.User).WithMany(p => p.OauthTokens); entity.HasOne(d => d.User).WithMany(p => p.OauthTokens);
}); });

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Iceshrimp.Backend.Core.Database.Migrations
{
/// <inheritdoc />
public partial class AddOauthTokenProperties : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "autoDetectQuotes",
table: "oauth_token",
type: "boolean",
nullable: false,
defaultValue: true,
comment: "Whether the backend should automatically detect quote posts coming from this client");
migrationBuilder.AddColumn<bool>(
name: "supportsHtmlFormatting",
table: "oauth_token",
type: "boolean",
nullable: false,
defaultValue: true,
comment: "Whether the client supports HTML inline formatting (bold, italic, strikethrough, ...)");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "autoDetectQuotes",
table: "oauth_token");
migrationBuilder.DropColumn(
name: "supportsHtmlFormatting",
table: "oauth_token");
}
}
}

View file

@ -3155,6 +3155,13 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
.HasColumnType("character varying(32)") .HasColumnType("character varying(32)")
.HasColumnName("appId"); .HasColumnName("appId");
b.Property<bool>("AutoDetectQuotes")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasColumnName("autoDetectQuotes")
.HasComment("Whether the backend should automatically detect quote posts coming from this client");
b.Property<string>("Code") b.Property<string>("Code")
.IsRequired() .IsRequired()
.HasMaxLength(64) .HasMaxLength(64)
@ -3180,6 +3187,13 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
.HasColumnName("scopes") .HasColumnName("scopes")
.HasComment("The scopes requested by the OAuth token"); .HasComment("The scopes requested by the OAuth token");
b.Property<bool>("SupportsHtmlFormatting")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(true)
.HasColumnName("supportsHtmlFormatting")
.HasComment("Whether the client supports HTML inline formatting (bold, italic, strikethrough, ...)");
b.Property<string>("Token") b.Property<string>("Token")
.IsRequired() .IsRequired()
.HasMaxLength(64) .HasMaxLength(64)

View file

@ -64,4 +64,7 @@ public class OauthToken
[ForeignKey("UserId")] [ForeignKey("UserId")]
[InverseProperty(nameof(Tables.User.OauthTokens))] [InverseProperty(nameof(Tables.User.OauthTokens))]
public virtual User User { get; set; } = null!; public virtual User User { get; set; } = null!;
[Column("supportsHtmlFormatting")] public bool SupportsHtmlFormatting { get; set; }
[Column("autoDetectQuotes")] public bool AutoDetectQuotes { get; set; }
} }