mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 13:26:47 +01:00
4c303d358b
* Remove deprecated CSS options Closes #5945. * Greenfield: Add brandColor to store APIs Closes #5946. * Migrate file IDs to URLs Closes #5953. * Greenfield: Add CSS and logo URL to store settings API Closes #5945. * Add migration test * Store and Server branding can reference file's via fileid:ID * Add PaymentSoundUrl to Store API --------- Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
using BTCPayServer.Data;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BTCPayServer.Migrations
|
|
{
|
|
[DbContext(typeof(ApplicationDbContext))]
|
|
[Migration("20240508015052_fileid")]
|
|
public partial class fileid : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql("""
|
|
UPDATE "Settings"
|
|
SET "Value" = jsonb_set(
|
|
"Value",
|
|
'{LogoUrl}',
|
|
to_jsonb('fileid:' || ("Value"->>'LogoFileId'))) - 'LogoFileId'
|
|
WHERE "Id" = 'BTCPayServer.Services.ThemeSettings'
|
|
AND "Value"->>'LogoFileId' IS NOT NULL;
|
|
|
|
UPDATE "Settings"
|
|
SET "Value" = jsonb_set(
|
|
"Value",
|
|
'{CustomThemeCssUrl}',
|
|
to_jsonb('fileid:' || ("Value"->>'CustomThemeFileId'))) - 'CustomThemeFileId'
|
|
WHERE "Id" = 'BTCPayServer.Services.ThemeSettings'
|
|
AND "Value"->>'CustomThemeFileId' IS NOT NULL;
|
|
|
|
UPDATE "Stores"
|
|
SET "StoreBlob" = jsonb_set(
|
|
"StoreBlob",
|
|
'{logoUrl}',
|
|
to_jsonb('fileid:' || ("StoreBlob"->>'logoFileId'))) - 'logoFileId'
|
|
WHERE "StoreBlob"->>'logoFileId' IS NOT NULL;
|
|
|
|
UPDATE "Stores"
|
|
SET "StoreBlob" = jsonb_set(
|
|
"StoreBlob",
|
|
'{cssUrl}',
|
|
to_jsonb('fileid:' || ("StoreBlob"->>'cssFileId'))) - 'cssFileId'
|
|
WHERE "StoreBlob"->>'cssFileId' IS NOT NULL;
|
|
|
|
UPDATE "Stores"
|
|
SET "StoreBlob" = jsonb_set(
|
|
"StoreBlob",
|
|
'{paymentSoundUrl}',
|
|
to_jsonb('fileid:' || ("StoreBlob"->>'soundFileId'))) - 'soundFileId'
|
|
WHERE "StoreBlob"->>'soundFileId' IS NOT NULL;
|
|
""");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
}
|
|
}
|
|
}
|