Change some table type from TEXT to JSONB (#4371)

* Change some table type from TEXT to JSONB

* Deprecate mysql and sqlite backend
This commit is contained in:
Nicolas Dorier
2022-11-28 20:36:18 +09:00
committed by GitHub
parent 84132e794a
commit 08b239e87a
8 changed files with 68 additions and 9 deletions

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using BTCPayServer.Client.Models;
using BTCPayServer.Data.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using PayoutProcessorData = BTCPayServer.Data.Data.PayoutProcessorData;
namespace BTCPayServer.Data
@@ -36,7 +38,7 @@ namespace BTCPayServer.Data
[NotMapped] public string Role { get; set; }
public byte[] StoreBlob { get; set; }
public string StoreBlob { get; set; }
[Obsolete("Use GetDefaultPaymentId instead")]
public string DefaultCrypto { get; set; }
@@ -48,5 +50,15 @@ namespace BTCPayServer.Data
public IEnumerable<PayoutData> Payouts { get; set; }
public IEnumerable<CustodianAccountData> CustodianAccounts { get; set; }
public IEnumerable<StoreSettingData> Settings { get; set; }
internal static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
{
if (databaseFacade.IsNpgsql())
{
builder.Entity<StoreData>()
.Property(o => o.StoreBlob)
.HasColumnType("JSONB");
}
}
}
}