diff --git a/BTCPayServer.Data/BTCPayServer.Data.csproj b/BTCPayServer.Data/BTCPayServer.Data.csproj
index 646084b82..4883815a2 100644
--- a/BTCPayServer.Data/BTCPayServer.Data.csproj
+++ b/BTCPayServer.Data/BTCPayServer.Data.csproj
@@ -14,4 +14,7 @@
+
+
+
diff --git a/BTCPayServer.Data/DBScripts/000.Init.sql b/BTCPayServer.Data/DBScripts/000.Init.sql
new file mode 100644
index 000000000..c2c509056
--- /dev/null
+++ b/BTCPayServer.Data/DBScripts/000.Init.sql
@@ -0,0 +1,301 @@
+CREATE TABLE "AddressInvoices" (
+ "Address" text NOT NULL,
+ "InvoiceDataId" text,
+ "CreatedTime" timestamp with time zone
+);
+CREATE TABLE "ApiKeys" (
+ "Id" character varying(50) NOT NULL,
+ "StoreId" character varying(50),
+ "Permissions" text,
+ "Type" integer DEFAULT 0 NOT NULL,
+ "UserId" character varying(50),
+ "Label" text
+);
+CREATE TABLE "Apps" (
+ "Id" text NOT NULL,
+ "AppType" text,
+ "Created" timestamp with time zone NOT NULL,
+ "Name" text,
+ "Settings" text,
+ "StoreDataId" text,
+ "TagAllInvoices" boolean DEFAULT false NOT NULL
+);
+CREATE TABLE "AspNetRoleClaims" (
+ "Id" integer NOT NULL,
+ "ClaimType" text,
+ "ClaimValue" text,
+ "RoleId" text NOT NULL
+);
+CREATE TABLE "AspNetRoles" (
+ "Id" text NOT NULL,
+ "ConcurrencyStamp" text,
+ "Name" character varying(256),
+ "NormalizedName" character varying(256)
+);
+CREATE TABLE "AspNetUserClaims" (
+ "Id" integer NOT NULL,
+ "ClaimType" text,
+ "ClaimValue" text,
+ "UserId" text NOT NULL
+);
+CREATE TABLE "AspNetUserLogins" (
+ "LoginProvider" character varying(255) NOT NULL,
+ "ProviderKey" character varying(255) NOT NULL,
+ "ProviderDisplayName" text,
+ "UserId" text NOT NULL
+);
+CREATE TABLE "AspNetUserRoles" (
+ "UserId" text NOT NULL,
+ "RoleId" text NOT NULL
+);
+CREATE TABLE "AspNetUserTokens" (
+ "UserId" text NOT NULL,
+ "LoginProvider" character varying(64) NOT NULL,
+ "Name" character varying(64) NOT NULL,
+ "Value" text
+);
+CREATE TABLE "AspNetUsers" (
+ "Id" text NOT NULL,
+ "AccessFailedCount" integer NOT NULL,
+ "ConcurrencyStamp" text,
+ "Email" character varying(256),
+ "EmailConfirmed" boolean NOT NULL,
+ "LockoutEnabled" boolean NOT NULL,
+ "LockoutEnd" timestamp with time zone,
+ "NormalizedEmail" character varying(256),
+ "NormalizedUserName" character varying(256),
+ "PasswordHash" text,
+ "PhoneNumber" text,
+ "PhoneNumberConfirmed" boolean NOT NULL,
+ "SecurityStamp" text,
+ "TwoFactorEnabled" boolean NOT NULL,
+ "UserName" character varying(256),
+ "RequiresEmailConfirmation" boolean DEFAULT false NOT NULL
+);
+CREATE TABLE "Files" (
+ "Id" text NOT NULL,
+ "FileName" text,
+ "StorageFileName" text,
+ "Timestamp" timestamp with time zone NOT NULL,
+ "ApplicationUserId" text
+);
+CREATE TABLE "HistoricalAddressInvoices" (
+ "InvoiceDataId" text NOT NULL,
+ "Address" text NOT NULL,
+ "Assigned" timestamp with time zone NOT NULL,
+ "UnAssigned" timestamp with time zone,
+ "CryptoCode" text
+);
+CREATE TABLE "InvoiceEvents" (
+ "InvoiceDataId" text NOT NULL,
+ "UniqueId" text NOT NULL,
+ "Message" text,
+ "Timestamp" timestamp with time zone NOT NULL
+);
+CREATE TABLE "Invoices" (
+ "Id" text NOT NULL,
+ "Blob" bytea,
+ "Created" timestamp with time zone NOT NULL,
+ "CustomerEmail" text,
+ "ExceptionStatus" text,
+ "ItemCode" text,
+ "OrderId" text,
+ "Status" text,
+ "StoreDataId" text
+);
+CREATE TABLE "PairedSINData" (
+ "Id" text NOT NULL,
+ "Label" text,
+ "PairingTime" timestamp with time zone NOT NULL,
+ "SIN" text,
+ "StoreDataId" text
+);
+CREATE TABLE "PairingCodes" (
+ "Id" text NOT NULL,
+ "DateCreated" timestamp with time zone NOT NULL,
+ "Expiration" timestamp with time zone NOT NULL,
+ "Facade" text,
+ "Label" text,
+ "SIN" text,
+ "StoreDataId" text,
+ "TokenValue" text
+);
+CREATE TABLE "PaymentRequests" (
+ "Id" text NOT NULL,
+ "StoreDataId" text,
+ "Status" integer NOT NULL,
+ "Blob" bytea,
+ "Created" timestamp with time zone DEFAULT '1970-01-01 00:00:00+00'::timestamp with time zone NOT NULL
+);
+CREATE TABLE "Payments" (
+ "Id" text NOT NULL,
+ "Blob" bytea,
+ "InvoiceDataId" text,
+ "Accounted" boolean DEFAULT false NOT NULL
+);
+CREATE TABLE "PendingInvoices" (
+ "Id" text NOT NULL
+);
+CREATE TABLE "RefundAddresses" (
+ "Id" text NOT NULL,
+ "Blob" bytea,
+ "InvoiceDataId" text
+);
+CREATE TABLE "Settings" (
+ "Id" text NOT NULL,
+ "Value" text
+);
+CREATE TABLE "Stores" (
+ "Id" text NOT NULL,
+ "DerivationStrategy" text,
+ "SpeedPolicy" integer NOT NULL,
+ "StoreCertificate" bytea,
+ "StoreName" text,
+ "StoreWebsite" text,
+ "StoreBlob" bytea,
+ "DerivationStrategies" text,
+ "DefaultCrypto" text
+);
+CREATE TABLE "U2FDevices" (
+ "Id" text NOT NULL,
+ "Name" text,
+ "KeyHandle" bytea NOT NULL,
+ "PublicKey" bytea NOT NULL,
+ "AttestationCert" bytea NOT NULL,
+ "Counter" integer NOT NULL,
+ "ApplicationUserId" text
+);
+CREATE TABLE "UserStore" (
+ "ApplicationUserId" text NOT NULL,
+ "StoreDataId" text NOT NULL,
+ "Role" text
+);
+CREATE TABLE "WalletTransactions" (
+ "WalletDataId" text NOT NULL,
+ "TransactionId" text NOT NULL,
+ "Labels" text,
+ "Blob" bytea
+);
+CREATE TABLE "Wallets" (
+ "Id" text NOT NULL,
+ "Blob" bytea
+);
+ALTER TABLE ONLY "AddressInvoices"
+ ADD CONSTRAINT "PK_AddressInvoices" PRIMARY KEY ("Address");
+ALTER TABLE ONLY "ApiKeys"
+ ADD CONSTRAINT "PK_ApiKeys" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "Apps"
+ ADD CONSTRAINT "PK_Apps" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "AspNetRoleClaims"
+ ADD CONSTRAINT "PK_AspNetRoleClaims" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "AspNetRoles"
+ ADD CONSTRAINT "PK_AspNetRoles" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "AspNetUserClaims"
+ ADD CONSTRAINT "PK_AspNetUserClaims" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "AspNetUserLogins"
+ ADD CONSTRAINT "PK_AspNetUserLogins" PRIMARY KEY ("LoginProvider", "ProviderKey");
+ALTER TABLE ONLY "AspNetUserRoles"
+ ADD CONSTRAINT "PK_AspNetUserRoles" PRIMARY KEY ("UserId", "RoleId");
+ALTER TABLE ONLY "AspNetUserTokens"
+ ADD CONSTRAINT "PK_AspNetUserTokens" PRIMARY KEY ("UserId", "LoginProvider", "Name");
+ALTER TABLE ONLY "AspNetUsers"
+ ADD CONSTRAINT "PK_AspNetUsers" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "Files"
+ ADD CONSTRAINT "PK_Files" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "HistoricalAddressInvoices"
+ ADD CONSTRAINT "PK_HistoricalAddressInvoices" PRIMARY KEY ("InvoiceDataId", "Address");
+ALTER TABLE ONLY "InvoiceEvents"
+ ADD CONSTRAINT "PK_InvoiceEvents" PRIMARY KEY ("InvoiceDataId", "UniqueId");
+ALTER TABLE ONLY "Invoices"
+ ADD CONSTRAINT "PK_Invoices" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "PairedSINData"
+ ADD CONSTRAINT "PK_PairedSINData" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "PairingCodes"
+ ADD CONSTRAINT "PK_PairingCodes" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "PaymentRequests"
+ ADD CONSTRAINT "PK_PaymentRequests" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "Payments"
+ ADD CONSTRAINT "PK_Payments" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "PendingInvoices"
+ ADD CONSTRAINT "PK_PendingInvoices" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "RefundAddresses"
+ ADD CONSTRAINT "PK_RefundAddresses" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "Settings"
+ ADD CONSTRAINT "PK_Settings" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "Stores"
+ ADD CONSTRAINT "PK_Stores" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "U2FDevices"
+ ADD CONSTRAINT "PK_U2FDevices" PRIMARY KEY ("Id");
+ALTER TABLE ONLY "UserStore"
+ ADD CONSTRAINT "PK_UserStore" PRIMARY KEY ("ApplicationUserId", "StoreDataId");
+ALTER TABLE ONLY "WalletTransactions"
+ ADD CONSTRAINT "PK_WalletTransactions" PRIMARY KEY ("WalletDataId", "TransactionId");
+ALTER TABLE ONLY "Wallets"
+ ADD CONSTRAINT "PK_Wallets" PRIMARY KEY ("Id");
+CREATE INDEX "EmailIndex" ON "AspNetUsers" USING btree ("NormalizedEmail");
+CREATE INDEX "IX_AddressInvoices_InvoiceDataId" ON "AddressInvoices" USING btree ("InvoiceDataId");
+CREATE INDEX "IX_ApiKeys_StoreId" ON "ApiKeys" USING btree ("StoreId");
+CREATE INDEX "IX_ApiKeys_UserId" ON "ApiKeys" USING btree ("UserId");
+CREATE INDEX "IX_Apps_StoreDataId" ON "Apps" USING btree ("StoreDataId");
+CREATE INDEX "IX_AspNetRoleClaims_RoleId" ON "AspNetRoleClaims" USING btree ("RoleId");
+CREATE INDEX "IX_AspNetUserClaims_UserId" ON "AspNetUserClaims" USING btree ("UserId");
+CREATE INDEX "IX_AspNetUserLogins_UserId" ON "AspNetUserLogins" USING btree ("UserId");
+CREATE INDEX "IX_AspNetUserRoles_RoleId" ON "AspNetUserRoles" USING btree ("RoleId");
+CREATE INDEX "IX_Files_ApplicationUserId" ON "Files" USING btree ("ApplicationUserId");
+CREATE INDEX "IX_Invoices_StoreDataId" ON "Invoices" USING btree ("StoreDataId");
+CREATE INDEX "IX_PairedSINData_SIN" ON "PairedSINData" USING btree ("SIN");
+CREATE INDEX "IX_PairedSINData_StoreDataId" ON "PairedSINData" USING btree ("StoreDataId");
+CREATE INDEX "IX_PaymentRequests_Status" ON "PaymentRequests" USING btree ("Status");
+CREATE INDEX "IX_PaymentRequests_StoreDataId" ON "PaymentRequests" USING btree ("StoreDataId");
+CREATE INDEX "IX_Payments_InvoiceDataId" ON "Payments" USING btree ("InvoiceDataId");
+CREATE INDEX "IX_RefundAddresses_InvoiceDataId" ON "RefundAddresses" USING btree ("InvoiceDataId");
+CREATE INDEX "IX_U2FDevices_ApplicationUserId" ON "U2FDevices" USING btree ("ApplicationUserId");
+CREATE INDEX "IX_UserStore_StoreDataId" ON "UserStore" USING btree ("StoreDataId");
+CREATE UNIQUE INDEX "RoleNameIndex" ON "AspNetRoles" USING btree ("NormalizedName");
+CREATE UNIQUE INDEX "UserNameIndex" ON "AspNetUsers" USING btree ("NormalizedUserName");
+ALTER TABLE ONLY "AddressInvoices"
+ ADD CONSTRAINT "FK_AddressInvoices_Invoices_InvoiceDataId" FOREIGN KEY ("InvoiceDataId") REFERENCES "Invoices"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "ApiKeys"
+ ADD CONSTRAINT "FK_ApiKeys_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "ApiKeys"
+ ADD CONSTRAINT "FK_ApiKeys_Stores_StoreId" FOREIGN KEY ("StoreId") REFERENCES "Stores"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "Apps"
+ ADD CONSTRAINT "FK_Apps_Stores_StoreDataId" FOREIGN KEY ("StoreDataId") REFERENCES "Stores"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "AspNetRoleClaims"
+ ADD CONSTRAINT "FK_AspNetRoleClaims_AspNetRoles_RoleId" FOREIGN KEY ("RoleId") REFERENCES "AspNetRoles"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "AspNetUserClaims"
+ ADD CONSTRAINT "FK_AspNetUserClaims_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "AspNetUserLogins"
+ ADD CONSTRAINT "FK_AspNetUserLogins_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "AspNetUserRoles"
+ ADD CONSTRAINT "FK_AspNetUserRoles_AspNetRoles_RoleId" FOREIGN KEY ("RoleId") REFERENCES "AspNetRoles"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "AspNetUserRoles"
+ ADD CONSTRAINT "FK_AspNetUserRoles_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "AspNetUserTokens"
+ ADD CONSTRAINT "FK_AspNetUserTokens_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "Files"
+ ADD CONSTRAINT "FK_Files_AspNetUsers_ApplicationUserId" FOREIGN KEY ("ApplicationUserId") REFERENCES "AspNetUsers"("Id") ON DELETE RESTRICT;
+ALTER TABLE ONLY "HistoricalAddressInvoices"
+ ADD CONSTRAINT "FK_HistoricalAddressInvoices_Invoices_InvoiceDataId" FOREIGN KEY ("InvoiceDataId") REFERENCES "Invoices"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "InvoiceEvents"
+ ADD CONSTRAINT "FK_InvoiceEvents_Invoices_InvoiceDataId" FOREIGN KEY ("InvoiceDataId") REFERENCES "Invoices"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "Invoices"
+ ADD CONSTRAINT "FK_Invoices_Stores_StoreDataId" FOREIGN KEY ("StoreDataId") REFERENCES "Stores"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "PairedSINData"
+ ADD CONSTRAINT "FK_PairedSINData_Stores_StoreDataId" FOREIGN KEY ("StoreDataId") REFERENCES "Stores"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "PaymentRequests"
+ ADD CONSTRAINT "FK_PaymentRequests_Stores_StoreDataId" FOREIGN KEY ("StoreDataId") REFERENCES "Stores"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "Payments"
+ ADD CONSTRAINT "FK_Payments_Invoices_InvoiceDataId" FOREIGN KEY ("InvoiceDataId") REFERENCES "Invoices"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "PendingInvoices"
+ ADD CONSTRAINT "FK_PendingInvoices_Invoices_Id" FOREIGN KEY ("Id") REFERENCES "Invoices"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "RefundAddresses"
+ ADD CONSTRAINT "FK_RefundAddresses_Invoices_InvoiceDataId" FOREIGN KEY ("InvoiceDataId") REFERENCES "Invoices"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "U2FDevices"
+ ADD CONSTRAINT "FK_U2FDevices_AspNetUsers_ApplicationUserId" FOREIGN KEY ("ApplicationUserId") REFERENCES "AspNetUsers"("Id") ON DELETE RESTRICT;
+ALTER TABLE ONLY "UserStore"
+ ADD CONSTRAINT "FK_UserStore_AspNetUsers_ApplicationUserId" FOREIGN KEY ("ApplicationUserId") REFERENCES "AspNetUsers"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "UserStore"
+ ADD CONSTRAINT "FK_UserStore_Stores_StoreDataId" FOREIGN KEY ("StoreDataId") REFERENCES "Stores"("Id") ON DELETE CASCADE;
+ALTER TABLE ONLY "WalletTransactions"
+ ADD CONSTRAINT "FK_WalletTransactions_Wallets_WalletDataId" FOREIGN KEY ("WalletDataId") REFERENCES "Wallets"("Id") ON DELETE CASCADE;
diff --git a/BTCPayServer.Data/DBScriptsMigration.cs b/BTCPayServer.Data/DBScriptsMigration.cs
new file mode 100644
index 000000000..1cde23d80
--- /dev/null
+++ b/BTCPayServer.Data/DBScriptsMigration.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace BTCPayServer.Data
+{
+ public abstract class DBScriptsMigration : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ foreach (var script in GetType().GetCustomAttributes().OrderBy(n => n.ScriptName))
+ {
+ var name = Assembly.GetExecutingAssembly().GetManifestResourceNames()
+ .First(s => s.EndsWith("." + script.ScriptName, StringComparison.Ordinal));
+ var stream = Assembly.GetExecutingAssembly()
+ .GetManifestResourceStream(name);
+ using var reader = new StreamReader(stream, Encoding.UTF8);
+ migrationBuilder.Sql(reader.ReadToEnd());
+ }
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
+ public class DBScriptAttribute : Attribute
+ {
+ public DBScriptAttribute(string scriptName)
+ {
+ ScriptName = scriptName;
+ }
+ public string ScriptName { get; set; }
+ }
+}
diff --git a/BTCPayServer.Data/Migrations/20170913143004_Init.cs b/BTCPayServer.Data/Migrations/20170913143004_Init.cs
deleted file mode 100644
index 36736869c..000000000
--- a/BTCPayServer.Data/Migrations/20170913143004_Init.cs
+++ /dev/null
@@ -1,360 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20170913143004_Init")]
- public partial class Init : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "AspNetRoles",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- ConcurrencyStamp = table.Column(nullable: true),
- Name = table.Column(maxLength: 256, nullable: true),
- NormalizedName = table.Column(maxLength: 256, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoles", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUsers",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- AccessFailedCount = table.Column(nullable: false),
- ConcurrencyStamp = table.Column(nullable: true),
- Email = table.Column(maxLength: 256, nullable: true),
- EmailConfirmed = table.Column(nullable: false),
- LockoutEnabled = table.Column(nullable: false),
- LockoutEnd = table.Column(nullable: true),
- NormalizedEmail = table.Column(maxLength: 256, nullable: true),
- NormalizedUserName = table.Column(maxLength: 256, nullable: true),
- PasswordHash = table.Column(nullable: true),
- PhoneNumber = table.Column(nullable: true),
- PhoneNumberConfirmed = table.Column(nullable: false),
- SecurityStamp = table.Column(nullable: true),
- TwoFactorEnabled = table.Column(nullable: false),
- UserName = table.Column(maxLength: 256, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUsers", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Stores",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- DerivationStrategy = table.Column(nullable: true),
- SpeedPolicy = table.Column(nullable: false),
- StoreCertificate = table.Column(nullable: true),
- StoreName = table.Column(nullable: true),
- StoreWebsite = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Stores", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetRoleClaims",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- ClaimType = table.Column(nullable: true),
- ClaimValue = table.Column(nullable: true),
- RoleId = table.Column(nullable: false, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserClaims",
- columns: table => new
- {
- Id = table.Column(nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- ClaimType = table.Column(nullable: true),
- ClaimValue = table.Column(nullable: true),
- UserId = table.Column(nullable: false, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
- table.ForeignKey(
- name: "FK_AspNetUserClaims_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserLogins",
- columns: table => new
- {
- LoginProvider = table.Column(nullable: false, maxLength: 255),
- ProviderKey = table.Column(nullable: false, maxLength: 255),
- ProviderDisplayName = table.Column(nullable: true),
- UserId = table.Column(nullable: false, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
- table.ForeignKey(
- name: "FK_AspNetUserLogins_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserRoles",
- columns: table => new
- {
- UserId = table.Column(nullable: false, maxLength: null),
- RoleId = table.Column(nullable: false, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
- column: x => x.RoleId,
- principalTable: "AspNetRoles",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_AspNetUserRoles_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "AspNetUserTokens",
- columns: table => new
- {
- UserId = table.Column(nullable: false, maxLength: null),
- LoginProvider = table.Column(nullable: false, maxLength: 64),
- Name = table.Column(nullable: false, maxLength: 64),
- Value = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
- table.ForeignKey(
- name: "FK_AspNetUserTokens_AspNetUsers_UserId",
- column: x => x.UserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Invoices",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- Blob = table.Column(nullable: true),
- Created = table.Column(nullable: false),
- CustomerEmail = table.Column(nullable: true),
- ExceptionStatus = table.Column(nullable: true),
- ItemCode = table.Column(nullable: true),
- OrderId = table.Column(nullable: true),
- Status = table.Column(nullable: true),
- StoreDataId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Invoices", x => x.Id);
- table.ForeignKey(
- name: "FK_Invoices_Stores_StoreDataId",
- column: x => x.StoreDataId,
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "UserStore",
- columns: table => new
- {
- ApplicationUserId = table.Column(nullable: false, maxLength: null),
- StoreDataId = table.Column(nullable: false, maxLength: null),
- Role = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UserStore", x => new { x.ApplicationUserId, x.StoreDataId });
- table.ForeignKey(
- name: "FK_UserStore_AspNetUsers_ApplicationUserId",
- column: x => x.ApplicationUserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_UserStore_Stores_StoreDataId",
- column: x => x.StoreDataId,
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "Payments",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- Blob = table.Column(nullable: true),
- InvoiceDataId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Payments", x => x.Id);
- table.ForeignKey(
- name: "FK_Payments_Invoices_InvoiceDataId",
- column: x => x.InvoiceDataId,
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "RefundAddresses",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- Blob = table.Column(nullable: true),
- InvoiceDataId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_RefundAddresses", x => x.Id);
- table.ForeignKey(
- name: "FK_RefundAddresses_Invoices_InvoiceDataId",
- column: x => x.InvoiceDataId,
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetRoleClaims_RoleId",
- table: "AspNetRoleClaims",
- column: "RoleId");
-
- migrationBuilder.CreateIndex(
- name: "RoleNameIndex",
- table: "AspNetRoles",
- column: "NormalizedName",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserClaims_UserId",
- table: "AspNetUserClaims",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserLogins_UserId",
- table: "AspNetUserLogins",
- column: "UserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_AspNetUserRoles_RoleId",
- table: "AspNetUserRoles",
- column: "RoleId");
-
- migrationBuilder.CreateIndex(
- name: "EmailIndex",
- table: "AspNetUsers",
- column: "NormalizedEmail");
-
- migrationBuilder.CreateIndex(
- name: "UserNameIndex",
- table: "AspNetUsers",
- column: "NormalizedUserName",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_Invoices_StoreDataId",
- table: "Invoices",
- column: "StoreDataId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Payments_InvoiceDataId",
- table: "Payments",
- column: "InvoiceDataId");
-
- migrationBuilder.CreateIndex(
- name: "IX_RefundAddresses_InvoiceDataId",
- table: "RefundAddresses",
- column: "InvoiceDataId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UserStore_StoreDataId",
- table: "UserStore",
- column: "StoreDataId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "AspNetRoleClaims");
-
- migrationBuilder.DropTable(
- name: "AspNetUserClaims");
-
- migrationBuilder.DropTable(
- name: "AspNetUserLogins");
-
- migrationBuilder.DropTable(
- name: "AspNetUserRoles");
-
- migrationBuilder.DropTable(
- name: "AspNetUserTokens");
-
- migrationBuilder.DropTable(
- name: "Payments");
-
- migrationBuilder.DropTable(
- name: "RefundAddresses");
-
- migrationBuilder.DropTable(
- name: "UserStore");
-
- migrationBuilder.DropTable(
- name: "AspNetRoles");
-
- migrationBuilder.DropTable(
- name: "Invoices");
-
- migrationBuilder.DropTable(
- name: "AspNetUsers");
-
- migrationBuilder.DropTable(
- name: "Stores");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20170926073744_Settings.cs b/BTCPayServer.Data/Migrations/20170926073744_Settings.cs
deleted file mode 100644
index 67ea47fda..000000000
--- a/BTCPayServer.Data/Migrations/20170926073744_Settings.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20170926073744_Settings")]
- public partial class Settings : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Settings",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- Value = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Settings", x => x.Id);
- });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Settings");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20170926084408_RequiresEmailConfirmation.cs b/BTCPayServer.Data/Migrations/20170926084408_RequiresEmailConfirmation.cs
deleted file mode 100644
index d1e7bc831..000000000
--- a/BTCPayServer.Data/Migrations/20170926084408_RequiresEmailConfirmation.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20170926084408_RequiresEmailConfirmation")]
- public partial class RequiresEmailConfirmation : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "RequiresEmailConfirmation",
- table: "AspNetUsers",
- nullable: false,
- defaultValue: false);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "RequiresEmailConfirmation",
- table: "AspNetUsers");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20171006013443_AddressMapping.cs b/BTCPayServer.Data/Migrations/20171006013443_AddressMapping.cs
deleted file mode 100644
index 011ff100d..000000000
--- a/BTCPayServer.Data/Migrations/20171006013443_AddressMapping.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20171006013443_AddressMapping")]
- public partial class AddressMapping : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "AddressInvoices",
- columns: table => new
- {
- Address = table.Column(nullable: false, maxLength: null),
- InvoiceDataId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_AddressInvoices", x => x.Address);
- table.ForeignKey(
- name: "FK_AddressInvoices_Invoices_InvoiceDataId",
- column: x => x.InvoiceDataId,
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_AddressInvoices_InvoiceDataId",
- table: "AddressInvoices",
- column: "InvoiceDataId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "AddressInvoices");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20171010082424_Tokens.cs b/BTCPayServer.Data/Migrations/20171010082424_Tokens.cs
deleted file mode 100644
index 1846dbdb1..000000000
--- a/BTCPayServer.Data/Migrations/20171010082424_Tokens.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20171010082424_Tokens")]
- public partial class Tokens : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "PairedSINData",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- Facade = table.Column(nullable: true),
- Label = table.Column(nullable: true),
- Name = table.Column(nullable: true),
- PairingTime = table.Column(nullable: false),
- SIN = table.Column(nullable: true, maxLength: null),
- StoreDataId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PairedSINData", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "PairingCodes",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- DateCreated = table.Column(nullable: false),
- Expiration = table.Column(nullable: false),
- Facade = table.Column(nullable: true),
- Label = table.Column(nullable: true),
- Name = table.Column(nullable: true),
- SIN = table.Column(nullable: true),
- StoreDataId = table.Column(nullable: true, maxLength: null),
- TokenValue = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PairingCodes", x => x.Id);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_PairedSINData_SIN",
- table: "PairedSINData",
- column: "SIN");
-
- migrationBuilder.CreateIndex(
- name: "IX_PairedSINData_StoreDataId",
- table: "PairedSINData",
- column: "StoreDataId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "PairedSINData");
-
- migrationBuilder.DropTable(
- name: "PairingCodes");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20171012020112_PendingInvoices.cs b/BTCPayServer.Data/Migrations/20171012020112_PendingInvoices.cs
deleted file mode 100644
index 57bbfc964..000000000
--- a/BTCPayServer.Data/Migrations/20171012020112_PendingInvoices.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20171012020112_PendingInvoices")]
- public partial class PendingInvoices : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Name",
- table: "PairingCodes");
-
- migrationBuilder.DropColumn(
- name: "Name",
- table: "PairedSINData");
- migrationBuilder.CreateTable(
- name: "PendingInvoices",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PendingInvoices", x => x.Id);
- });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "PendingInvoices");
-
- migrationBuilder.AddColumn(
- name: "Name",
- table: "PairingCodes",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Name",
- table: "PairedSINData",
- nullable: true);
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20171023101754_StoreBlob.cs b/BTCPayServer.Data/Migrations/20171023101754_StoreBlob.cs
deleted file mode 100644
index deec42c08..000000000
--- a/BTCPayServer.Data/Migrations/20171023101754_StoreBlob.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20171023101754_StoreBlob")]
- public partial class StoreBlob : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "StoreBlob",
- table: "Stores",
- nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "StoreBlob",
- table: "Stores");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20171024163354_RenewUsedAddresses.cs b/BTCPayServer.Data/Migrations/20171024163354_RenewUsedAddresses.cs
deleted file mode 100644
index eb222a16d..000000000
--- a/BTCPayServer.Data/Migrations/20171024163354_RenewUsedAddresses.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20171024163354_RenewUsedAddresses")]
- public partial class RenewUsedAddresses : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "CreatedTime",
- table: "AddressInvoices",
- nullable: true);
-
- migrationBuilder.CreateTable(
- name: "HistoricalAddressInvoices",
- columns: table => new
- {
- InvoiceDataId = table.Column(nullable: false, maxLength: null),
- Address = table.Column(nullable: false, maxLength: null),
- Assigned = table.Column(nullable: false),
- UnAssigned = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_HistoricalAddressInvoices", x => new { x.InvoiceDataId, x.Address });
- table.ForeignKey(
- name: "FK_HistoricalAddressInvoices_Invoices_InvoiceDataId",
- column: x => x.InvoiceDataId,
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "HistoricalAddressInvoices");
-
- migrationBuilder.DropColumn(
- name: "CreatedTime",
- table: "AddressInvoices");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs b/BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs
deleted file mode 100644
index c0e3f02c2..000000000
--- a/BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20171105235734_PaymentAccounted")]
- public partial class PaymentAccounted : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "Accounted",
- table: "Payments",
- nullable: false,
- defaultValue: false);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Accounted",
- table: "Payments");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20171221054550_AltcoinSupport.cs b/BTCPayServer.Data/Migrations/20171221054550_AltcoinSupport.cs
deleted file mode 100644
index b07ecf638..000000000
--- a/BTCPayServer.Data/Migrations/20171221054550_AltcoinSupport.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20171221054550_AltcoinSupport")]
- public partial class AltcoinSupport : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "CryptoCode",
- table: "HistoricalAddressInvoices",
- nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "CryptoCode",
- table: "HistoricalAddressInvoices");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20180106095215_DerivationStrategies.cs b/BTCPayServer.Data/Migrations/20180106095215_DerivationStrategies.cs
deleted file mode 100644
index ed760fe52..000000000
--- a/BTCPayServer.Data/Migrations/20180106095215_DerivationStrategies.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20180106095215_DerivationStrategies")]
- public partial class DerivationStrategies : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "DerivationStrategies",
- table: "Stores",
- nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "DerivationStrategies",
- table: "Stores");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20180109021122_defaultcrypto.cs b/BTCPayServer.Data/Migrations/20180109021122_defaultcrypto.cs
deleted file mode 100644
index 393526634..000000000
--- a/BTCPayServer.Data/Migrations/20180109021122_defaultcrypto.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20180109021122_defaultcrypto")]
- public partial class defaultcrypto : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "DefaultCrypto",
- table: "Stores",
- nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "DefaultCrypto",
- table: "Stores");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20180114123253_events.cs b/BTCPayServer.Data/Migrations/20180114123253_events.cs
deleted file mode 100644
index df9af20dc..000000000
--- a/BTCPayServer.Data/Migrations/20180114123253_events.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20180114123253_events")]
- public partial class events : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "InvoiceEvents",
- columns: table => new
- {
- InvoiceDataId = table.Column(nullable: false, maxLength: null),
- UniqueId = table.Column(nullable: false, maxLength: null),
- Message = table.Column(nullable: true),
- Timestamp = table.Column(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_InvoiceEvents", x => new { x.InvoiceDataId, x.UniqueId });
- table.ForeignKey(
- name: "FK_InvoiceEvents_Invoices_InvoiceDataId",
- column: x => x.InvoiceDataId,
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "InvoiceEvents");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20180402095640_appdata.cs b/BTCPayServer.Data/Migrations/20180402095640_appdata.cs
deleted file mode 100644
index bd53c1072..000000000
--- a/BTCPayServer.Data/Migrations/20180402095640_appdata.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20180402095640_appdata")]
- public partial class appdata : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Apps",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- AppType = table.Column(nullable: true),
- Created = table.Column(nullable: false),
- Name = table.Column(nullable: true),
- Settings = table.Column(nullable: true),
- StoreDataId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Apps", x => x.Id);
- table.ForeignKey(
- name: "FK_Apps_Stores_StoreDataId",
- column: x => x.StoreDataId,
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_Apps_StoreDataId",
- table: "Apps",
- column: "StoreDataId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Apps");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20180429083930_legacyapikey.cs b/BTCPayServer.Data/Migrations/20180429083930_legacyapikey.cs
deleted file mode 100644
index ce34d303f..000000000
--- a/BTCPayServer.Data/Migrations/20180429083930_legacyapikey.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20180429083930_legacyapikey")]
- public partial class legacyapikey : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "ApiKeys",
- columns: table => new
- {
- Id = table.Column(maxLength: 50, nullable: false),
- StoreId = table.Column(maxLength: 50, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_ApiKeys", x => x.Id);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_ApiKeys_StoreId",
- table: "ApiKeys",
- column: "StoreId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "ApiKeys");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20180719095626_CanDeleteStores.cs b/BTCPayServer.Data/Migrations/20180719095626_CanDeleteStores.cs
deleted file mode 100644
index a30065936..000000000
--- a/BTCPayServer.Data/Migrations/20180719095626_CanDeleteStores.cs
+++ /dev/null
@@ -1,173 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20180719095626_CanDeleteStores")]
- public partial class CanDeleteStores : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_AddressInvoices_Invoices_InvoiceDataId",
- table: "AddressInvoices");
-
- migrationBuilder.DropForeignKey(
- name: "FK_Apps_Stores_StoreDataId",
- table: "Apps");
-
- migrationBuilder.DropForeignKey(
- name: "FK_Invoices_Stores_StoreDataId",
- table: "Invoices");
-
- migrationBuilder.DropForeignKey(
- name: "FK_Payments_Invoices_InvoiceDataId",
- table: "Payments");
-
- migrationBuilder.DropForeignKey(
- name: "FK_RefundAddresses_Invoices_InvoiceDataId",
- table: "RefundAddresses");
-
- migrationBuilder.AddForeignKey(
- name: "FK_AddressInvoices_Invoices_InvoiceDataId",
- table: "AddressInvoices",
- column: "InvoiceDataId",
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_ApiKeys_Stores_StoreId",
- table: "ApiKeys",
- column: "StoreId",
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Apps_Stores_StoreDataId",
- table: "Apps",
- column: "StoreDataId",
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Invoices_Stores_StoreDataId",
- table: "Invoices",
- column: "StoreDataId",
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_PairedSINData_Stores_StoreDataId",
- table: "PairedSINData",
- column: "StoreDataId",
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Payments_Invoices_InvoiceDataId",
- table: "Payments",
- column: "InvoiceDataId",
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_PendingInvoices_Invoices_Id",
- table: "PendingInvoices",
- column: "Id",
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
-
- migrationBuilder.AddForeignKey(
- name: "FK_RefundAddresses_Invoices_InvoiceDataId",
- table: "RefundAddresses",
- column: "InvoiceDataId",
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_AddressInvoices_Invoices_InvoiceDataId",
- table: "AddressInvoices");
-
- migrationBuilder.DropForeignKey(
- name: "FK_ApiKeys_Stores_StoreId",
- table: "ApiKeys");
-
- migrationBuilder.DropForeignKey(
- name: "FK_Apps_Stores_StoreDataId",
- table: "Apps");
-
- migrationBuilder.DropForeignKey(
- name: "FK_Invoices_Stores_StoreDataId",
- table: "Invoices");
-
- migrationBuilder.DropForeignKey(
- name: "FK_PairedSINData_Stores_StoreDataId",
- table: "PairedSINData");
-
- migrationBuilder.DropForeignKey(
- name: "FK_Payments_Invoices_InvoiceDataId",
- table: "Payments");
-
- migrationBuilder.DropForeignKey(
- name: "FK_PendingInvoices_Invoices_Id",
- table: "PendingInvoices");
-
- migrationBuilder.DropForeignKey(
- name: "FK_RefundAddresses_Invoices_InvoiceDataId",
- table: "RefundAddresses");
-
- migrationBuilder.AddForeignKey(
- name: "FK_AddressInvoices_Invoices_InvoiceDataId",
- table: "AddressInvoices",
- column: "InvoiceDataId",
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Apps_Stores_StoreDataId",
- table: "Apps",
- column: "StoreDataId",
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Invoices_Stores_StoreDataId",
- table: "Invoices",
- column: "StoreDataId",
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_Payments_Invoices_InvoiceDataId",
- table: "Payments",
- column: "InvoiceDataId",
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
-
- migrationBuilder.AddForeignKey(
- name: "FK_RefundAddresses_Invoices_InvoiceDataId",
- table: "RefundAddresses",
- column: "InvoiceDataId",
- principalTable: "Invoices",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20190121133309_AddPaymentRequests.cs b/BTCPayServer.Data/Migrations/20190121133309_AddPaymentRequests.cs
deleted file mode 100644
index 35819b286..000000000
--- a/BTCPayServer.Data/Migrations/20190121133309_AddPaymentRequests.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20190121133309_AddPaymentRequests")]
- public partial class AddPaymentRequests : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "PaymentRequests",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- StoreDataId = table.Column(nullable: true, maxLength: null),
- Status = table.Column(nullable: false),
- Blob = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PaymentRequests", x => x.Id);
- table.ForeignKey(
- name: "FK_PaymentRequests_Stores_StoreDataId",
- column: x => x.StoreDataId,
- principalTable: "Stores",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_PaymentRequests_Status",
- table: "PaymentRequests",
- column: "Status");
-
- migrationBuilder.CreateIndex(
- name: "IX_PaymentRequests_StoreDataId",
- table: "PaymentRequests",
- column: "StoreDataId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "PaymentRequests");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20190219032533_AppsTagging.cs b/BTCPayServer.Data/Migrations/20190219032533_AppsTagging.cs
deleted file mode 100644
index 47193479b..000000000
--- a/BTCPayServer.Data/Migrations/20190219032533_AppsTagging.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20190219032533_AppsTagging")]
- public partial class AppsTagging : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "TagAllInvoices",
- table: "Apps",
- nullable: false,
- defaultValue: false);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "TagAllInvoices",
- table: "Apps");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20190225091644_AddOpenIddict.cs b/BTCPayServer.Data/Migrations/20190225091644_AddOpenIddict.cs
deleted file mode 100644
index 92fe48d2b..000000000
--- a/BTCPayServer.Data/Migrations/20190225091644_AddOpenIddict.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20190225091644_AddOpenIddict")]
- public partial class AddOpenIddict : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "OpenIddictApplications",
- columns: table => new
- {
- ClientId = table.Column(maxLength: 100, nullable: false),
- ClientSecret = table.Column(nullable: true),
- ConcurrencyToken = table.Column(maxLength: 50, nullable: true),
- ConsentType = table.Column(nullable: true),
- DisplayName = table.Column(nullable: true),
- Id = table.Column(nullable: false, maxLength: null),
- Permissions = table.Column(nullable: true),
- PostLogoutRedirectUris = table.Column(nullable: true),
- Properties = table.Column(nullable: true),
- RedirectUris = table.Column(nullable: true),
- Type = table.Column(maxLength: 25, nullable: false),
- ApplicationUserId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictApplications", x => x.Id);
- table.ForeignKey(
- name: "FK_OpenIddictApplications_AspNetUsers_ApplicationUserId",
- column: x => x.ApplicationUserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "OpenIddictScopes",
- columns: table => new
- {
- ConcurrencyToken = table.Column(maxLength: 50, nullable: true),
- Description = table.Column(nullable: true),
- DisplayName = table.Column(nullable: true),
- Id = table.Column(nullable: false, maxLength: null),
- Name = table.Column(maxLength: 200, nullable: false),
- Properties = table.Column(nullable: true),
- Resources = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictScopes", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "OpenIddictAuthorizations",
- columns: table => new
- {
- ApplicationId = table.Column(nullable: true, maxLength: null),
- ConcurrencyToken = table.Column(maxLength: 50, nullable: true),
- Id = table.Column(nullable: false, maxLength: null),
- Properties = table.Column(nullable: true),
- Scopes = table.Column(nullable: true),
- Status = table.Column(maxLength: 25, nullable: false),
- Subject = table.Column(maxLength: 450, nullable: false),
- Type = table.Column(maxLength: 25, nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictAuthorizations", x => x.Id);
- table.ForeignKey(
- name: "FK_OpenIddictAuthorizations_OpenIddictApplications_ApplicationId",
- column: x => x.ApplicationId,
- principalTable: "OpenIddictApplications",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "OpenIddictTokens",
- columns: table => new
- {
- ApplicationId = table.Column(nullable: true, maxLength: null),
- AuthorizationId = table.Column(nullable: true, maxLength: null),
- ConcurrencyToken = table.Column(maxLength: 50, nullable: true),
- CreationDate = table.Column(nullable: true),
- ExpirationDate = table.Column(nullable: true),
- Id = table.Column(nullable: false, maxLength: null),
- Payload = table.Column(nullable: true),
- Properties = table.Column(nullable: true),
- ReferenceId = table.Column(maxLength: 100, nullable: true),
- Status = table.Column(maxLength: 25, nullable: false),
- Subject = table.Column(maxLength: 450, nullable: false),
- Type = table.Column(maxLength: 25, nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictTokens", x => x.Id);
- table.ForeignKey(
- name: "FK_OpenIddictTokens_OpenIddictApplications_ApplicationId",
- column: x => x.ApplicationId,
- principalTable: "OpenIddictApplications",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- table.ForeignKey(
- name: "FK_OpenIddictTokens_OpenIddictAuthorizations_AuthorizationId",
- column: x => x.AuthorizationId,
- principalTable: "OpenIddictAuthorizations",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictApplications_ApplicationUserId",
- table: "OpenIddictApplications",
- column: "ApplicationUserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictApplications_ClientId",
- table: "OpenIddictApplications",
- column: "ClientId",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictAuthorizations_ApplicationId_Status_Subject_Type",
- table: "OpenIddictAuthorizations",
- columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictScopes_Name",
- table: "OpenIddictScopes",
- column: "Name",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictTokens_AuthorizationId",
- table: "OpenIddictTokens",
- column: "AuthorizationId");
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictTokens_ReferenceId",
- table: "OpenIddictTokens",
- column: "ReferenceId",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictTokens_ApplicationId_Status_Subject_Type",
- table: "OpenIddictTokens",
- columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "OpenIddictScopes");
-
- migrationBuilder.DropTable(
- name: "OpenIddictTokens");
-
- migrationBuilder.DropTable(
- name: "OpenIddictAuthorizations");
-
- migrationBuilder.DropTable(
- name: "OpenIddictApplications");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20190324141717_AddFiles.cs b/BTCPayServer.Data/Migrations/20190324141717_AddFiles.cs
deleted file mode 100644
index d0b980674..000000000
--- a/BTCPayServer.Data/Migrations/20190324141717_AddFiles.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20190324141717_AddFiles")]
- public partial class AddFiles : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Files",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- FileName = table.Column(nullable: true),
- StorageFileName = table.Column(nullable: true),
- Timestamp = table.Column(nullable: false),
- ApplicationUserId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Files", x => x.Id);
- table.ForeignKey(
- name: "FK_Files_AspNetUsers_ApplicationUserId",
- column: x => x.ApplicationUserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_Files_ApplicationUserId",
- table: "Files",
- column: "ApplicationUserId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "Files");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20190425081749_AddU2fDevices.cs b/BTCPayServer.Data/Migrations/20190425081749_AddU2fDevices.cs
deleted file mode 100644
index 505a1adee..000000000
--- a/BTCPayServer.Data/Migrations/20190425081749_AddU2fDevices.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20190425081749_AddU2fDevices")]
- public partial class AddU2fDevices : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Facade",
- table: "PairedSINData");
-
- migrationBuilder.CreateTable(
- name: "U2FDevices",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- Name = table.Column(nullable: true),
- KeyHandle = table.Column(nullable: false),
- PublicKey = table.Column(nullable: false),
- AttestationCert = table.Column(nullable: false),
- Counter = table.Column(nullable: false),
- ApplicationUserId = table.Column(nullable: true, maxLength: null)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_U2FDevices", x => x.Id);
- table.ForeignKey(
- name: "FK_U2FDevices_AspNetUsers_ApplicationUserId",
- column: x => x.ApplicationUserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_U2FDevices_ApplicationUserId",
- table: "U2FDevices",
- column: "ApplicationUserId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "U2FDevices");
- //if it did not support dropping it, then it is still here and re-adding it would throw
- migrationBuilder.AddColumn(
- name: "Facade",
- table: "PairedSINData",
- nullable: true);
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20190701082105_sort_paymentrequests.cs b/BTCPayServer.Data/Migrations/20190701082105_sort_paymentrequests.cs
deleted file mode 100644
index 6e1bb9488..000000000
--- a/BTCPayServer.Data/Migrations/20190701082105_sort_paymentrequests.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20190701082105_sort_paymentrequests")]
- public partial class sort_paymentrequests : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "Created",
- table: "PaymentRequests",
- nullable: false,
- defaultValue: new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)));
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Created",
- table: "PaymentRequests");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20190802142637_WalletData.cs b/BTCPayServer.Data/Migrations/20190802142637_WalletData.cs
deleted file mode 100644
index 832c35030..000000000
--- a/BTCPayServer.Data/Migrations/20190802142637_WalletData.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20190802142637_WalletData")]
- public partial class WalletData : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Wallets",
- columns: table => new
- {
- Id = table.Column(nullable: false, maxLength: null),
- Blob = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Wallets", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "WalletTransactions",
- columns: table => new
- {
- WalletDataId = table.Column(nullable: false, maxLength: null),
- TransactionId = table.Column(nullable: false, maxLength: null),
- Labels = table.Column(nullable: true),
- Blob = table.Column(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_WalletTransactions", x => new { x.WalletDataId, x.TransactionId });
- table.ForeignKey(
- name: "FK_WalletTransactions_Wallets_WalletDataId",
- column: x => x.WalletDataId,
- principalTable: "Wallets",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "WalletTransactions");
-
- migrationBuilder.DropTable(
- name: "Wallets");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs b/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs
deleted file mode 100644
index f733923cf..000000000
--- a/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20200110064617_OpenIddictUpdate")]
- public partial class OpenIddictUpdate : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn(
- name: "Subject",
- table: "OpenIddictTokens",
- maxLength: 450,
- nullable: true,
- oldClrType: typeof(string),
- oldMaxLength: 450);
-
- migrationBuilder.AlterColumn(
- name: "Subject",
- table: "OpenIddictAuthorizations",
- maxLength: 450,
- nullable: true,
- oldClrType: typeof(string),
- oldMaxLength: 450);
-
- migrationBuilder.AddColumn(
- name: "Requirements",
- table: "OpenIddictApplications",
- nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Requirements",
- table: "OpenIddictApplications");
-
- migrationBuilder.AlterColumn(
- name: "Subject",
- table: "OpenIddictTokens",
- maxLength: 450,
- nullable: false,
- oldClrType: typeof(string),
- oldMaxLength: 450,
- oldNullable: true);
-
- migrationBuilder.AlterColumn(
- name: "Subject",
- table: "OpenIddictAuthorizations",
- maxLength: 450,
- nullable: false,
- oldClrType: typeof(string),
- oldMaxLength: 450,
- oldNullable: true);
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20200119130108_ExtendApiKeys.cs b/BTCPayServer.Data/Migrations/20200119130108_ExtendApiKeys.cs
deleted file mode 100644
index 38a4bf072..000000000
--- a/BTCPayServer.Data/Migrations/20200119130108_ExtendApiKeys.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20200119130108_ExtendApiKeys")]
- public partial class ExtendApiKeys : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "Permissions",
- table: "ApiKeys",
- nullable: true);
-
- migrationBuilder.AddColumn(
- name: "Type",
- table: "ApiKeys",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.AddColumn(
- name: "UserId",
- table: "ApiKeys",
- maxLength: 50,
- nullable: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_ApiKeys_UserId",
- table: "ApiKeys",
- column: "UserId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_ApiKeys_AspNetUsers_UserId",
- table: "ApiKeys",
- column: "UserId",
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_ApiKeys_AspNetUsers_UserId",
- table: "ApiKeys");
-
- migrationBuilder.DropIndex(
- name: "IX_ApiKeys_UserId",
- table: "ApiKeys");
-
- migrationBuilder.DropColumn(
- name: "Permissions",
- table: "ApiKeys");
-
- migrationBuilder.DropColumn(
- name: "Type",
- table: "ApiKeys");
-
- migrationBuilder.DropColumn(
- name: "UserId",
- table: "ApiKeys");
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20200224134444_Remove_OpenIddict.cs b/BTCPayServer.Data/Migrations/20200224134444_Remove_OpenIddict.cs
deleted file mode 100644
index 9cd7d588e..000000000
--- a/BTCPayServer.Data/Migrations/20200224134444_Remove_OpenIddict.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-using System;
-using BTCPayServer.Data;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace BTCPayServer.Migrations
-{
- [DbContext(typeof(ApplicationDbContext))]
- [Migration("20200224134444_Remove_OpenIddict")]
- public partial class Remove_OpenIddict : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "OpenIddictScopes");
-
- migrationBuilder.DropTable(
- name: "OpenIddictTokens");
-
- migrationBuilder.DropTable(
- name: "OpenIddictAuthorizations");
-
- migrationBuilder.DropTable(
- name: "OpenIddictApplications");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "OpenIddictApplications",
- columns: table => new
- {
- Id = table.Column(type: "TEXT", nullable: false, maxLength: null),
- ApplicationUserId = table.Column(type: "TEXT", nullable: true, maxLength: null),
- ClientId = table.Column(type: "TEXT", maxLength: 100, nullable: false),
- ClientSecret = table.Column(type: "TEXT", nullable: true),
- ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
- ConsentType = table.Column(type: "TEXT", nullable: true),
- DisplayName = table.Column(type: "TEXT", nullable: true),
- Permissions = table.Column(type: "TEXT", nullable: true),
- PostLogoutRedirectUris = table.Column(type: "TEXT", nullable: true),
- Properties = table.Column(type: "TEXT", nullable: true),
- RedirectUris = table.Column(type: "TEXT", nullable: true),
- Requirements = table.Column(type: "TEXT", nullable: true),
- Type = table.Column(type: "TEXT", maxLength: 25, nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictApplications", x => x.Id);
- table.ForeignKey(
- name: "FK_OpenIddictApplications_AspNetUsers_ApplicationUserId",
- column: x => x.ApplicationUserId,
- principalTable: "AspNetUsers",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "OpenIddictScopes",
- columns: table => new
- {
- Id = table.Column(type: "TEXT", nullable: false, maxLength: null),
- ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
- Description = table.Column(type: "TEXT", nullable: true),
- DisplayName = table.Column(type: "TEXT", nullable: true),
- Name = table.Column(type: "TEXT", maxLength: 200, nullable: false),
- Properties = table.Column(type: "TEXT", nullable: true),
- Resources = table.Column(type: "TEXT", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictScopes", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "OpenIddictAuthorizations",
- columns: table => new
- {
- Id = table.Column(type: "TEXT", nullable: false, maxLength: null),
- ApplicationId = table.Column(type: "TEXT", nullable: true, maxLength: null),
- ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
- Properties = table.Column(type: "TEXT", nullable: true),
- Scopes = table.Column(type: "TEXT", nullable: true),
- Status = table.Column(type: "TEXT", maxLength: 25, nullable: false),
- Subject = table.Column(type: "TEXT", maxLength: 450, nullable: true),
- Type = table.Column(type: "TEXT", maxLength: 25, nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictAuthorizations", x => x.Id);
- table.ForeignKey(
- name: "FK_OpenIddictAuthorizations_OpenIddictApplications_ApplicationId",
- column: x => x.ApplicationId,
- principalTable: "OpenIddictApplications",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateTable(
- name: "OpenIddictTokens",
- columns: table => new
- {
- Id = table.Column(type: "TEXT", nullable: false, maxLength: null),
- ApplicationId = table.Column(type: "TEXT", nullable: true, maxLength: null),
- AuthorizationId = table.Column(type: "TEXT", nullable: true, maxLength: null),
- ConcurrencyToken = table.Column(type: "TEXT", maxLength: 50, nullable: true),
- CreationDate = table.Column(type: "TEXT", nullable: true),
- ExpirationDate = table.Column(type: "TEXT", nullable: true),
- Payload = table.Column(type: "TEXT", nullable: true),
- Properties = table.Column(type: "TEXT", nullable: true),
- ReferenceId = table.Column(type: "TEXT", maxLength: 100, nullable: true),
- Status = table.Column(type: "TEXT", maxLength: 25, nullable: false),
- Subject = table.Column(type: "TEXT", maxLength: 450, nullable: true),
- Type = table.Column(type: "TEXT", maxLength: 25, nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_OpenIddictTokens", x => x.Id);
- table.ForeignKey(
- name: "FK_OpenIddictTokens_OpenIddictApplications_ApplicationId",
- column: x => x.ApplicationId,
- principalTable: "OpenIddictApplications",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- table.ForeignKey(
- name: "FK_OpenIddictTokens_OpenIddictAuthorizations_AuthorizationId",
- column: x => x.AuthorizationId,
- principalTable: "OpenIddictAuthorizations",
- principalColumn: "Id",
- onDelete: ReferentialAction.Restrict);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictApplications_ApplicationUserId",
- table: "OpenIddictApplications",
- column: "ApplicationUserId");
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictApplications_ClientId",
- table: "OpenIddictApplications",
- column: "ClientId",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictAuthorizations_ApplicationId_Status_Subject_Type",
- table: "OpenIddictAuthorizations",
- columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictScopes_Name",
- table: "OpenIddictScopes",
- column: "Name",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictTokens_AuthorizationId",
- table: "OpenIddictTokens",
- column: "AuthorizationId");
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictTokens_ReferenceId",
- table: "OpenIddictTokens",
- column: "ReferenceId",
- unique: true);
-
- migrationBuilder.CreateIndex(
- name: "IX_OpenIddictTokens_ApplicationId_Status_Subject_Type",
- table: "OpenIddictTokens",
- columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
- }
- }
-}
diff --git a/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs b/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs
index e5f6fc6ac..c38eb9a72 100644
--- a/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs
+++ b/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs
@@ -6,22 +6,9 @@ namespace BTCPayServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20200225133433_AddApiKeyLabel")]
- public partial class AddApiKeyLabel : Migration
+ [DBScript("000.Init.sql")]
+ public partial class AddApiKeyLabel : DBScriptsMigration
{
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "Label",
- table: "ApiKeys",
- nullable: true);
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "Label",
- table: "ApiKeys");
- }
}
}
diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs
index e30ada0f2..e6b1508f8 100644
--- a/BTCPayServer.Tests/UnitTest1.cs
+++ b/BTCPayServer.Tests/UnitTest1.cs
@@ -2738,17 +2738,6 @@ namespace BTCPayServer.Tests
Multiplier = 2
}
})));
- blob.AdditionalData.Add("walletKeyPathRoots", JToken.Parse(
- serializer.ToString(new Dictionary()
- {
- {
- PaymentTypes.CHAIN.GetPaymentMethodId("BTC").ToString(),
- new KeyPath("44'/0'/0'").ToString()
- }
- })));
-
- blob.AdditionalData.Add("networkFeeDisabled", JToken.Parse(
- serializer.ToString((bool?)true)));
blob.AdditionalData.Add("onChainMinValue", JToken.Parse(
serializer.ToString(new CurrencyValue()
@@ -2775,12 +2764,7 @@ namespace BTCPayServer.Tests
Assert.Contains(blob.PaymentMethodCriteria,
criteria => criteria.PaymentMethod == PaymentTypes.CHAIN.GetPaymentMethodId("BTC") &&
criteria.Above && criteria.Value.Value == 5m && criteria.Value.Currency == "USD");
- Assert.Equal(NetworkFeeMode.Never, blob.NetworkFeeMode);
var handlers = tester.PayTester.GetService();
- Assert.Contains(store.GetPaymentMethodConfigs(handlers), method =>
- method.Value is DerivationSchemeSettings dss &&
- method.Key == PaymentTypes.CHAIN.GetPaymentMethodId("BTC") &&
- dss.AccountKeySettings[0].AccountKeyPath == new KeyPath("44'/0'/0'"));
await acc.ImportOldInvoices();
var dbContext = tester.PayTester.GetService().CreateContext();
diff --git a/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs b/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs
index 5b012f748..74f6368bb 100644
--- a/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs
+++ b/BTCPayServer/Controllers/GreenField/GreenfieldUsersController.cs
@@ -224,8 +224,8 @@ namespace BTCPayServer.Controllers.Greenfield
await _userManager.AddToRoleAsync(user, Roles.ServerAdmin);
if (!anyAdmin)
{
- var settings = await _settingsRepository.GetSettingAsync();
- if (settings != null)
+ var settings = await _settingsRepository.GetSettingAsync() ?? new ThemeSettings();
+ if (settings.FirstRun)
{
settings.FirstRun = false;
await _settingsRepository.UpdateSetting(settings);
diff --git a/BTCPayServer/Hosting/MigrationStartupTask.cs b/BTCPayServer/Hosting/MigrationStartupTask.cs
index 85aead4b8..c4d11144b 100644
--- a/BTCPayServer/Hosting/MigrationStartupTask.cs
+++ b/BTCPayServer/Hosting/MigrationStartupTask.cs
@@ -52,7 +52,6 @@ namespace BTCPayServer.Hosting
private readonly LightningAddressService _lightningAddressService;
private readonly ILogger _logger;
private readonly LightningClientFactoryService _lightningClientFactoryService;
- private readonly UserManager _userManager;
public IOptions LightningOptions { get; }
@@ -60,7 +59,6 @@ namespace BTCPayServer.Hosting
PaymentMethodHandlerDictionary handlers,
StoreRepository storeRepository,
ApplicationDbContextFactory dbContextFactory,
- UserManager userManager,
IOptions lightningOptions,
SettingsRepository settingsRepository,
AppService appService,
@@ -80,7 +78,6 @@ namespace BTCPayServer.Hosting
_lightningAddressService = lightningAddressService;
_logger = logger;
_lightningClientFactoryService = lightningClientFactoryService;
- _userManager = userManager;
LightningOptions = lightningOptions;
}
public async Task ExecuteAsync(CancellationToken cancellationToken = default)
@@ -98,9 +95,9 @@ namespace BTCPayServer.Hosting
prop.SetValue(settings, true);
}
// Ensure these checks still get run
- settings.CheckedFirstRun = false;
settings.FileSystemStorageAsDefault = false;
await _Settings.UpdateSetting(settings);
+ await _Settings.UpdateSetting(new ThemeSettings());
}
if (!settings.PaymentMethodCriteria)
@@ -109,45 +106,6 @@ namespace BTCPayServer.Hosting
settings.PaymentMethodCriteria = true;
await _Settings.UpdateSetting(settings);
}
- if (!settings.DeprecatedLightningConnectionStringCheck)
- {
- await DeprecatedLightningConnectionStringCheck();
- settings.DeprecatedLightningConnectionStringCheck = true;
- await _Settings.UpdateSetting(settings);
- }
- if (!settings.ConvertMultiplierToSpread)
- {
- await ConvertMultiplierToSpread();
- settings.ConvertMultiplierToSpread = true;
- await _Settings.UpdateSetting(settings);
- }
- if (!settings.ConvertNetworkFeeProperty)
- {
- await ConvertNetworkFeeProperty();
- settings.ConvertNetworkFeeProperty = true;
- await _Settings.UpdateSetting(settings);
- }
- if (!settings.ConvertCrowdfundOldSettings)
- {
- await ConvertCrowdfundOldSettings();
- settings.ConvertCrowdfundOldSettings = true;
- await _Settings.UpdateSetting(settings);
- }
- if (!settings.ConvertWalletKeyPathRoots)
- {
- await ConvertConvertWalletKeyPathRoots();
- settings.ConvertWalletKeyPathRoots = true;
- await _Settings.UpdateSetting(settings);
- }
- if (!settings.CheckedFirstRun)
- {
- var themeSettings = await _Settings.GetSettingAsync() ?? new ThemeSettings();
- var admin = await _userManager.GetUsersInRoleAsync(Roles.ServerAdmin);
- themeSettings.FirstRun = admin.Count == 0;
- await _Settings.UpdateSetting(themeSettings);
- settings.CheckedFirstRun = true;
- await _Settings.UpdateSetting(settings);
- }
if (!settings.TransitionToStoreBlobAdditionalData)
{
@@ -950,43 +908,6 @@ retry:
}
}
- private async Task ConvertConvertWalletKeyPathRoots()
- {
- bool save = false;
- using var ctx = _DBContextFactory.CreateContext();
- foreach (var store in await ctx.Stores.AsQueryable().ToArrayAsync())
- {
-#pragma warning disable CS0618 // Type or member is obsolete
- var blob = store.GetStoreBlob();
-
- if (blob.AdditionalData.TryGetValue("walletKeyPathRoots", out var walletKeyPathRootsJToken))
- {
- var walletKeyPathRoots = walletKeyPathRootsJToken.ToObject>();
-
- if (!(walletKeyPathRoots?.Any() is true))
- continue;
- var walletKeyPathRoots2 = walletKeyPathRoots.ToDictionary(w => PaymentMethodId.Parse(w.Key), w => w.Value);
- foreach (var (id, scheme) in store.GetPaymentMethodConfigs(_handlers))
- {
- var handler = (BitcoinLikePaymentHandler)_handlers[id];
- if (walletKeyPathRoots2.TryGetValue(id,
- out var root))
- {
- scheme.AccountKeyPath = new NBitcoin.KeyPath(root);
- MigrateDerivationSettings(scheme, handler.Network);
- store.SetPaymentMethodConfig(_handlers[id], scheme);
- save = true;
- }
- }
-
- blob.AdditionalData.Remove("walletKeyPathRoots");
- store.SetStoreBlob(blob);
- }
-#pragma warning restore CS0618 // Type or member is obsolete
- }
- if (save)
- await ctx.SaveChangesAsync();
- }
void MigrateDerivationSettings(DerivationSchemeSettings s, BTCPayNetwork network)
{
if (network == null || s.AccountKeySettings is not (null or { Length: 1 }))
@@ -1004,22 +925,6 @@ retry:
#pragma warning restore CS0618 // Type or member is obsolete
}
- private async Task ConvertCrowdfundOldSettings()
- {
- using var ctx = _DBContextFactory.CreateContext();
- foreach (var app in await ctx.Apps.Where(a => a.AppType == "Crowdfund").ToArrayAsync())
- {
- var settings = app.GetSettings();
-#pragma warning disable CS0618 // Type or member is obsolete
- if (settings.UseAllStoreInvoices)
-#pragma warning restore CS0618 // Type or member is obsolete
- {
- app.TagAllInvoices = true;
- }
- }
- await ctx.SaveChangesAsync();
- }
-
private async Task MigratePaymentMethodCriteria()
{
using var ctx = _DBContextFactory.CreateContext();
@@ -1074,53 +979,6 @@ retry:
await ctx.SaveChangesAsync();
}
- private async Task ConvertNetworkFeeProperty()
- {
- using var ctx = _DBContextFactory.CreateContext();
- foreach (var store in await ctx.Stores.AsQueryable().ToArrayAsync())
- {
- var blob = store.GetStoreBlob();
- if (blob.AdditionalData.TryGetValue("networkFeeDisabled", out var networkFeeModeJToken))
- {
- var networkFeeMode = networkFeeModeJToken.ToObject();
- if (networkFeeMode != null)
- {
- blob.NetworkFeeMode = networkFeeMode.Value ? NetworkFeeMode.Never : NetworkFeeMode.Always;
- }
-
- blob.AdditionalData.Remove("networkFeeDisabled");
- store.SetStoreBlob(blob);
- }
- }
- await ctx.SaveChangesAsync();
- }
-
- private async Task ConvertMultiplierToSpread()
- {
- using var ctx = _DBContextFactory.CreateContext();
- foreach (var store in await ctx.Stores.AsQueryable().ToArrayAsync())
- {
- var blob = store.GetStoreBlob();
- decimal multiplier = 1.0m;
- if (blob.AdditionalData.TryGetValue("rateRules", out var rateRulesJToken))
- {
- var rateRules = new Serializer(null).ToObject>(rateRulesJToken.ToString());
- if (rateRules != null && rateRules.Count != 0)
- {
- foreach (var rule in rateRules)
- {
- multiplier = rule.Apply(null, multiplier);
- }
- }
-
- blob.AdditionalData.Remove("rateRules");
- blob.Spread = Math.Min(1.0m, Math.Max(0m, -(multiplier - 1.0m)));
- store.SetStoreBlob(blob);
- }
- }
- await ctx.SaveChangesAsync();
- }
-
public class RateRule_Obsolete
{
public RateRule_Obsolete()
@@ -1136,27 +994,5 @@ retry:
return rate * (decimal)Multiplier;
}
}
-
- private async Task DeprecatedLightningConnectionStringCheck()
- {
- await using var ctx = _DBContextFactory.CreateContext();
- foreach (var store in await ctx.Stores.AsQueryable().ToArrayAsync())
- {
- foreach (var (id, method) in store.GetPaymentMethodConfigs(_handlers))
- {
- var lightning = method.GetExternalLightningUrl();
- if (lightning is null)
- continue;
- var client = _lightningClientFactoryService.Create(lightning,
- ((IHasNetwork)_handlers[id]).Network);
- if (client?.ToString() != lightning)
- {
- method.SetLightningUrl(client);
- store.SetPaymentMethodConfig(_handlers[id], method);
- }
- }
- }
- await ctx.SaveChangesAsync();
- }
}
}
diff --git a/BTCPayServer/Services/Apps/CrowdfundSettings.cs b/BTCPayServer/Services/Apps/CrowdfundSettings.cs
index e70bfe5c7..1fb78f0b4 100644
--- a/BTCPayServer/Services/Apps/CrowdfundSettings.cs
+++ b/BTCPayServer/Services/Apps/CrowdfundSettings.cs
@@ -40,8 +40,6 @@ namespace BTCPayServer.Services.Apps
public bool AnimationsEnabled { get; set; }
public int ResetEveryAmount { get; set; } = 1;
public CrowdfundResetEvery ResetEvery { get; set; } = CrowdfundResetEvery.Never;
- [Obsolete("Use AppData.TagAllInvoices instead")]
- public bool UseAllStoreInvoices { get; set; }
public bool DisplayPerksRanking { get; set; }
public bool DisplayPerksValue { get; set; }
public bool SortPerksByPopularity { get; set; }
diff --git a/BTCPayServer/Services/MigrationSettings.cs b/BTCPayServer/Services/MigrationSettings.cs
index 2fb58f226..a787290e2 100644
--- a/BTCPayServer/Services/MigrationSettings.cs
+++ b/BTCPayServer/Services/MigrationSettings.cs
@@ -7,12 +7,6 @@ namespace BTCPayServer.Services
[JsonProperty("MigrateHotwalletProperty2")]
public bool MigrateHotwalletProperty { get; set; }
public bool MigrateU2FToFIDO2 { get; set; }
- public bool DeprecatedLightningConnectionStringCheck { get; set; }
- public bool ConvertMultiplierToSpread { get; set; }
- public bool ConvertNetworkFeeProperty { get; set; }
- public bool ConvertCrowdfundOldSettings { get; set; }
- public bool ConvertWalletKeyPathRoots { get; set; }
- public bool CheckedFirstRun { get; set; }
public bool PaymentMethodCriteria { get; set; }
public bool TransitionToStoreBlobAdditionalData { get; set; }
public bool TransitionInternalNodeConnectionString { get; set; }
diff --git a/BTCPayServer/Services/ThemesSettings.cs b/BTCPayServer/Services/ThemesSettings.cs
index 416d8fd94..73c18f751 100644
--- a/BTCPayServer/Services/ThemesSettings.cs
+++ b/BTCPayServer/Services/ThemesSettings.cs
@@ -30,7 +30,7 @@ public class ThemeSettings
public string LogoFileId { get; set; }
- public bool FirstRun { get; set; }
+ public bool FirstRun { get; set; } = true;
public override string ToString()
{