< Summary - Combined Code Coverage

Line coverage
0%
Covered lines: 0
Uncovered lines: 407
Coverable lines: 407
Total lines: 464
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.Postgres/Migrations/20250606153442_Initial.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore.Migrations;
 2
 3#nullable disable
 4
 5namespace NLightning.Infrastructure.Persistence.Postgres.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                    channel_id = table.Column<byte[]>(type: "bytea", nullable: false),
 018                    funding_created_at_block_height = table.Column<long>(type: "bigint", nullable: false),
 019                    funding_tx_id = table.Column<byte[]>(type: "bytea", nullable: false),
 020                    funding_output_index = table.Column<long>(type: "bigint", nullable: false),
 021                    funding_amount_satoshis = table.Column<long>(type: "bigint", nullable: false),
 022                    is_initiator = table.Column<bool>(type: "boolean", nullable: false),
 023                    remote_node_id = table.Column<byte[]>(type: "bytea", nullable: false),
 024                    local_next_htlc_id = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 025                    remote_next_htlc_id = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 026                    local_revocation_number = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 027                    remote_revocation_number = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 028                    last_sent_signature = table.Column<byte[]>(type: "bytea", nullable: true),
 029                    last_received_signature = table.Column<byte[]>(type: "bytea", nullable: true),
 030                    state = table.Column<byte>(type: "smallint", nullable: false),
 031                    version = table.Column<byte>(type: "smallint", nullable: false),
 032                    local_balance_satoshis = table.Column<decimal>(type: "numeric", nullable: false),
 033                    remote_balance_satoshis = table.Column<decimal>(type: "numeric", nullable: false)
 034                },
 035                constraints: table =>
 036                {
 037                    table.PrimaryKey("pk_channels", x => x.channel_id);
 038                });
 39
 040            migrationBuilder.CreateTable(
 041                name: "channel_configs",
 042                columns: table => new
 043                {
 044                    channel_id = table.Column<byte[]>(type: "bytea", nullable: false),
 045                    minimum_depth = table.Column<long>(type: "bigint", nullable: false),
 046                    to_self_delay = table.Column<int>(type: "integer", nullable: false),
 047                    max_accepted_htlcs = table.Column<int>(type: "integer", nullable: false),
 048                    local_dust_limit_amount_sats = table.Column<long>(type: "bigint", nullable: false),
 049                    remote_dust_limit_amount_sats = table.Column<long>(type: "bigint", nullable: false),
 050                    htlc_minimum_msat = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 051                    channel_reserve_amount_sats = table.Column<long>(type: "bigint", nullable: true),
 052                    max_htlc_amount_in_flight = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 053                    fee_rate_per_kw_satoshis = table.Column<long>(type: "bigint", nullable: false),
 054                    option_anchor_outputs = table.Column<bool>(type: "boolean", nullable: false),
 055                    local_upfront_shutdown_script = table.Column<byte[]>(type: "bytea", nullable: true),
 056                    remote_upfront_shutdown_script = table.Column<byte[]>(type: "bytea", nullable: true),
 057                    use_scid_alias = table.Column<byte>(type: "smallint", nullable: false)
 058                },
 059                constraints: table =>
 060                {
 061                    table.PrimaryKey("pk_channel_configs", x => x.channel_id);
 062                    table.ForeignKey(
 063                        name: "fk_channel_configs_channels_channel_id",
 064                        column: x => x.channel_id,
 065                        principalTable: "channels",
 066                        principalColumn: "channel_id",
 067                        onDelete: ReferentialAction.Cascade);
 068                });
 69
 070            migrationBuilder.CreateTable(
 071                name: "channel_key_sets",
 072                columns: table => new
 073                {
 074                    channel_id = table.Column<byte[]>(type: "bytea", nullable: false),
 075                    is_local = table.Column<bool>(type: "boolean", nullable: false),
 076                    funding_pub_key = table.Column<byte[]>(type: "bytea", nullable: false),
 077                    revocation_basepoint = table.Column<byte[]>(type: "bytea", nullable: false),
 078                    payment_basepoint = table.Column<byte[]>(type: "bytea", nullable: false),
 079                    delayed_payment_basepoint = table.Column<byte[]>(type: "bytea", nullable: false),
 080                    htlc_basepoint = table.Column<byte[]>(type: "bytea", nullable: false),
 081                    current_per_commitment_index = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 082                    current_per_commitment_point = table.Column<byte[]>(type: "bytea", nullable: false),
 083                    last_revealed_per_commitment_secret = table.Column<byte[]>(type: "bytea", nullable: true),
 084                    key_index = table.Column<long>(type: "bigint", nullable: false)
 085                },
 086                constraints: table =>
 087                {
 088                    table.PrimaryKey("pk_channel_key_sets", x => new { x.channel_id, x.is_local });
 089                    table.ForeignKey(
 090                        name: "fk_channel_key_sets_channels_channel_id",
 091                        column: x => x.channel_id,
 092                        principalTable: "channels",
 093                        principalColumn: "channel_id",
 094                        onDelete: ReferentialAction.Cascade);
 095                });
 96
 097            migrationBuilder.CreateTable(
 098                name: "htlcs",
 099                columns: table => new
 0100                {
 0101                    channel_id = table.Column<byte[]>(type: "bytea", nullable: false),
 0102                    htlc_id = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 0103                    direction = table.Column<byte>(type: "smallint", nullable: false),
 0104                    amount_msat = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 0105                    payment_hash = table.Column<byte[]>(type: "bytea", nullable: false),
 0106                    payment_preimage = table.Column<byte[]>(type: "bytea", nullable: true),
 0107                    cltv_expiry = table.Column<long>(type: "bigint", nullable: false),
 0108                    state = table.Column<byte>(type: "smallint", nullable: false),
 0109                    obscured_commitment_number = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
 0110                    add_message_bytes = table.Column<byte[]>(type: "bytea", nullable: false),
 0111                    signature = table.Column<byte[]>(type: "bytea", nullable: true)
 0112                },
 0113                constraints: table =>
 0114                {
 0115                    table.PrimaryKey("pk_htlcs", x => new { x.channel_id, x.htlc_id, x.direction });
 0116                    table.ForeignKey(
 0117                        name: "fk_htlcs_channels_channel_id",
 0118                        column: x => x.channel_id,
 0119                        principalTable: "channels",
 0120                        principalColumn: "channel_id",
 0121                        onDelete: ReferentialAction.Cascade);
 0122                });
 0123        }
 124
 125        /// <inheritdoc />
 126        protected override void Down(MigrationBuilder migrationBuilder)
 127        {
 0128            migrationBuilder.DropTable(
 0129                name: "channel_configs");
 130
 0131            migrationBuilder.DropTable(
 0132                name: "channel_key_sets");
 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.Postgres/Migrations/20250606153442_Initial.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;
 8using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
 9
 10#nullable disable
 11
 12namespace NLightning.Infrastructure.Persistence.Postgres.Migrations
 13{
 14    [DbContext(typeof(NLightningDbContext))]
 15    [Migration("20250606153442_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", 63);
 25
 026            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
 27
 028            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelConfigEntity", b =>
 029                {
 030                    b.Property<byte[]>("ChannelId")
 031                        .HasColumnType("bytea")
 032                        .HasColumnName("channel_id");
 033
 034                    b.Property<long?>("ChannelReserveAmountSats")
 035                        .HasColumnType("bigint")
 036                        .HasColumnName("channel_reserve_amount_sats");
 037
 038                    b.Property<long>("FeeRatePerKwSatoshis")
 039                        .HasColumnType("bigint")
 040                        .HasColumnName("fee_rate_per_kw_satoshis");
 041
 042                    b.Property<decimal>("HtlcMinimumMsat")
 043                        .HasColumnType("numeric(20,0)")
 044                        .HasColumnName("htlc_minimum_msat");
 045
 046                    b.Property<long>("LocalDustLimitAmountSats")
 047                        .HasColumnType("bigint")
 048                        .HasColumnName("local_dust_limit_amount_sats");
 049
 050                    b.Property<byte[]>("LocalUpfrontShutdownScript")
 051                        .HasColumnType("bytea")
 052                        .HasColumnName("local_upfront_shutdown_script");
 053
 054                    b.Property<int>("MaxAcceptedHtlcs")
 055                        .HasColumnType("integer")
 056                        .HasColumnName("max_accepted_htlcs");
 057
 058                    b.Property<decimal>("MaxHtlcAmountInFlight")
 059                        .HasColumnType("numeric(20,0)")
 060                        .HasColumnName("max_htlc_amount_in_flight");
 061
 062                    b.Property<long>("MinimumDepth")
 063                        .HasColumnType("bigint")
 064                        .HasColumnName("minimum_depth");
 065
 066                    b.Property<bool>("OptionAnchorOutputs")
 067                        .HasColumnType("boolean")
 068                        .HasColumnName("option_anchor_outputs");
 069
 070                    b.Property<long>("RemoteDustLimitAmountSats")
 071                        .HasColumnType("bigint")
 072                        .HasColumnName("remote_dust_limit_amount_sats");
 073
 074                    b.Property<byte[]>("RemoteUpfrontShutdownScript")
 075                        .HasColumnType("bytea")
 076                        .HasColumnName("remote_upfront_shutdown_script");
 077
 078                    b.Property<int>("ToSelfDelay")
 079                        .HasColumnType("integer")
 080                        .HasColumnName("to_self_delay");
 081
 082                    b.Property<byte>("UseScidAlias")
 083                        .HasColumnType("smallint")
 084                        .HasColumnName("use_scid_alias");
 085
 086                    b.HasKey("ChannelId")
 087                        .HasName("pk_channel_configs");
 088
 089                    b.ToTable("channel_configs", (string)null);
 090                });
 91
 092            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", b =>
 093                {
 094                    b.Property<byte[]>("ChannelId")
 095                        .HasColumnType("bytea")
 096                        .HasColumnName("channel_id");
 097
 098                    b.Property<long>("FundingAmountSatoshis")
 099                        .HasColumnType("bigint")
 0100                        .HasColumnName("funding_amount_satoshis");
 0101
 0102                    b.Property<long>("FundingCreatedAtBlockHeight")
 0103                        .HasColumnType("bigint")
 0104                        .HasColumnName("funding_created_at_block_height");
 0105
 0106                    b.Property<long>("FundingOutputIndex")
 0107                        .HasColumnType("bigint")
 0108                        .HasColumnName("funding_output_index");
 0109
 0110                    b.Property<byte[]>("FundingTxId")
 0111                        .IsRequired()
 0112                        .HasColumnType("bytea")
 0113                        .HasColumnName("funding_tx_id");
 0114
 0115                    b.Property<bool>("IsInitiator")
 0116                        .HasColumnType("boolean")
 0117                        .HasColumnName("is_initiator");
 0118
 0119                    b.Property<byte[]>("LastReceivedSignature")
 0120                        .HasColumnType("bytea")
 0121                        .HasColumnName("last_received_signature");
 0122
 0123                    b.Property<byte[]>("LastSentSignature")
 0124                        .HasColumnType("bytea")
 0125                        .HasColumnName("last_sent_signature");
 0126
 0127                    b.Property<decimal>("LocalBalanceSatoshis")
 0128                        .HasColumnType("numeric")
 0129                        .HasColumnName("local_balance_satoshis");
 0130
 0131                    b.Property<decimal>("LocalNextHtlcId")
 0132                        .HasColumnType("numeric(20,0)")
 0133                        .HasColumnName("local_next_htlc_id");
 0134
 0135                    b.Property<decimal>("LocalRevocationNumber")
 0136                        .HasColumnType("numeric(20,0)")
 0137                        .HasColumnName("local_revocation_number");
 0138
 0139                    b.Property<decimal>("RemoteBalanceSatoshis")
 0140                        .HasColumnType("numeric")
 0141                        .HasColumnName("remote_balance_satoshis");
 0142
 0143                    b.Property<decimal>("RemoteNextHtlcId")
 0144                        .HasColumnType("numeric(20,0)")
 0145                        .HasColumnName("remote_next_htlc_id");
 0146
 0147                    b.Property<byte[]>("RemoteNodeId")
 0148                        .IsRequired()
 0149                        .HasColumnType("bytea")
 0150                        .HasColumnName("remote_node_id");
 0151
 0152                    b.Property<decimal>("RemoteRevocationNumber")
 0153                        .HasColumnType("numeric(20,0)")
 0154                        .HasColumnName("remote_revocation_number");
 0155
 0156                    b.Property<byte>("State")
 0157                        .HasColumnType("smallint")
 0158                        .HasColumnName("state");
 0159
 0160                    b.Property<byte>("Version")
 0161                        .HasColumnType("smallint")
 0162                        .HasColumnName("version");
 0163
 0164                    b.HasKey("ChannelId")
 0165                        .HasName("pk_channels");
 0166
 0167                    b.ToTable("channels", (string)null);
 0168                });
 169
 0170            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelKeySetEntity", b =>
 0171                {
 0172                    b.Property<byte[]>("ChannelId")
 0173                        .HasColumnType("bytea")
 0174                        .HasColumnName("channel_id");
 0175
 0176                    b.Property<bool>("IsLocal")
 0177                        .HasColumnType("boolean")
 0178                        .HasColumnName("is_local");
 0179
 0180                    b.Property<decimal>("CurrentPerCommitmentIndex")
 0181                        .HasColumnType("numeric(20,0)")
 0182                        .HasColumnName("current_per_commitment_index");
 0183
 0184                    b.Property<byte[]>("CurrentPerCommitmentPoint")
 0185                        .IsRequired()
 0186                        .HasColumnType("bytea")
 0187                        .HasColumnName("current_per_commitment_point");
 0188
 0189                    b.Property<byte[]>("DelayedPaymentBasepoint")
 0190                        .IsRequired()
 0191                        .HasColumnType("bytea")
 0192                        .HasColumnName("delayed_payment_basepoint");
 0193
 0194                    b.Property<byte[]>("FundingPubKey")
 0195                        .IsRequired()
 0196                        .HasColumnType("bytea")
 0197                        .HasColumnName("funding_pub_key");
 0198
 0199                    b.Property<byte[]>("HtlcBasepoint")
 0200                        .IsRequired()
 0201                        .HasColumnType("bytea")
 0202                        .HasColumnName("htlc_basepoint");
 0203
 0204                    b.Property<long>("KeyIndex")
 0205                        .HasColumnType("bigint")
 0206                        .HasColumnName("key_index");
 0207
 0208                    b.Property<byte[]>("LastRevealedPerCommitmentSecret")
 0209                        .HasColumnType("bytea")
 0210                        .HasColumnName("last_revealed_per_commitment_secret");
 0211
 0212                    b.Property<byte[]>("PaymentBasepoint")
 0213                        .IsRequired()
 0214                        .HasColumnType("bytea")
 0215                        .HasColumnName("payment_basepoint");
 0216
 0217                    b.Property<byte[]>("RevocationBasepoint")
 0218                        .IsRequired()
 0219                        .HasColumnType("bytea")
 0220                        .HasColumnName("revocation_basepoint");
 0221
 0222                    b.HasKey("ChannelId", "IsLocal")
 0223                        .HasName("pk_channel_key_sets");
 0224
 0225                    b.ToTable("channel_key_sets", (string)null);
 0226                });
 227
 0228            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.HtlcEntity", b =>
 0229                {
 0230                    b.Property<byte[]>("ChannelId")
 0231                        .HasColumnType("bytea")
 0232                        .HasColumnName("channel_id");
 0233
 0234                    b.Property<decimal>("HtlcId")
 0235                        .HasColumnType("numeric(20,0)")
 0236                        .HasColumnName("htlc_id");
 0237
 0238                    b.Property<byte>("Direction")
 0239                        .HasColumnType("smallint")
 0240                        .HasColumnName("direction");
 0241
 0242                    b.Property<byte[]>("AddMessageBytes")
 0243                        .IsRequired()
 0244                        .HasColumnType("bytea")
 0245                        .HasColumnName("add_message_bytes");
 0246
 0247                    b.Property<decimal>("AmountMsat")
 0248                        .HasColumnType("numeric(20,0)")
 0249                        .HasColumnName("amount_msat");
 0250
 0251                    b.Property<long>("CltvExpiry")
 0252                        .HasColumnType("bigint")
 0253                        .HasColumnName("cltv_expiry");
 0254
 0255                    b.Property<decimal>("ObscuredCommitmentNumber")
 0256                        .HasColumnType("numeric(20,0)")
 0257                        .HasColumnName("obscured_commitment_number");
 0258
 0259                    b.Property<byte[]>("PaymentHash")
 0260                        .IsRequired()
 0261                        .HasColumnType("bytea")
 0262                        .HasColumnName("payment_hash");
 0263
 0264                    b.Property<byte[]>("PaymentPreimage")
 0265                        .HasColumnType("bytea")
 0266                        .HasColumnName("payment_preimage");
 0267
 0268                    b.Property<byte[]>("Signature")
 0269                        .HasColumnType("bytea")
 0270                        .HasColumnName("signature");
 0271
 0272                    b.Property<byte>("State")
 0273                        .HasColumnType("smallint")
 0274                        .HasColumnName("state");
 0275
 0276                    b.HasKey("ChannelId", "HtlcId", "Direction")
 0277                        .HasName("pk_htlcs");
 0278
 0279                    b.ToTable("htlcs", (string)null);
 0280                });
 281
 0282            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelConfigEntity", b =>
 0283                {
 0284                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", null)
 0285                        .WithOne("Config")
 0286                        .HasForeignKey("NLightning.Infrastructure.Persistence.Entities.ChannelConfigEntity", "ChannelId"
 0287                        .OnDelete(DeleteBehavior.Cascade)
 0288                        .IsRequired()
 0289                        .HasConstraintName("fk_channel_configs_channels_channel_id");
 0290                });
 291
 0292            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelKeySetEntity", b =>
 0293                {
 0294                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", null)
 0295                        .WithMany("KeySets")
 0296                        .HasForeignKey("ChannelId")
 0297                        .OnDelete(DeleteBehavior.Cascade)
 0298                        .IsRequired()
 0299                        .HasConstraintName("fk_channel_key_sets_channels_channel_id");
 0300                });
 301
 0302            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.HtlcEntity", b =>
 0303                {
 0304                    b.HasOne("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", null)
 0305                        .WithMany("Htlcs")
 0306                        .HasForeignKey("ChannelId")
 0307                        .OnDelete(DeleteBehavior.Cascade)
 0308                        .IsRequired()
 0309                        .HasConstraintName("fk_htlcs_channels_channel_id");
 0310                });
 311
 0312            modelBuilder.Entity("NLightning.Infrastructure.Persistence.Entities.ChannelEntity", b =>
 0313                {
 0314                    b.Navigation("Config");
 0315
 0316                    b.Navigation("Htlcs");
 0317
 0318                    b.Navigation("KeySets");
 0319                });
 320#pragma warning restore 612, 618
 0321        }
 322    }
 323}