mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 13:26:47 +01:00
Cleanup AddressesInvoices table (#5905)
This commit is contained in:
parent
bd978f29a0
commit
f4aafd5be3
@ -9,7 +9,6 @@ namespace BTCPayServer.Data
|
|||||||
public string Address { get; set; }
|
public string Address { get; set; }
|
||||||
public InvoiceData InvoiceData { get; set; }
|
public InvoiceData InvoiceData { get; set; }
|
||||||
public string InvoiceDataId { get; set; }
|
public string InvoiceDataId { get; set; }
|
||||||
public DateTimeOffset? CreatedTime { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
internal static void OnModelCreating(ModelBuilder builder)
|
internal static void OnModelCreating(ModelBuilder builder)
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using BTCPayServer.Data;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BTCPayServer.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20240405052858_cleanup_address_invoices")]
|
||||||
|
public partial class cleanup_address_invoices : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
if (migrationBuilder.IsNpgsql())
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql(@"
|
||||||
|
DELETE FROM ""AddressInvoices"" WHERE ""Address"" LIKE '%_LightningLike';
|
||||||
|
ALTER TABLE ""AddressInvoices"" DROP COLUMN IF EXISTS ""CreatedTime"";
|
||||||
|
VACUUM (FULL, ANALYZE) ""AddressInvoices"";", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -63,9 +63,6 @@ namespace BTCPayServer.Migrations
|
|||||||
b.Property<string>("Address")
|
b.Property<string>("Address")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("CreatedTime")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("InvoiceDataId")
|
b.Property<string>("InvoiceDataId")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
@ -245,7 +245,6 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
await context.AddressInvoices.AddAsync(new AddressInvoiceData()
|
await context.AddressInvoices.AddAsync(new AddressInvoiceData()
|
||||||
{
|
{
|
||||||
InvoiceDataId = invoice.Id,
|
InvoiceDataId = invoice.Id,
|
||||||
CreatedTime = DateTimeOffset.UtcNow,
|
|
||||||
Address = trackedDestination
|
Address = trackedDestination
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -363,7 +362,6 @@ retry:
|
|||||||
await context.AddressInvoices.AddAsync(new AddressInvoiceData()
|
await context.AddressInvoices.AddAsync(new AddressInvoiceData()
|
||||||
{
|
{
|
||||||
InvoiceDataId = invoiceId,
|
InvoiceDataId = invoiceId,
|
||||||
CreatedTime = DateTimeOffset.UtcNow,
|
|
||||||
Address = tracked
|
Address = tracked
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user