< Summary - Combined Code Coverage

Line coverage
0%
Covered lines: 0
Uncovered lines: 347
Coverable lines: 347
Total lines: 404
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: Up(...)100%210%
File 1: Down(...)100%210%
File 2: BuildTargetModel(...)100%210%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Persistence.SqlServer/Migrations/20250606153446_Initial.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore.Migrations;
 2
 3#nullable disable
 4
 5namespace NLightning.Infrastructure.Persistence.SqlServer.Migrations
 6{
 7    /// <inheritdoc />
 8    public partial class Initial : Migration
 9    {
 10        /// <inheritdoc />
 11        protected override void Up(MigrationBuilder migrationBuilder)
 12        {
 013            migrationBuilder.CreateTable(
 014                name: "Channels",
 015                columns: table => new
 016                {
 017                    ChannelId = table.Column<byte[]>(type: "varbinary(32)", nullable: false),
 018                    FundingCreatedAtBlockHeight = table.Column<long>(type: "bigint", nullable: false),
 019                    FundingTxId = table.Column<byte[]>(type: "varbinary(32)", nullable: false),
 020                    FundingOutputIndex = table.Column<long>(type: "bigint", nullable: false),
 021                    FundingAmountSatoshis = table.Column<long>(type: "bigint", nullable: false),
 022                    IsInitiator = table.Column<bool>(type: "bit", nullable: false),
 023                    RemoteNodeId = table.Column<byte[]>(type: "varbinary(32)", nullable: false),
 024                    LocalNextHtlcId = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 025                    RemoteNextHtlcId = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 026                    LocalRevocationNumber = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 027                    RemoteRevocationNumber = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 028                    LastSentSignature = table.Column<byte[]>(type: "varbinary(64)", nullable: true),
 029                    LastReceivedSignature = table.Column<byte[]>(type: "varbinary(64)", nullable: true),
 030                    State = table.Column<byte>(type: "tinyint", nullable: false),
 031                    Version = table.Column<byte>(type: "tinyint", nullable: false),
 032                    LocalBalanceSatoshis = table.Column<long>(type: "bigint", nullable: false),
 033                    RemoteBalanceSatoshis = table.Column<long>(type: "bigint", nullable: false)
 034                },
 035                constraints: table =>
 036                {
 037                    table.PrimaryKey("PK_Channels", x => x.ChannelId);
 038                });
 39
 040            migrationBuilder.CreateTable(
 041                name: "ChannelConfigs",
 042                columns: table => new
 043                {
 044                    ChannelId = table.Column<byte[]>(type: "varbinary(32)", nullable: false),
 045                    MinimumDepth = table.Column<long>(type: "bigint", nullable: false),
 046                    ToSelfDelay = table.Column<int>(type: "int", nullable: false),
 047                    MaxAcceptedHtlcs = table.Column<int>(type: "int", nullable: false),
 048                    LocalDustLimitAmountSats = table.Column<long>(type: "bigint", nullable: false),
 049                    RemoteDustLimitAmountSats = table.Column<long>(type: "bigint", nullable: false),
 050                    HtlcMinimumMsat = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 051                    ChannelReserveAmountSats = table.Column<long>(type: "bigint", nullable: true),
 052                    MaxHtlcAmountInFlight = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 053                    FeeRatePerKwSatoshis = table.Column<long>(type: "bigint", nullable: false),
 054                    OptionAnchorOutputs = table.Column<bool>(type: "bit", nullable: false),
 055                    LocalUpfrontShutdownScript = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
 056                    RemoteUpfrontShutdownScript = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
 057                    UseScidAlias = table.Column<byte>(type: "tinyint", nullable: false)
 058                },
 059                constraints: table =>
 060                {
 061                    table.PrimaryKey("PK_ChannelConfigs", x => x.ChannelId);
 062                    table.ForeignKey(
 063                        name: "FK_ChannelConfigs_Channels_ChannelId",
 064                        column: x => x.ChannelId,
 065                        principalTable: "Channels",
 066                        principalColumn: "ChannelId",
 067                        onDelete: ReferentialAction.Cascade);
 068                });
 69
 070            migrationBuilder.CreateTable(
 071                name: "ChannelKeySets",
 072                columns: table => new
 073                {
 074                    ChannelId = table.Column<byte[]>(type: "varbinary(32)", nullable: false),
 075                    IsLocal = table.Column<bool>(type: "bit", nullable: false),
 076                    FundingPubKey = table.Column<byte[]>(type: "varbinary(33)", nullable: false),
 077                    RevocationBasepoint = table.Column<byte[]>(type: "varbinary(33)", nullable: false),
 078                    PaymentBasepoint = table.Column<byte[]>(type: "varbinary(33)", nullable: false),
 079                    DelayedPaymentBasepoint = table.Column<byte[]>(type: "varbinary(33)", nullable: false),
 080                    HtlcBasepoint = table.Column<byte[]>(type: "varbinary(33)", nullable: false),
 081                    CurrentPerCommitmentIndex = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 082                    CurrentPerCommitmentPoint = table.Column<byte[]>(type: "varbinary(33)", nullable: false),
 083                    LastRevealedPerCommitmentSecret = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
 084                    KeyIndex = table.Column<long>(type: "bigint", nullable: false)
 085                },
 086                constraints: table =>
 087                {
 088                    table.PrimaryKey("PK_ChannelKeySets", x => new { x.ChannelId, x.IsLocal });
 089                    table.ForeignKey(
 090                        name: "FK_ChannelKeySets_Channels_ChannelId",
 091                        column: x => x.ChannelId,
 092                        principalTable: "Channels",
 093                        principalColumn: "ChannelId",
 094                        onDelete: ReferentialAction.Cascade);
 095                });
 96
 097            migrationBuilder.CreateTable(
 098                name: "Htlcs",
 099                columns: table => new
 0100                {
 0101                    ChannelId = table.Column<byte[]>(type: "varbinary(32)", nullable: false),
 0102                    HtlcId = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 0103                    Direction = table.Column<byte>(type: "tinyint", nullable: false),
 0104                    AmountMsat = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 0105                    PaymentHash = table.Column<byte[]>(type: "varbinary(32)", nullable: false),
 0106                    PaymentPreimage = table.Column<byte[]>(type: "varbinary(32)", nullable: true),
 0107                    CltvExpiry = table.Column<long>(type: "bigint", nullable: false),
 0108                    State = table.Column<byte>(type: "tinyint", nullable: false),
 0109                    ObscuredCommitmentNumber = table.Column<decimal>(type: "decimal(20,0)", nullable: false),
 0110                    AddMessageBytes = table.Column<byte[]>(type: "varbinary(max)", nullable: false),
 0111                    Signature = table.Column<byte[]>(type: "varbinary(max)", nullable: true)
 0112                },
 0113                constraints: table =>
 0114                {
 0115                    table.PrimaryKey("PK_Htlcs", x => new { x.ChannelId, x.HtlcId, x.Direction });
 0116                    table.ForeignKey(
 0117                        name: "FK_Htlcs_Channels_ChannelId",
 0118                        column: x => x.ChannelId,
 0119                        principalTable: "Channels",
 0120                        principalColumn: "ChannelId",
 0121                        onDelete: ReferentialAction.Cascade);
 0122                });
 0123        }
 124
 125        /// <inheritdoc />
 126        protected override void Down(MigrationBuilder migrationBuilder)
 127        {
 0128            migrationBuilder.DropTable(
 0129                name: "ChannelConfigs");
 130
 0131            migrationBuilder.DropTable(
 0132                name: "ChannelKeySets");
 133
 0134            migrationBuilder.DropTable(
 0135                name: "Htlcs");
 136
 0137            migrationBuilder.DropTable(
 0138                name: "Channels");
 0139        }
 140    }
 141}

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure.Persistence.SqlServer/Migrations/20250606153446_Initial.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using System;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Infrastructure;
 5using Microsoft.EntityFrameworkCore.Metadata;
 6using Microsoft.EntityFrameworkCore.Migrations;
 7using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 8using NLightning.Infrastructure.Persistence.Contexts;
 9
 10#nullable disable
 11
 12namespace NLightning.Infrastructure.Persistence.SqlServer.Migrations
 13{
 14    [DbContext(typeof(NLightningDbContext))]
 15    [Migration("20250606153446_Initial")]
 16    partial class Initial
 17    {
 18        /// <inheritdoc />
 19        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 20        {
 21#pragma warning disable 612, 618
 022            modelBuilder
 023                .HasAnnotation("ProductVersion", "8.0.12")
 024                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 25
 026            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 27
 028            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelConfigEntity", b =>
 029                {
 030                    b.Property<byte[]>("ChannelId")
 031                        .HasColumnType("varbinary(32)");
 032
 033                    b.Property<long?>("ChannelReserveAmountSats")
 034                        .HasColumnType("bigint");
 035
 036                    b.Property<long>("FeeRatePerKwSatoshis")
 037                        .HasColumnType("bigint");
 038
 039                    b.Property<decimal>("HtlcMinimumMsat")
 040                        .HasColumnType("decimal(20,0)");
 041
 042                    b.Property<long>("LocalDustLimitAmountSats")
 043                        .HasColumnType("bigint");
 044
 045                    b.Property<byte[]>("LocalUpfrontShutdownScript")
 046                        .HasColumnType("varbinary(max)");
 047
 048                    b.Property<int>("MaxAcceptedHtlcs")
 049                        .HasColumnType("int");
 050
 051                    b.Property<decimal>("MaxHtlcAmountInFlight")
 052                        .HasColumnType("decimal(20,0)");
 053
 054                    b.Property<long>("MinimumDepth")
 055                        .HasColumnType("bigint");
 056
 057                    b.Property<bool>("OptionAnchorOutputs")
 058                        .HasColumnType("bit");
 059
 060                    b.Property<long>("RemoteDustLimitAmountSats")
 061                        .HasColumnType("bigint");
 062
 063                    b.Property<byte[]>("RemoteUpfrontShutdownScript")
 064                        .HasColumnType("varbinary(max)");
 065
 066                    b.Property<int>("ToSelfDelay")
 067                        .HasColumnType("int");
 068
 069                    b.Property<byte>("UseScidAlias")
 070                        .HasColumnType("tinyint");
 071
 072                    b.HasKey("ChannelId");
 073
 074                    b.ToTable("ChannelConfigs");
 075                });
 76
 077            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", b =>
 078                {
 079                    b.Property<byte[]>("ChannelId")
 080                        .HasColumnType("varbinary(32)");
 081
 082                    b.Property<long>("FundingAmountSatoshis")
 083                        .HasColumnType("bigint");
 084
 085                    b.Property<long>("FundingCreatedAtBlockHeight")
 086                        .HasColumnType("bigint");
 087
 088                    b.Property<long>("FundingOutputIndex")
 089                        .HasColumnType("bigint");
 090
 091                    b.Property<byte[]>("FundingTxId")
 092                        .IsRequired()
 093                        .HasColumnType("varbinary(32)");
 094
 095                    b.Property<bool>("IsInitiator")
 096                        .HasColumnType("bit");
 097
 098                    b.Property<byte[]>("LastReceivedSignature")
 099                        .HasColumnType("varbinary(64)");
 0100
 0101                    b.Property<byte[]>("LastSentSignature")
 0102                        .HasColumnType("varbinary(64)");
 0103
 0104                    b.Property<long>("LocalBalanceSatoshis")
 0105                        .HasColumnType("bigint");
 0106
 0107                    b.Property<decimal>("LocalNextHtlcId")
 0108                        .HasColumnType("decimal(20,0)");
 0109
 0110                    b.Property<decimal>("LocalRevocationNumber")
 0111                        .HasColumnType("decimal(20,0)");
 0112
 0113                    b.Property<long>("RemoteBalanceSatoshis")
 0114                        .HasColumnType("bigint");
 0115
 0116                    b.Property<decimal>("RemoteNextHtlcId")
 0117                        .HasColumnType("decimal(20,0)");
 0118
 0119                    b.Property<byte[]>("RemoteNodeId")
 0120                        .IsRequired()
 0121                        .HasColumnType("varbinary(32)");
 0122
 0123                    b.Property<decimal>("RemoteRevocationNumber")
 0124                        .HasColumnType("decimal(20,0)");
 0125
 0126                    b.Property<byte>("State")
 0127                        .HasColumnType("tinyint");
 0128
 0129                    b.Property<byte>("Version")
 0130                        .HasColumnType("tinyint");
 0131
 0132                    b.HasKey("ChannelId");
 0133
 0134                    b.ToTable("Channels");
 0135                });
 136
 0137            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelKeySetEntity", b =>
 0138                {
 0139                    b.Property<byte[]>("ChannelId")
 0140                        .HasColumnType("varbinary(32)");
 0141
 0142                    b.Property<bool>("IsLocal")
 0143                        .HasColumnType("bit");
 0144
 0145                    b.Property<decimal>("CurrentPerCommitmentIndex")
 0146                        .HasColumnType("decimal(20,0)");
 0147
 0148                    b.Property<byte[]>("CurrentPerCommitmentPoint")
 0149                        .IsRequired()
 0150                        .HasColumnType("varbinary(33)");
 0151
 0152                    b.Property<byte[]>("DelayedPaymentBasepoint")
 0153                        .IsRequired()
 0154                        .HasColumnType("varbinary(33)");
 0155
 0156                    b.Property<byte[]>("FundingPubKey")
 0157                        .IsRequired()
 0158                        .HasColumnType("varbinary(33)");
 0159
 0160                    b.Property<byte[]>("HtlcBasepoint")
 0161                        .IsRequired()
 0162                        .HasColumnType("varbinary(33)");
 0163
 0164                    b.Property<long>("KeyIndex")
 0165                        .HasColumnType("bigint");
 0166
 0167                    b.Property<byte[]>("LastRevealedPerCommitmentSecret")
 0168                        .HasColumnType("varbinary(max)");
 0169
 0170                    b.Property<byte[]>("PaymentBasepoint")
 0171                        .IsRequired()
 0172                        .HasColumnType("varbinary(33)");
 0173
 0174                    b.Property<byte[]>("RevocationBasepoint")
 0175                        .IsRequired()
 0176                        .HasColumnType("varbinary(33)");
 0177
 0178                    b.HasKey("ChannelId", "IsLocal");
 0179
 0180                    b.ToTable("ChannelKeySets");
 0181                });
 182
 0183            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.HtlcEntity", b =>
 0184                {
 0185                    b.Property<byte[]>("ChannelId")
 0186                        .HasColumnType("varbinary(32)");
 0187
 0188                    b.Property<decimal>("HtlcId")
 0189                        .HasColumnType("decimal(20,0)");
 0190
 0191                    b.Property<byte>("Direction")
 0192                        .HasColumnType("tinyint");
 0193
 0194                    b.Property<byte[]>("AddMessageBytes")
 0195                        .IsRequired()
 0196                        .HasColumnType("varbinary(max)");
 0197
 0198                    b.Property<decimal>("AmountMsat")
 0199                        .HasColumnType("decimal(20,0)");
 0200
 0201                    b.Property<long>("CltvExpiry")
 0202                        .HasColumnType("bigint");
 0203
 0204                    b.Property<decimal>("ObscuredCommitmentNumber")
 0205                        .HasColumnType("decimal(20,0)");
 0206
 0207                    b.Property<byte[]>("PaymentHash")
 0208                        .IsRequired()
 0209                        .HasColumnType("varbinary(32)");
 0210
 0211                    b.Property<byte[]>("PaymentPreimage")
 0212                        .HasColumnType("varbinary(32)");
 0213
 0214                    b.Property<byte[]>("Signature")
 0215                        .HasColumnType("varbinary(max)");
 0216
 0217                    b.Property<byte>("State")
 0218                        .HasColumnType("tinyint");
 0219
 0220                    b.HasKey("ChannelId", "HtlcId", "Direction");
 0221
 0222                    b.ToTable("Htlcs");
 0223                });
 224
 0225            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelConfigEntity", b =>
 0226                {
 0227                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", null)
 0228                        .WithOne("Config")
 0229                        .HasForeignKey("NLightning.Infrastructure.Persistence.Entities.ChannelConfigEntity", "ChannelId"
 0230                        .OnDelete(DeleteBehavior.Cascade)
 0231                        .IsRequired();
 0232                });
 233
 0234            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelKeySetEntity", b =>
 0235                {
 0236                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", null)
 0237                        .WithMany("KeySets")
 0238                        .HasForeignKey("ChannelId")
 0239                        .OnDelete(DeleteBehavior.Cascade)
 0240                        .IsRequired();
 0241                });
 242
 0243            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.HtlcEntity", b =>
 0244                {
 0245                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", null)
 0246                        .WithMany("Htlcs")
 0247                        .HasForeignKey("ChannelId")
 0248                        .OnDelete(DeleteBehavior.Cascade)
 0249                        .IsRequired();
 0250                });
 251
 0252            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", b =>
 0253                {
 0254                    b.Navigation("Config");
 0255
 0256                    b.Navigation("Htlcs");
 0257
 0258                    b.Navigation("KeySets");
 0259                });
 260#pragma warning restore 612, 618
 0261        }
 262    }
 263}