2023-01-30 09:46:12 +09:00
|
|
|
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("20230123062447_migrateoldratesource")]
|
|
|
|
public partial class migrateoldratesource : Migration
|
|
|
|
{
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
{
|
2024-04-15 19:08:25 +09:00
|
|
|
migrationBuilder.Sql("UPDATE \"Stores\" SET \"StoreBlob\"=jsonb_set(\"StoreBlob\", \'{preferredExchange}\', \'{\"oasis_trade\": \"oasisdev\", \"gdax\":\"coinbasepro\", \"coinaverage\":\"coingecko\"}\'::jsonb->(\"StoreBlob\"->>\'preferredExchange\')) WHERE \"StoreBlob\"->>\'preferredExchange\' = ANY (ARRAY[\'oasis_trade\', \'gdax\', \'coinaverage\']);");
|
2023-01-30 09:46:12 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
{
|
|
|
|
// Not supported
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|