< Summary - Combined Code Coverage

Line coverage
0%
Covered lines: 0
Uncovered lines: 407
Coverable lines: 407
Total lines: 475
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.Sqlite/Migrations/20250612173134_AddBlockchaisStateAndWatchedTransaction.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore.Migrations;
 2
 3#nullable disable
 4
 5namespace NLightning.Infrastructure.Persistence.Sqlite.Migrations
 6{
 7    /// <inheritdoc />
 8    public partial class AddBlockchaisStateAndWatchedTransaction : Migration
 9    {
 10        /// <inheritdoc />
 11        protected override void Up(MigrationBuilder migrationBuilder)
 12        {
 013            migrationBuilder.AddColumn<byte[]>(
 014                name: "PeerEntityNodeId",
 015                table: "Channels",
 016                type: "BLOB",
 017                nullable: true);
 18
 019            migrationBuilder.CreateTable(
 020                name: "BlockchainStates",
 021                columns: table => new
 022                {
 023                    Id = table.Column<Guid>(type: "TEXT", nullable: false),
 024                    LastProcessedHeight = table.Column<uint>(type: "INTEGER", nullable: false),
 025                    LastProcessedBlockHash = table.Column<byte[]>(type: "BLOB", nullable: false),
 026                    LastProcessedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
 027                },
 028                constraints: table =>
 029                {
 030                    table.PrimaryKey("PK_BlockchainStates", x => x.Id);
 031                });
 32
 033            migrationBuilder.CreateTable(
 034                name: "Peers",
 035                columns: table => new
 036                {
 037                    NodeId = table.Column<byte[]>(type: "BLOB", nullable: false),
 038                    Host = table.Column<string>(type: "TEXT", nullable: false),
 039                    Port = table.Column<uint>(type: "INTEGER", nullable: false),
 040                    LastSeenAt = table.Column<DateTime>(type: "TEXT", nullable: false)
 041                },
 042                constraints: table =>
 043                {
 044                    table.PrimaryKey("PK_Peers", x => x.NodeId);
 045                });
 46
 047            migrationBuilder.CreateTable(
 048                name: "WatchedTransactions",
 049                columns: table => new
 050                {
 051                    TransactionId = table.Column<byte[]>(type: "BLOB", nullable: false),
 052                    ChannelId = table.Column<byte[]>(type: "BLOB", nullable: false),
 053                    RequiredDepth = table.Column<uint>(type: "INTEGER", nullable: false),
 054                    FirstSeenAtHeight = table.Column<uint>(type: "INTEGER", nullable: true),
 055                    TransactionIndex = table.Column<ushort>(type: "INTEGER", nullable: true),
 056                    CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
 057                    CompletedAt = table.Column<DateTime>(type: "TEXT", nullable: true)
 058                },
 059                constraints: table =>
 060                {
 061                    table.PrimaryKey("PK_WatchedTransactions", x => x.TransactionId);
 062                    table.ForeignKey(
 063                        name: "FK_WatchedTransactions_Channels_ChannelId",
 064                        column: x => x.ChannelId,
 065                        principalTable: "Channels",
 066                        principalColumn: "ChannelId",
 067                        onDelete: ReferentialAction.Cascade);
 068                });
 69
 070            migrationBuilder.CreateIndex(
 071                name: "IX_Channels_PeerEntityNodeId",
 072                table: "Channels",
 073                column: "PeerEntityNodeId");
 74
 075            migrationBuilder.CreateIndex(
 076                name: "IX_WatchedTransactions_ChannelId",
 077                table: "WatchedTransactions",
 078                column: "ChannelId");
 79
 080            migrationBuilder.Sql("PRAGMA foreign_keys = 0;", suppressTransaction: true);
 81
 082            migrationBuilder.AddForeignKey(
 083                name: "FK_Channels_Peers_PeerEntityNodeId",
 084                table: "Channels",
 085                column: "PeerEntityNodeId",
 086                principalTable: "Peers",
 087                principalColumn: "NodeId");
 88
 089            migrationBuilder.Sql("PRAGMA foreign_keys = 1;", suppressTransaction: true);
 090        }
 91
 92        /// <inheritdoc />
 93        protected override void Down(MigrationBuilder migrationBuilder)
 94        {
 095            migrationBuilder.DropForeignKey(
 096                name: "FK_Channels_Peers_PeerEntityNodeId",
 097                table: "Channels");
 98
 099            migrationBuilder.DropTable(
 0100                name: "BlockchainStates");
 101
 0102            migrationBuilder.DropTable(
 0103                name: "Peers");
 104
 0105            migrationBuilder.DropTable(
 0106                name: "WatchedTransactions");
 107
 0108            migrationBuilder.DropIndex(
 0109                name: "IX_Channels_PeerEntityNodeId",
 0110                table: "Channels");
 111
 0112            migrationBuilder.DropColumn(
 0113                name: "PeerEntityNodeId",
 0114                table: "Channels");
 0115        }
 116    }
 117}

