feat: split migration into batches
This commit is contained in:
parent
d518cdf739
commit
80385893c7
7 changed files with 104 additions and 7 deletions
|
@ -0,0 +1,51 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Foxnouns.Backend.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20241217195351_AddFediAppForceRefresh")]
|
||||
public partial class AddFediAppForceRefresh : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<Dictionary<string, string>>(
|
||||
name: "localization_params",
|
||||
table: "notifications",
|
||||
type: "hstore",
|
||||
nullable: false,
|
||||
oldClrType: typeof(Dictionary<string, string>),
|
||||
oldType: "hstore",
|
||||
oldNullable: true
|
||||
);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "force_refresh",
|
||||
table: "fediverse_applications",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false
|
||||
);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(name: "force_refresh", table: "fediverse_applications");
|
||||
|
||||
migrationBuilder.AlterColumn<Dictionary<string, string>>(
|
||||
name: "localization_params",
|
||||
table: "notifications",
|
||||
type: "hstore",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Dictionary<string, string>),
|
||||
oldType: "hstore"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -216,6 +216,10 @@ namespace Foxnouns.Backend.Database.Migrations
|
|||
.HasColumnType("text")
|
||||
.HasColumnName("domain");
|
||||
|
||||
b.Property<bool>("ForceRefresh")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("force_refresh");
|
||||
|
||||
b.Property<int>("InstanceType")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("instance_type");
|
||||
|
@ -342,6 +346,7 @@ namespace Foxnouns.Backend.Database.Migrations
|
|||
.HasColumnName("localization_key");
|
||||
|
||||
b.Property<Dictionary<string, string>>("LocalizationParams")
|
||||
.IsRequired()
|
||||
.HasColumnType("hstore")
|
||||
.HasColumnName("localization_params");
|
||||
|
||||
|
@ -411,7 +416,7 @@ namespace Foxnouns.Backend.Database.Migrations
|
|||
b.Property<long>("ReporterId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("reporter_id");
|
||||
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
|
|
@ -20,6 +20,7 @@ public class FediverseApplication : BaseModel
|
|||
public required string ClientId { get; set; }
|
||||
public required string ClientSecret { get; set; }
|
||||
public required FediverseInstanceType InstanceType { get; set; }
|
||||
public bool ForceRefresh { get; set; }
|
||||
}
|
||||
|
||||
public enum FediverseInstanceType
|
||||
|
|
|
@ -58,7 +58,7 @@ public partial class FediverseAuthService
|
|||
)
|
||||
{
|
||||
FediverseApplication app = await GetApplicationAsync(instance);
|
||||
return await GenerateAuthUrlAsync(app, forceRefresh, state);
|
||||
return await GenerateAuthUrlAsync(app, forceRefresh || app.ForceRefresh, state);
|
||||
}
|
||||
|
||||
// thank you, gargron and syuilo, for agreeing on a name for *once* in your lives,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue