diff --git a/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs b/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs index 565a9542d..ef9d29205 100644 --- a/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs +++ b/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs @@ -11,13 +11,16 @@ namespace BTCPayServer.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { + int? maxLength = this.IsMySql(migrationBuilder.ActiveProvider) ? (int?)255 : null; + migrationBuilder.DropTable( name: "RefundAddresses"); migrationBuilder.AddColumn( name: "CurrentRefundId", table: "Invoices", - nullable: true); + nullable: true, + maxLength: maxLength); migrationBuilder.CreateTable( name: "Notifications", @@ -73,7 +76,7 @@ namespace BTCPayServer.Migrations PullPaymentDataId = table.Column(maxLength: 30, nullable: true), State = table.Column(maxLength: 20, nullable: false), PaymentMethodId = table.Column(maxLength: 20, nullable: false), - Destination = table.Column(nullable: true), + Destination = table.Column(maxLength: maxLength, nullable: true), Blob = table.Column(nullable: true), Proof = table.Column(nullable: true) }, @@ -92,8 +95,8 @@ namespace BTCPayServer.Migrations name: "Refunds", columns: table => new { - InvoiceDataId = table.Column(nullable: false), - PullPaymentDataId = table.Column(nullable: false) + InvoiceDataId = table.Column(maxLength: maxLength, nullable: false), + PullPaymentDataId = table.Column(maxLength: maxLength, nullable: false) }, constraints: table => { diff --git a/BTCPayServer.Data/Migrations/20201108054749_webhooks.cs b/BTCPayServer.Data/Migrations/20201108054749_webhooks.cs index fcf1d6739..34cee3df0 100644 --- a/BTCPayServer.Data/Migrations/20201108054749_webhooks.cs +++ b/BTCPayServer.Data/Migrations/20201108054749_webhooks.cs @@ -27,8 +27,8 @@ namespace BTCPayServer.Migrations name: "StoreWebhooks", columns: table => new { - StoreId = table.Column(nullable: false), - WebhookId = table.Column(nullable: false) + StoreId = table.Column(maxLength: 50, nullable: false), + WebhookId = table.Column(maxLength: 25, nullable: false) }, constraints: table => { @@ -71,8 +71,8 @@ namespace BTCPayServer.Migrations name: "InvoiceWebhookDeliveries", columns: table => new { - InvoiceId = table.Column(nullable: false), - DeliveryId = table.Column(nullable: false) + InvoiceId = table.Column(maxLength: 255, nullable: false), + DeliveryId = table.Column(maxLength: 100, nullable: false) }, constraints: table => { diff --git a/BTCPayServer.Data/Migrations/20201208054211_invoicesorderindex.cs b/BTCPayServer.Data/Migrations/20201208054211_invoicesorderindex.cs index 3bc12a32f..a93f4198f 100644 --- a/BTCPayServer.Data/Migrations/20201208054211_invoicesorderindex.cs +++ b/BTCPayServer.Data/Migrations/20201208054211_invoicesorderindex.cs @@ -10,7 +10,17 @@ namespace BTCPayServer.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.CreateIndex( + if (!migrationBuilder.IsSqlite()) + { + migrationBuilder.AlterColumn( + name: "OrderId", + table: "Invoices", + maxLength: 100, + nullable: true, + oldClrType: typeof(string)); + } + + migrationBuilder.CreateIndex( name: "IX_Invoices_OrderId", table: "Invoices", column: "OrderId"); diff --git a/BTCPayServer.Data/Migrations/20201228225040_AddingInvoiceSearchesTable.cs b/BTCPayServer.Data/Migrations/20201228225040_AddingInvoiceSearchesTable.cs index 9e7aca3db..6cd16b38f 100644 --- a/BTCPayServer.Data/Migrations/20201228225040_AddingInvoiceSearchesTable.cs +++ b/BTCPayServer.Data/Migrations/20201228225040_AddingInvoiceSearchesTable.cs @@ -21,8 +21,8 @@ namespace BTCPayServer.Migrations .Annotation("MySql:ValueGeneratedOnAdd", true) .Annotation("Sqlite:Autoincrement", true), // eof manually added - InvoiceDataId = table.Column(nullable: true), - Value = table.Column(nullable: true) + InvoiceDataId = table.Column(maxLength: 255, nullable: true), + Value = table.Column(maxLength: 512, nullable: true) }, constraints: table => {