/home/runner/work/NLightning/NLightning/src/NLightning.Infrastructure.Persistence.Sqlite/Migrations/20250612173134_AddBlockchaisStateAndWatchedTransaction.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using System;
 3using Microsoft.EntityFrameworkCore;
 4using Microsoft.EntityFrameworkCore.Infrastructure;
 5using Microsoft.EntityFrameworkCore.Migrations;
 6using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 7using NLightning.Infrastructure.Persistence.Contexts;
 8
 9#nullable disable
 10
 11namespace NLightning.Infrastructure.Persistence.Sqlite.Migrations
 12{
 13    [DbContext(typeof(NLightningDbContext))]
 14    [Migration("20250612173134_AddBlockchaisStateAndWatchedTransaction")]
 15    partial class AddBlockchaisStateAndWatchedTransaction
 16    {
 17        /// <inheritdoc />
 18        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 19        {
 20#pragma warning disable 612, 618
 021            modelBuilder.HasAnnotation("ProductVersion", "8.0.12");
 22
 023            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Bitcoin.BlockchainStateEntity", b =>
 024                {
 025                    b.Property<Guid>("Id")
 026                        .ValueGeneratedOnAdd()
 027                        .HasColumnType("TEXT");
 028
 029                    b.Property<DateTime>("LastProcessedAt")
 030                        .HasColumnType("TEXT");
 031
 032                    b.Property<byte[]>("LastProcessedBlockHash")
 033                        .IsRequired()
 034                        .HasColumnType("BLOB");
 035
 036                    b.Property<uint>("LastProcessedHeight")
 037                        .HasColumnType("INTEGER");
 038
 039                    b.HasKey("Id");
 040
 041                    b.ToTable("BlockchainStates");
 042                });
 43
 044            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Bitcoin.WatchedTransactionEntity", b =>
 045                {
 046                    b.Property<byte[]>("TransactionId")
 047                        .HasColumnType("BLOB");
 048
 049                    b.Property<byte[]>("ChannelId")
 050                        .IsRequired()
 051                        .HasColumnType("BLOB");
 052
 053                    b.Property<DateTime?>("CompletedAt")
 054                        .HasColumnType("TEXT");
 055
 056                    b.Property<DateTime>("CreatedAt")
 057                        .HasColumnType("TEXT");
 058
 059                    b.Property<uint?>("FirstSeenAtHeight")
 060                        .HasColumnType("INTEGER");
 061
 062                    b.Property<uint>("RequiredDepth")
 063                        .HasColumnType("INTEGER");
 064
 065                    b.Property<ushort?>("TransactionIndex")
 066                        .HasColumnType("INTEGER");
 067
 068                    b.HasKey("TransactionId");
 069
 070                    b.HasIndex("ChannelId");
 071
 072                    b.ToTable("WatchedTransactions");
 073                });
 74
 075            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelConfigEntity", b =>
 076                {
 077                    b.Property<byte[]>("ChannelId")
 078                        .HasColumnType("BLOB");
 079
 080                    b.Property<long?>("ChannelReserveAmountSats")
 081                        .HasColumnType("INTEGER");
 082
 083                    b.Property<long>("FeeRatePerKwSatoshis")
 084                        .HasColumnType("INTEGER");
 085
 086                    b.Property<ulong>("HtlcMinimumMsat")
 087                        .HasColumnType("INTEGER");
 088
 089                    b.Property<long>("LocalDustLimitAmountSats")
 090                        .HasColumnType("INTEGER");
 091
 092                    b.Property<byte[]>("LocalUpfrontShutdownScript")
 093                        .HasColumnType("BLOB");
 094
 095                    b.Property<ushort>("MaxAcceptedHtlcs")
 096                        .HasColumnType("INTEGER");
 097
 098                    b.Property<ulong>("MaxHtlcAmountInFlight")
 099                        .HasColumnType("INTEGER");
 0100
 0101                    b.Property<uint>("MinimumDepth")
 0102                        .HasColumnType("INTEGER");
 0103
 0104                    b.Property<bool>("OptionAnchorOutputs")
 0105                        .HasColumnType("INTEGER");
 0106
 0107                    b.Property<long>("RemoteDustLimitAmountSats")
 0108                        .HasColumnType("INTEGER");
 0109
 0110                    b.Property<byte[]>("RemoteUpfrontShutdownScript")
 0111                        .HasColumnType("BLOB");
 0112
 0113                    b.Property<ushort>("ToSelfDelay")
 0114                        .HasColumnType("INTEGER");
 0115
 0116                    b.Property<byte>("UseScidAlias")
 0117                        .HasColumnType("INTEGER");
 0118
 0119                    b.HasKey("ChannelId");
 0120
 0121                    b.ToTable("ChannelConfigs");
 0122                });
 123
 0124            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelEntity", b =>
 0125                {
 0126                    b.Property<byte[]>("ChannelId")
 0127                        .HasColumnType("BLOB");
 0128
 0129                    b.Property<long>("FundingAmountSatoshis")
 0130                        .HasColumnType("INTEGER");
 0131
 0132                    b.Property<uint>("FundingCreatedAtBlockHeight")
 0133                        .HasColumnType("INTEGER");
 0134
 0135                    b.Property<ushort>("FundingOutputIndex")
 0136                        .HasColumnType("INTEGER");
 0137
 0138                    b.Property<byte[]>("FundingTxId")
 0139                        .IsRequired()
 0140                        .HasColumnType("BLOB");
 0141
 0142                    b.Property<bool>("IsInitiator")
 0143                        .HasColumnType("INTEGER");
 0144
 0145                    b.Property<byte[]>("LastReceivedSignature")
 0146                        .HasColumnType("BLOB");
 0147
 0148                    b.Property<byte[]>("LastSentSignature")
 0149                        .HasColumnType("BLOB");
 0150
 0151                    b.Property<decimal>("LocalBalanceSatoshis")
 0152                        .HasColumnType("TEXT");
 0153
 0154                    b.Property<ulong>("LocalNextHtlcId")
 0155                        .HasColumnType("INTEGER");
 0156
 0157                    b.Property<ulong>("LocalRevocationNumber")
 0158                        .HasColumnType("INTEGER");
 0159
 0160                    b.Property<byte[]>("PeerEntityNodeId")
 0161                        .HasColumnType("BLOB");
 0162
 0163                    b.Property<decimal>("RemoteBalanceSatoshis")
 0164                        .HasColumnType("TEXT");
 0165
 0166                    b.Property<ulong>("RemoteNextHtlcId")
 0167                        .HasColumnType("INTEGER");
 0168
 0169                    b.Property<byte[]>("RemoteNodeId")
 0170                        .IsRequired()
 0171                        .HasColumnType("BLOB");
 0172
 0173                    b.Property<ulong>("RemoteRevocationNumber")
 0174                        .HasColumnType("INTEGER");
 0175
 0176                    b.Property<byte>("State")
 0177                        .HasColumnType("INTEGER");
 0178
 0179                    b.Property<byte>("Version")
 0180                        .HasColumnType("INTEGER");
 0181
 0182                    b.HasKey("ChannelId");
 0183
 0184                    b.HasIndex("PeerEntityNodeId");
 0185
 0186                    b.ToTable("Channels");
 0187                });
 188
 0189            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelKeySetEntity", b =>
 0190                {
 0191                    b.Property<byte[]>("ChannelId")
 0192                        .HasColumnType("BLOB");
 0193
 0194                    b.Property<bool>("IsLocal")
 0195                        .HasColumnType("INTEGER");
 0196
 0197                    b.Property<ulong>("CurrentPerCommitmentIndex")
 0198                        .HasColumnType("INTEGER");
 0199
 0200                    b.Property<byte[]>("CurrentPerCommitmentPoint")
 0201                        .IsRequired()
 0202                        .HasColumnType("BLOB");
 0203
 0204                    b.Property<byte[]>("DelayedPaymentBasepoint")
 0205                        .IsRequired()
 0206                        .HasColumnType("BLOB");
 0207
 0208                    b.Property<byte[]>("FundingPubKey")
 0209                        .IsRequired()
 0210                        .HasColumnType("BLOB");
 0211
 0212                    b.Property<byte[]>("HtlcBasepoint")
 0213                        .IsRequired()
 0214                        .HasColumnType("BLOB");
 0215
 0216                    b.Property<uint>("KeyIndex")
 0217                        .HasColumnType("INTEGER");
 0218
 0219                    b.Property<byte[]>("LastRevealedPerCommitmentSecret")
 0220                        .HasColumnType("BLOB");
 0221
 0222                    b.Property<byte[]>("PaymentBasepoint")
 0223                        .IsRequired()
 0224                        .HasColumnType("BLOB");
 0225
 0226                    b.Property<byte[]>("RevocationBasepoint")
 0227                        .IsRequired()
 0228                        .HasColumnType("BLOB");
 0229
 0230                    b.HasKey("ChannelId", "IsLocal");
 0231
 0232                    b.ToTable("ChannelKeySets");
 0233                });
 234
 0235            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.HtlcEntity", b =>
 0236                {
 0237                    b.Property<byte[]>("ChannelId")
 0238                        .HasColumnType("BLOB");
 0239
 0240                    b.Property<ulong>("HtlcId")
 0241                        .HasColumnType("INTEGER");
 0242
 0243                    b.Property<byte>("Direction")
 0244                        .HasColumnType("INTEGER");
 0245
 0246                    b.Property<byte[]>("AddMessageBytes")
 0247                        .IsRequired()
 0248                        .HasColumnType("BLOB");
 0249
 0250                    b.Property<ulong>("AmountMsat")
 0251                        .HasColumnType("INTEGER");
 0252
 0253                    b.Property<uint>("CltvExpiry")
 0254                        .HasColumnType("INTEGER");
 0255
 0256                    b.Property<ulong>("ObscuredCommitmentNumber")
 0257                        .HasColumnType("INTEGER");
 0258
 0259                    b.Property<byte[]>("PaymentHash")
 0260                        .IsRequired()
 0261                        .HasColumnType("BLOB");
 0262
 0263                    b.Property<byte[]>("PaymentPreimage")
 0264                        .HasColumnType("BLOB");
 0265
 0266                    b.Property<byte[]>("Signature")
 0267                        .HasColumnType("BLOB");
 0268
 0269                    b.Property<byte>("State")
 0270                        .HasColumnType("INTEGER");
 0271
 0272                    b.HasKey("ChannelId", "HtlcId", "Direction");
 0273
 0274                    b.ToTable("Htlcs");
 0275                });
 276
 0277            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Node.PeerEntity", b =>
 0278                {
 0279                    b.Property<byte[]>("NodeId")
 0280                        .HasColumnType("BLOB");
 0281
 0282                    b.Property<string>("Host")
 0283                        .IsRequired()
 0284                        .HasColumnType("TEXT");
 0285
 0286                    b.Property<DateTime>("LastSeenAt")
 0287                        .HasColumnType("TEXT");
 0288
 0289                    b.Property<uint>("Port")
 0290                        .HasColumnType("INTEGER");
 0291
 0292                    b.HasKey("NodeId");
 0293
 0294                    b.ToTable("Peers");
 0295                });
 296
 0297            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Bitcoin.WatchedTransactionEntity", b =>
 0298                {
 0299                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelEntity", null)
 0300                        .WithMany("WatchedTransactions")
 0301                        .HasForeignKey("ChannelId")
 0302                        .OnDelete(DeleteBehavior.Cascade)
 0303                        .IsRequired();
 0304                });
 305
 0306            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelConfigEntity", b =>
 0307                {
 0308                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelEntity", null)
 0309                        .WithOne("Config")
 0310                        .HasForeignKey("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelConfigEntity", "Ch
 0311                        .OnDelete(DeleteBehavior.Cascade)
 0312                        .IsRequired();
 0313                });
 314
 0315            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelEntity", b =>
 0316                {
 0317                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.Node.PeerEntity", null)
 0318                        .WithMany("Channels")
 0319                        .HasForeignKey("PeerEntityNodeId");
 0320                });
 321
 0322            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelKeySetEntity", b =>
 0323                {
 0324                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelEntity", null)
 0325                        .WithMany("KeySets")
 0326                        .HasForeignKey("ChannelId")
 0327                        .OnDelete(DeleteBehavior.Cascade)
 0328                        .IsRequired();
 0329                });
 330
 0331            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.HtlcEntity", b =>
 0332                {
 0333                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelEntity", null)
 0334                        .WithMany("Htlcs")
 0335                        .HasForeignKey("ChannelId")
 0336                        .OnDelete(DeleteBehavior.Cascade)
 0337                        .IsRequired();
 0338                });
 339
 0340            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Channel.ChannelEntity", b =>
 0341                {
 0342                    b.Navigation("Config");
 0343
 0344                    b.Navigation("Htlcs");
 0345
 0346                    b.Navigation("KeySets");
 0347
 0348                    b.Navigation("WatchedTransactions");
 0349                });
 350
 0351            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.Node.PeerEntity", b =>
 0352                {
 0353                    b.Navigation("Channels");
 0354                });
 355#pragma warning restore 612, 618
 0356        }
 357    }
 358}