Do not drop column for sqlite

This commit is contained in:
nicolas.dorier 2017-10-12 16:41:11 +09:00
parent bae08b6966
commit caca8e81c2
2 changed files with 43 additions and 36 deletions

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<Version>1.0.0.7</Version> <Version>1.0.0.8</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Build\dockerfiles\**" /> <Compile Remove="Build\dockerfiles\**" />

View file

@ -4,44 +4,51 @@ using System.Collections.Generic;
namespace BTCPayServer.Migrations namespace BTCPayServer.Migrations
{ {
public partial class PendingInvoices : Migration public partial class PendingInvoices : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropColumn( if(SupportDropColumn(migrationBuilder.ActiveProvider))
name: "Name", {
table: "PairingCodes"); migrationBuilder.DropColumn(
name: "Name",
table: "PairingCodes");
migrationBuilder.DropColumn( migrationBuilder.DropColumn(
name: "Name", name: "Name",
table: "PairedSINData"); table: "PairedSINData");
}
migrationBuilder.CreateTable(
name: "PendingInvoices",
columns: table => new
{
Id = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PendingInvoices", x => x.Id);
});
}
migrationBuilder.CreateTable( private bool SupportDropColumn(string activeProvider)
name: "PendingInvoices", {
columns: table => new return activeProvider != "Microsoft.EntityFrameworkCore.Sqlite";
{ }
Id = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PendingInvoices", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PendingInvoices"); name: "PendingInvoices");
migrationBuilder.AddColumn<string>( migrationBuilder.AddColumn<string>(
name: "Name", name: "Name",
table: "PairingCodes", table: "PairingCodes",
nullable: true); nullable: true);
migrationBuilder.AddColumn<string>( migrationBuilder.AddColumn<string>(
name: "Name", name: "Name",
table: "PairedSINData", table: "PairedSINData",
nullable: true); nullable: true);
} }
} }
} }