feat(usage): split throttle thresholds per bucket, add draggable gauge markers

This commit is contained in:
mika kuns
2026-08-07 11:01:45 +02:00
parent 231b063751
commit 7eeb8f5086
33 changed files with 2289 additions and 147 deletions
@@ -0,0 +1,70 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ClaudeDo.Data.Migrations
{
/// <inheritdoc />
public partial class SplitUsageThrottlePerBucket : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "usage_throttle_soft_pct",
table: "app_settings",
newName: "usage_throttle_seven_day_soft_pct");
migrationBuilder.RenameColumn(
name: "usage_throttle_hard_pct",
table: "app_settings",
newName: "usage_throttle_seven_day_hard_pct");
migrationBuilder.AddColumn<int>(
name: "usage_throttle_five_hour_hard_pct",
table: "app_settings",
type: "INTEGER",
nullable: false,
defaultValue: 65);
migrationBuilder.AddColumn<int>(
name: "usage_throttle_five_hour_soft_pct",
table: "app_settings",
type: "INTEGER",
nullable: false,
defaultValue: 50);
// The old single soft/hard pair was compared against whichever bucket was more utilized,
// so carrying it into BOTH buckets keeps an existing install behaving exactly as before
// the split — the rename above already preserved it for the 7d side.
migrationBuilder.Sql(
"""
UPDATE app_settings
SET usage_throttle_five_hour_soft_pct = usage_throttle_seven_day_soft_pct,
usage_throttle_five_hour_hard_pct = usage_throttle_seven_day_hard_pct;
""");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "usage_throttle_five_hour_hard_pct",
table: "app_settings");
migrationBuilder.DropColumn(
name: "usage_throttle_five_hour_soft_pct",
table: "app_settings");
migrationBuilder.RenameColumn(
name: "usage_throttle_seven_day_soft_pct",
table: "app_settings",
newName: "usage_throttle_soft_pct");
migrationBuilder.RenameColumn(
name: "usage_throttle_seven_day_hard_pct",
table: "app_settings",
newName: "usage_throttle_hard_pct");
}
}
}