diff --git a/BTCPayServer.Data/Migrations/20230315062447_fixmaxlength.cs b/BTCPayServer.Data/Migrations/20230315062447_fixmaxlength.cs new file mode 100644 index 000000000..0ab9f3c88 --- /dev/null +++ b/BTCPayServer.Data/Migrations/20230315062447_fixmaxlength.cs @@ -0,0 +1,31 @@ +using System; +using BTCPayServer.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace BTCPayServer.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20230315062447_fixmaxlength")] + public partial class fixmaxlength : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + if (migrationBuilder.IsNpgsql()) + { + migrationBuilder.Sql("ALTER TABLE \"InvoiceSearches\" ALTER COLUMN \"Value\" TYPE TEXT USING \"Value\"::TEXT;"); + migrationBuilder.Sql("ALTER TABLE \"Invoices\" ALTER COLUMN \"OrderId\" TYPE TEXT USING \"OrderId\"::TEXT;"); + } + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + // Not supported + } + } +}