diff --git a/CHANGELOG.md b/CHANGELOG.md index ddff77e3b..2b610a9b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.7.1 +Release built: _not released yet_ + +### Database changes +- Added missing index on `validator_cumulative_emission_history` + ## 1.7.0 Release built: _not released yet_ diff --git a/Directory.Build.props b/Directory.Build.props index d33f40923..e0eba4bda 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,7 +14,7 @@ - 1.7.0 + 1.7.1 develop diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs index e87d39462..667f62362 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/CommonDbContext.cs @@ -615,6 +615,10 @@ private static void HookupHistory(ModelBuilder modelBuilder) .Entity() .HasIndex(e => new { e.ValidatorEntityId, e.EpochNumber }); + modelBuilder + .Entity() + .HasIndex(e => new { e.ValidatorEntityId, e.FromStateVersion }); + modelBuilder .Entity() .HasIndex(e => new { e.EntityId, e.FromStateVersion }); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240827101440_AddValidatorCumulativeEmissionHistoryIdx.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240827101440_AddValidatorCumulativeEmissionHistoryIdx.Designer.cs new file mode 100644 index 000000000..f3ebcb843 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240827101440_AddValidatorCumulativeEmissionHistoryIdx.Designer.cs @@ -0,0 +1,2922 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +// +using System; +using System.Collections.Generic; +using System.Numerics; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.Abstractions.StandardMetadata; +using RadixDlt.NetworkGateway.PostgresIntegration; +using RadixDlt.NetworkGateway.PostgresIntegration.Models; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + [DbContext(typeof(MigrationsDbContext))] + [Migration("20240827101440_AddValidatorCumulativeEmissionHistoryIdx")] + partial class AddValidatorCumulativeEmissionHistoryIdx + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_default_deposit_rule", new[] { "accept", "reject", "allow_existing" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "account_resource_preference_rule", new[] { "allowed", "disallowed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "authorized_depositor_badge_type", new[] { "resource", "non_fungible" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_relationship", new[] { "component_to_instantiating_package", "vault_to_resource", "royalty_vault_of_component", "validator_to_stake_vault", "validator_to_pending_xrd_withdraw_vault", "validator_to_locked_owner_stake_unit_vault", "validator_to_pending_owner_stake_unit_unlock_vault", "stake_unit_of_validator", "claim_token_of_validator", "account_locker_of_locker", "account_locker_of_account", "resource_pool_to_unit_resource", "resource_pool_to_resource", "resource_pool_to_resource_vault", "unit_resource_of_resource_pool", "resource_vault_of_resource_pool", "access_controller_to_recovery_badge", "recovery_badge_of_access_controller" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "entity_type", new[] { "global_consensus_manager", "global_fungible_resource", "global_non_fungible_resource", "global_generic_component", "internal_generic_component", "global_account_component", "global_package", "internal_key_value_store", "internal_fungible_vault", "internal_non_fungible_vault", "global_validator", "global_access_controller", "global_identity", "global_one_resource_pool", "global_two_resource_pool", "global_multi_resource_pool", "global_transaction_tracker", "global_account_locker" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_manifest_class", new[] { "general", "transfer", "validator_stake", "validator_unstake", "validator_claim", "account_deposit_settings_update", "pool_contribution", "pool_redemption" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_event_type", new[] { "withdrawal", "deposit" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_operation_type", new[] { "resource_in_use", "account_deposited_into", "account_withdrawn_from", "account_owner_method_call", "badge_presented" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_origin_type", new[] { "user", "epoch_change" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_marker_type", new[] { "origin", "event", "manifest_address", "affected_global_entity", "manifest_class", "event_global_emitter" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update", "flash" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "module_id", new[] { "main", "metadata", "royalty", "role_assignment" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "non_fungible_id_type", new[] { "string", "integer", "bytes", "ruid" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "package_vm_type", new[] { "native", "scrypto_v1" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_intent_ledger_status", new[] { "unknown", "committed", "commit_pending", "permanent_rejection", "possible_to_commit", "likely_but_not_certain_rejection" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "pending_transaction_payload_ledger_status", new[] { "unknown", "committed", "commit_pending", "clashing_commit", "permanently_rejected", "transiently_accepted", "transiently_rejected" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "public_key_type", new[] { "ecdsa_secp256k1", "eddsa_ed25519" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "resource_type", new[] { "fungible", "non_fungible" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "sbor_type_kind", new[] { "well_known", "schema_local" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "standard_metadata_key", new[] { "dapp_account_type", "dapp_definition", "dapp_definitions", "dapp_claimed_websites", "dapp_claimed_entities", "dapp_account_locker" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "state_type", new[] { "json", "sbor" }); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountAuthorizedDepositorAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "FromStateVersion"); + + b.ToTable("account_authorized_depositor_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountAuthorizedDepositorEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("discriminator") + .HasColumnType("authorized_depositor_badge_type"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "FromStateVersion"); + + b.ToTable("account_authorized_depositor_entry_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountDefaultDepositRuleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("DefaultDepositRule") + .HasColumnType("account_default_deposit_rule") + .HasColumnName("default_deposit_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "FromStateVersion"); + + b.ToTable("account_default_deposit_rule_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountLockerEntryDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("AccountLockerEntityId") + .HasColumnType("bigint") + .HasColumnName("account_locker_entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("AccountLockerEntityId", "AccountEntityId") + .IsUnique(); + + b.ToTable("account_locker_entry_definition"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountLockerEntryResourceVaultDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountLockerDefinitionId") + .HasColumnType("bigint") + .HasColumnName("account_locker_definition_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("AccountLockerDefinitionId", "FromStateVersion") + .IsUnique(); + + b.ToTable("account_locker_entry_resource_vault_definition"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountLockerEntryTouchHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountLockerDefinitionId") + .HasColumnType("bigint") + .HasColumnName("account_locker_definition_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("AccountLockerDefinitionId", "FromStateVersion"); + + b.ToTable("account_locker_entry_touch_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "FromStateVersion"); + + b.ToTable("account_resource_preference_rule_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountResourcePreferenceRuleEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccountEntityId") + .HasColumnType("bigint") + .HasColumnName("account_entity_id"); + + b.Property("AccountResourcePreferenceRule") + .HasColumnType("account_resource_preference_rule") + .HasColumnName("account_resource_preference_rule"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("account_resource_preference_rule_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("component_method_royalty_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ComponentMethodRoyaltyEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("MethodName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("method_name"); + + b.Property("RoyaltyAmount") + .HasColumnType("jsonb") + .HasColumnName("royalty_amount"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.HasIndex("EntityId", "MethodName", "FromStateVersion"); + + b.ToTable("component_method_royalty_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("text") + .HasColumnName("address"); + + b.Property>("AncestorIds") + .HasColumnType("bigint[]") + .HasColumnName("ancestor_ids"); + + b.Property>("CorrelatedEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("correlated_entity_ids"); + + b.Property>("CorrelatedEntityRelationships") + .IsRequired() + .HasColumnType("entity_relationship[]") + .HasColumnName("correlated_entity_relationships"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalAncestorId") + .HasColumnType("bigint") + .HasColumnName("global_ancestor_id"); + + b.Property("IsGlobal") + .HasColumnType("boolean") + .HasColumnName("is_global"); + + b.Property("OwnerAncestorId") + .HasColumnType("bigint") + .HasColumnName("owner_ancestor_id"); + + b.Property("ParentAncestorId") + .HasColumnType("bigint") + .HasColumnName("parent_ancestor_id"); + + b.Property("discriminator") + .HasColumnType("entity_type"); + + b.HasKey("Id"); + + b.HasIndex("Address") + .IsUnique(); + + b.HasIndex("FromStateVersion") + .HasFilter("discriminator = 'global_validator'"); + + b.ToTable("entities"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("MetadataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("metadata_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_metadata_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityMetadataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("Key") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "Key", "FromStateVersion"); + + b.ToTable("entity_metadata_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("FungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_entity_ids"); + + b.Property>("FungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("fungible_resource_significant_update_state_versions"); + + b.Property>("NonFungibleResourceEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_entity_ids"); + + b.Property>("NonFungibleResourceSignificantUpdateStateVersions") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_resource_significant_update_state_versions"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceVaultAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property>("VaultEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("vault_entity_ids"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId", "FromStateVersion"); + + b.ToTable("entity_resource_vault_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("OwnerRoleId") + .HasColumnType("bigint") + .HasColumnName("owner_role_id"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("KeyModule") + .HasColumnType("module_id") + .HasColumnName("key_module"); + + b.Property("KeyRole") + .IsRequired() + .HasColumnType("text") + .HasColumnName("key_role"); + + b.Property("RoleAssignments") + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "KeyRole", "KeyModule", "FromStateVersion"); + + b.ToTable("entity_role_assignments_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityRoleAssignmentsOwnerRoleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("RoleAssignments") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("role_assignments"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("entity_role_assignments_owner_role_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("GlobalEntityId") + .HasColumnType("bigint") + .HasColumnName("global_entity_id"); + + b.Property("OwnerEntityId") + .HasColumnType("bigint") + .HasColumnName("owner_entity_id"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.Property("discriminator") + .HasColumnType("resource_type"); + + b.HasKey("Id"); + + b.HasIndex("GlobalEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("OwnerEntityId", "FromStateVersion") + .HasFilter("is_royalty_vault = true"); + + b.HasIndex("VaultEntityId", "FromStateVersion"); + + b.HasIndex("GlobalEntityId", "VaultEntityId", "FromStateVersion"); + + b.HasIndex("Id", "ResourceEntityId", "FromStateVersion"); + + b.HasIndex("OwnerEntityId", "VaultEntityId", "FromStateVersion"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); + + b.HasIndex("KeyValueStoreEntityId", "Key") + .HasDatabaseName("IX_key_value_store_entry_definition_key_value_store_entity_id~1"); + + b.ToTable("key_value_store_entry_definition"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("KeyValueStoreEntryDefinitionId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entry_definition_id"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntryDefinitionId", "FromStateVersion"); + + b.ToTable("key_value_store_entry_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.KeyValueStoreSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("KeySborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("key_sbor_type_kind"); + + b.Property("KeySchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("key_schema_defining_entity_id"); + + b.Property("KeySchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key_schema_hash"); + + b.Property("KeyTypeIndex") + .HasColumnType("bigint") + .HasColumnName("key_type_index"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("ValueSborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("value_sbor_type_kind"); + + b.Property("ValueSchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("value_schema_defining_entity_id"); + + b.Property("ValueSchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("value_schema_hash"); + + b.Property("ValueTypeIndex") + .HasColumnType("bigint") + .HasColumnName("value_type_index"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "FromStateVersion"); + + b.ToTable("key_value_store_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction", b => + { + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("AffectedGlobalEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("affected_global_entities"); + + b.Property("BalanceChanges") + .HasColumnType("jsonb") + .HasColumnName("balance_changes"); + + b.Property("CreatedTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_timestamp"); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FeePaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("fee_paid"); + + b.Property("IndexInEpoch") + .HasColumnType("bigint") + .HasColumnName("index_in_epoch"); + + b.Property("IndexInRound") + .HasColumnType("bigint") + .HasColumnName("index_in_round"); + + b.Property("NormalizedRoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("normalized_round_timestamp"); + + b.Property("ReceiptCostingParameters") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_costing_parameters"); + + b.Property("ReceiptErrorMessage") + .HasColumnType("text") + .HasColumnName("receipt_error_message"); + + b.Property("ReceiptEventEmitters") + .IsRequired() + .HasColumnType("jsonb[]") + .HasColumnName("receipt_event_emitters"); + + b.Property("ReceiptEventNames") + .IsRequired() + .HasColumnType("text[]") + .HasColumnName("receipt_event_names"); + + b.Property("ReceiptEventSborTypeKinds") + .IsRequired() + .HasColumnType("sbor_type_kind[]") + .HasColumnName("receipt_event_sbor_type_kinds"); + + b.Property("ReceiptEventSbors") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_sbors"); + + b.Property("ReceiptEventSchemaEntityIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_schema_entity_ids"); + + b.Property("ReceiptEventSchemaHashes") + .IsRequired() + .HasColumnType("bytea[]") + .HasColumnName("receipt_event_schema_hashes"); + + b.Property("ReceiptEventTypeIndexes") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("receipt_event_type_indexes"); + + b.Property("ReceiptFeeDestination") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_destination"); + + b.Property("ReceiptFeeSource") + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_source"); + + b.Property("ReceiptFeeSummary") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_fee_summary"); + + b.Property("ReceiptNextEpoch") + .HasColumnType("jsonb") + .HasColumnName("receipt_next_epoch"); + + b.Property("ReceiptOutput") + .HasColumnType("jsonb") + .HasColumnName("receipt_output"); + + b.Property("ReceiptStateUpdates") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("receipt_state_updates"); + + b.Property("ReceiptStatus") + .HasColumnType("ledger_transaction_status") + .HasColumnName("receipt_status"); + + b.Property("ReceiptTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("receipt_tree_hash"); + + b.Property("RoundInEpoch") + .HasColumnType("bigint") + .HasColumnName("round_in_epoch"); + + b.Property("RoundTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("round_timestamp"); + + b.Property("StateTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("state_tree_hash"); + + b.Property("TipPaid") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("tip_paid"); + + b.Property("TransactionTreeHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("transaction_tree_hash"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_type"); + + b.HasKey("StateVersion"); + + b.HasIndex("RoundTimestamp"); + + b.HasIndex("Epoch", "RoundInEpoch") + .IsUnique() + .HasFilter("index_in_round = 0"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StateVersion") + .HasColumnType("bigint") + .HasColumnName("state_version"); + + b.Property("discriminator") + .HasColumnType("ledger_transaction_marker_type"); + + b.HasKey("Id"); + + b.HasIndex("StateVersion"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDataHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .HasColumnType("bytea") + .HasColumnName("data"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.Property("NonFungibleIdDefinitionId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_definition_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDefinitionId", "FromStateVersion"); + + b.ToTable("non_fungible_id_data_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("non_fungible_id"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.HasIndex("NonFungibleResourceEntityId", "NonFungibleId", "FromStateVersion") + .IsUnique() + .HasDatabaseName("IX_non_fungible_id_definition_non_fungible_resource_entity_id~1"); + + b.ToTable("non_fungible_id_definition"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdLocationHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_definition_id"); + + b.Property("VaultEntityId") + .HasColumnType("bigint") + .HasColumnName("vault_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_location_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleSchemaHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_schema_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("PackageBlueprintIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("package_blueprint_ids"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_blueprint_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageBlueprintHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AuthTemplate") + .HasColumnType("jsonb") + .HasColumnName("auth_template"); + + b.Property("AuthTemplateIsLocked") + .HasColumnType("boolean") + .HasColumnName("auth_template_is_locked"); + + b.Property("Definition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("definition"); + + b.Property>("DependantEntityIds") + .HasColumnType("bigint[]") + .HasColumnName("dependant_entity_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("RoyaltyConfig") + .HasColumnType("jsonb") + .HasColumnName("royalty_config"); + + b.Property("RoyaltyConfigIsLocked") + .HasColumnType("boolean") + .HasColumnName("royalty_config_is_locked"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.HasIndex("PackageEntityId", "Name", "Version", "FromStateVersion"); + + b.ToTable("package_blueprint_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property>("PackageCodeIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("package_code_ids"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_code_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PackageCodeHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code"); + + b.Property("CodeHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("code_hash"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + b.Property("VmType") + .HasColumnType("package_vm_type") + .HasColumnName("vm_type"); + + b.HasKey("Id"); + + b.HasIndex("PackageEntityId", "FromStateVersion"); + + b.ToTable("package_code_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EndEpochExclusive") + .HasColumnType("bigint") + .HasColumnName("end_epoch_exclusive"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("PayloadId") + .HasColumnType("bigint") + .HasColumnName("payload_id"); + + b.Property("VersionControl") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.HasKey("Id"); + + b.HasIndex("IntentHash"); + + b.HasIndex("PayloadHash") + .IsUnique(); + + b.ToTable("pending_transactions"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("NotarizedTransactionBlob") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("notarized_transaction_blob"); + + b.Property("PendingTransactionId") + .HasColumnType("bigint") + .HasColumnName("pending_transaction_id"); + + b.HasKey("Id"); + + b.HasIndex("PendingTransactionId") + .IsUnique(); + + b.ToTable("pending_transaction_payloads"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceEntitySupplyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("TotalBurned") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_burned"); + + b.Property("TotalMinted") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_minted"); + + b.Property("TotalSupply") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("total_supply"); + + b.HasKey("Id"); + + b.HasIndex("ResourceEntityId", "FromStateVersion"); + + b.ToTable("resource_entity_supply_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ResourceHolder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("LastUpdatedAtStateVersion") + .HasColumnType("bigint") + .HasColumnName("last_updated_at_state_version"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "ResourceEntityId") + .IsUnique(); + + b.HasIndex("EntityId", "ResourceEntityId", "Balance"); + + b.ToTable("resource_holders"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaEntryAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("schema_entry_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SchemaEntryDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Schema") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "SchemaHash"); + + b.ToTable("schema_entry_definition"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("discriminator") + .HasColumnType("state_type"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("state_history"); + + b.HasDiscriminator("discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataAggregateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property>("EntryIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("entry_ids"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "FromStateVersion"); + + b.ToTable("unverified_standard_metadata_aggregate_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataEntryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Discriminator") + .HasColumnType("standard_metadata_key") + .HasColumnName("discriminator"); + + b.Property("EntityId") + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted"); + + b.Property("IsLocked") + .HasColumnType("boolean") + .HasColumnName("is_locked"); + + b.HasKey("Id"); + + b.HasIndex("EntityId", "Discriminator", "FromStateVersion"); + + b.ToTable("unverified_standard_metadata_entry_history"); + + b.HasDiscriminator("Discriminator"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Epoch") + .HasColumnType("bigint") + .HasColumnName("epoch"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Stake") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("stake"); + + b.Property("ValidatorPublicKeyHistoryId") + .HasColumnType("bigint") + .HasColumnName("validator_public_key_history_id"); + + b.HasKey("Id"); + + b.HasIndex("Epoch"); + + b.HasIndex("FromStateVersion"); + + b.HasIndex("ValidatorPublicKeyHistoryId"); + + b.ToTable("validator_active_set_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorCumulativeEmissionHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("EpochNumber") + .HasColumnType("bigint") + .HasColumnName("epoch_number"); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("ParticipationInActiveSet") + .HasColumnType("bigint") + .HasColumnName("participation_in_active_set"); + + b.Property("ProposalsMade") + .HasColumnType("bigint") + .HasColumnName("proposals_made"); + + b.Property("ProposalsMissed") + .HasColumnType("bigint") + .HasColumnName("proposals_missed"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "EpochNumber"); + + b.HasIndex("ValidatorEntityId", "FromStateVersion"); + + b.ToTable("validator_cumulative_emission_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FromStateVersion") + .HasColumnType("bigint") + .HasColumnName("from_state_version"); + + b.Property("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyType") + .HasColumnType("public_key_type") + .HasColumnName("key_type"); + + b.Property("ValidatorEntityId") + .HasColumnType("bigint") + .HasColumnName("validator_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("ValidatorEntityId", "FromStateVersion"); + + b.HasIndex("ValidatorEntityId", "KeyType", "Key"); + + b.ToTable("validator_public_key_history"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountAuthorizedNonFungibleBadgeDepositorEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountAuthorizedDepositorEntryHistory"); + + b.Property("NonFungibleId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("non_fungible_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasIndex("AccountEntityId", "ResourceEntityId", "NonFungibleId", "FromStateVersion") + .HasDatabaseName("IX_account_authorized_depositor_entry_history_account_entity_~1") + .HasFilter("discriminator = 'non_fungible'"); + + b.ToTable("account_authorized_depositor_entry_history"); + + b.HasDiscriminator().HasValue(AuthorizedDepositorBadgeType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountAuthorizedResourceBadgeDepositorEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.AccountAuthorizedDepositorEntryHistory"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasIndex("AccountEntityId", "ResourceEntityId", "FromStateVersion") + .HasDatabaseName("IX_account_authorized_depositor_entry_history_account_entity_~2") + .HasFilter("discriminator = 'resource'"); + + b.ToTable("account_authorized_depositor_entry_history"); + + b.HasDiscriminator().HasValue(AuthorizedDepositorBadgeType.Resource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccessControllerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccessController); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalAccountLockerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccountLocker); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalConsensusManager); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property("Divisibility") + .HasColumnType("integer") + .HasColumnName("divisibility"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalIdentityEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalIdentity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalMultiResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalMultiResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalNonFungibleResourceEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.Property>("NonFungibleDataMutableFields") + .IsRequired() + .HasColumnType("text[]") + .HasColumnName("non_fungible_data_mutable_fields"); + + b.Property("NonFungibleIdType") + .HasColumnType("non_fungible_id_type") + .HasColumnName("non_fungible_id_type"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalNonFungibleResource); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalOneResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalOneResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalPackageEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalPackage); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTransactionTrackerEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTransactionTracker); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalTwoResourcePoolEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalTwoResourcePool); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalValidatorEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalValidator); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalGenericComponentEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalGenericComponent); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalKeyValueStoreEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalKeyValueStore); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.InternalNonFungibleVaultEntity", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + + b.Property("BlueprintName") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_name"); + + b.Property("BlueprintVersion") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text") + .HasColumnName("blueprint_version"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.InternalNonFungibleVault); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleResourceAggregatedVaultsHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityResourceAggregatedVaultsHistory"); + + b.Property("TotalCount") + .HasColumnType("bigint") + .HasColumnName("total_count"); + + b.ToTable("entity_resource_aggregated_vaults_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property("Balance") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("balance"); + + b.Property("IsRoyaltyVault") + .HasColumnType("boolean") + .HasColumnName("is_royalty_vault"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.Fungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityNonFungibleVaultHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.EntityVaultHistory"); + + b.Property>("NonFungibleIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_ids"); + + b.ToTable("entity_vault_history"); + + b.HasDiscriminator().HasValue(ResourceType.NonFungible); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.FlashLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Flash); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GenesisLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.Genesis); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.RoundUpdateLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.RoundUpdate); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.UserLedgerTransaction", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransaction"); + + b.Property("IntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("intent_hash"); + + b.Property("ManifestClasses") + .IsRequired() + .HasColumnType("ledger_transaction_manifest_class[]") + .HasColumnName("manifest_classes"); + + b.Property("ManifestInstructions") + .IsRequired() + .HasColumnType("text") + .HasColumnName("manifest_instructions"); + + b.Property("Message") + .HasColumnType("jsonb") + .HasColumnName("message"); + + b.Property("PayloadHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("payload_hash"); + + b.Property("RawPayload") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("raw_payload"); + + b.Property("SignedIntentHash") + .IsRequired() + .HasColumnType("text") + .HasColumnName("signed_intent_hash"); + + b.HasIndex("IntentHash") + .HasFilter("intent_hash IS NOT NULL"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("IntentHash"), "hash"); + + b.ToTable("ledger_transactions"); + + b.HasDiscriminator().HasValue(LedgerTransactionType.User); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.AffectedGlobalEntityTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("EntityId", "StateVersion") + .HasDatabaseName("IX_ledger_transaction_markers_entity_id_state_version1") + .HasFilter("discriminator = 'affected_global_entity'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventGlobalEmitterTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.HasIndex("EntityId", "StateVersion") + .HasFilter("discriminator = 'event_global_emitter'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.EventGlobalEmitter); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.EventLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("EventType") + .HasColumnType("ledger_transaction_marker_event_type") + .HasColumnName("event_type"); + + b.Property("Quantity") + .HasPrecision(1000) + .HasColumnType("numeric") + .HasColumnName("quantity"); + + b.Property("ResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.HasIndex("EventType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'event'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Event); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestAddressLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("EntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("entity_id"); + + b.Property("OperationType") + .HasColumnType("ledger_transaction_marker_operation_type") + .HasColumnName("operation_type"); + + b.HasIndex("OperationType", "EntityId", "StateVersion") + .HasFilter("discriminator = 'manifest_address'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestAddress); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ManifestClassMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("IsMostSpecific") + .HasColumnType("boolean") + .HasColumnName("is_most_specific"); + + b.Property("ManifestClass") + .HasColumnType("ledger_transaction_manifest_class") + .HasColumnName("manifest_class"); + + b.HasIndex(new[] { "ManifestClass", "StateVersion" }, "IX_ledger_transaction_markers_manifest_class") + .HasFilter("discriminator = 'manifest_class'"); + + b.HasIndex(new[] { "ManifestClass", "StateVersion" }, "IX_ledger_transaction_markers_manifest_class_is_most_specific") + .HasFilter("discriminator = 'manifest_class' and is_most_specific = true"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.ManifestClass); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.OriginLedgerTransactionMarker", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerTransactionMarker"); + + b.Property("OriginType") + .HasColumnType("ledger_transaction_marker_origin_type") + .HasColumnName("origin_type"); + + b.HasIndex("OriginType", "StateVersion") + .HasFilter("discriminator = 'origin'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.Origin); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.JsonStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("JsonState") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("json_state"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Json); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.SborStateHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.StateHistory"); + + b.Property("SborState") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("sbor_state"); + + b.Property("SborTypeKind") + .HasColumnType("sbor_type_kind") + .HasColumnName("sbor_type_kind"); + + b.Property("SchemaDefiningEntityId") + .HasColumnType("bigint") + .HasColumnName("schema_defining_entity_id"); + + b.Property("SchemaHash") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("schema_hash"); + + b.Property("TypeIndex") + .HasColumnType("bigint") + .HasColumnName("type_index"); + + b.ToTable("state_history"); + + b.HasDiscriminator().HasValue(StateType.Sbor); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.DappAccountLockerUnverifiedStandardMetadataEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataEntryHistory"); + + b.Property("EntityIds") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint[]") + .HasColumnName("entity_ids"); + + b.ToTable("unverified_standard_metadata_entry_history"); + + b.HasDiscriminator().HasValue(StandardMetadataKey.DappAccountLocker); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.DappAccountTypeUnverifiedStandardMetadataEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataEntryHistory"); + + b.Property("Values") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text[]") + .HasColumnName("values"); + + b.ToTable("unverified_standard_metadata_entry_history"); + + b.HasDiscriminator().HasValue(StandardMetadataKey.DappAccountType); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.DappClaimedEntitiesUnverifiedStandardMetadataEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataEntryHistory"); + + b.Property("EntityIds") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint[]") + .HasColumnName("entity_ids"); + + b.ToTable("unverified_standard_metadata_entry_history"); + + b.HasDiscriminator().HasValue(StandardMetadataKey.DappClaimedEntities); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.DappClaimedWebsitesUnverifiedStandardMetadataEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataEntryHistory"); + + b.Property("Values") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("text[]") + .HasColumnName("values"); + + b.ToTable("unverified_standard_metadata_entry_history"); + + b.HasDiscriminator().HasValue(StandardMetadataKey.DappClaimedWebsites); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.DappDefinitionUnverifiedStandardMetadataEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataEntryHistory"); + + b.Property("EntityIds") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint[]") + .HasColumnName("entity_ids"); + + b.ToTable("unverified_standard_metadata_entry_history"); + + b.HasDiscriminator().HasValue(StandardMetadataKey.DappDefinition); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.DappDefinitionsUnverifiedStandardMetadataEntryHistory", b => + { + b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.UnverifiedStandardMetadataEntryHistory"); + + b.Property("EntityIds") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint[]") + .HasColumnName("entity_ids"); + + b.ToTable("unverified_standard_metadata_entry_history"); + + b.HasDiscriminator().HasValue(StandardMetadataKey.DappDefinitions); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionGatewayHandling", "GatewayHandling", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("AttemptedSubmissionToNodesCount") + .HasColumnType("integer") + .HasColumnName("node_submission_count"); + + b1.Property("FirstSubmittedToGatewayTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("first_submitted_to_gateway_timestamp"); + + b1.Property("HandlingStatusReason") + .HasColumnType("text") + .HasColumnName("handling_status_reason"); + + b1.Property("ResubmitFromTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("resubmit_from_timestamp"); + + b1.HasKey("PendingTransactionId"); + + b1.HasIndex("FirstSubmittedToGatewayTimestamp"); + + b1.HasIndex("ResubmitFromTimestamp"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionLedgerDetails", "LedgerDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("CommitTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("commit_timestamp"); + + b1.Property("InitialRejectionReason") + .HasColumnType("text") + .HasColumnName("initial_rejection_reason"); + + b1.Property("IntentLedgerStatus") + .HasColumnType("pending_transaction_intent_ledger_status") + .HasColumnName("intent_status"); + + b1.Property("LatestRejectionReason") + .HasColumnType("text") + .HasColumnName("latest_rejection_reason"); + + b1.Property("LatestRejectionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_rejection_timestamp"); + + b1.Property("PayloadLedgerStatus") + .HasColumnType("pending_transaction_payload_ledger_status") + .HasColumnName("payload_status"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionNetworkDetails", "NetworkDetails", b1 => + { + b1.Property("PendingTransactionId") + .HasColumnType("bigint"); + + b1.Property("LastSubmitErrorTitle") + .HasColumnType("text") + .HasColumnName("last_submit_error"); + + b1.Property("LatestNodeSubmissionTimestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("latest_node_submission_timestamp"); + + b1.Property("LatestNodeSubmissionWasAccepted") + .HasColumnType("boolean") + .HasColumnName("latest_node_submission_was_accepted"); + + b1.Property("LatestSubmittedToNodeName") + .HasColumnType("text") + .HasColumnName("latest_submitted_to_node_name"); + + b1.HasKey("PendingTransactionId"); + + b1.ToTable("pending_transactions"); + + b1.WithOwner() + .HasForeignKey("PendingTransactionId"); + }); + + b.Navigation("GatewayHandling") + .IsRequired(); + + b.Navigation("LedgerDetails") + .IsRequired(); + + b.Navigation("NetworkDetails") + .IsRequired(); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", "PendingTransaction") + .WithOne("Payload") + .HasForeignKey("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "PendingTransactionId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("PendingTransaction"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorActiveSetHistory", b => + { + b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ValidatorPublicKeyHistory", "PublicKey") + .WithMany() + .HasForeignKey("ValidatorPublicKeyHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicKey"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => + { + b.Navigation("Payload"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240827101440_AddValidatorCumulativeEmissionHistoryIdx.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240827101440_AddValidatorCumulativeEmissionHistoryIdx.cs new file mode 100644 index 000000000..f6aa68df0 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240827101440_AddValidatorCumulativeEmissionHistoryIdx.cs @@ -0,0 +1,91 @@ +/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands). + * + * Licensed under the Radix License, Version 1.0 (the "License"); you may not use this + * file except in compliance with the License. You may obtain a copy of the License at: + * + * radixfoundation.org/licenses/LICENSE-v1 + * + * The Licensor hereby grants permission for the Canonical version of the Work to be + * published, distributed and used under or by reference to the Licensor’s trademark + * Radix ® and use of any unregistered trade names, logos or get-up. + * + * The Licensor provides the Work (and each Contributor provides its Contributions) on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + * including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, + * MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. + * + * Whilst the Work is capable of being deployed, used and adopted (instantiated) to create + * a distributed ledger it is your responsibility to test and validate the code, together + * with all logic and performance of that code under all foreseeable scenarios. + * + * The Licensor does not make or purport to make and hereby excludes liability for all + * and any representation, warranty or undertaking in any form whatsoever, whether express + * or implied, to any entity or person, including any representation, warranty or + * undertaking, as to the functionality security use, value or other characteristics of + * any distributed ledger nor in respect the functioning or value of any tokens which may + * be created stored or transferred using the Work. The Licensor does not warrant that the + * Work or any use of the Work complies with any law or regulation in any territory where + * it may be implemented or used or that it will be appropriate for any specific purpose. + * + * Neither the licensor nor any current or former employees, officers, directors, partners, + * trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor + * shall be liable for any direct or indirect, special, incidental, consequential or other + * losses of any kind, in tort, contract or otherwise (including but not limited to loss + * of revenue, income or profits, or loss of use or data, or loss of reputation, or loss + * of any economic or other opportunity of whatsoever nature or howsoever arising), arising + * out of or in connection with (without limitation of any use, misuse, of any ledger system + * or use made or its functionality or any performance or operation of any code or protocol + * caused by bugs or programming or logic errors or otherwise); + * + * A. any offer, purchase, holding, use, sale, exchange or transmission of any + * cryptographic keys, tokens or assets created, exchanged, stored or arising from any + * interaction with the Work; + * + * B. any failure in a transmission or loss of any token or assets keys or other digital + * artefacts due to errors in transmission; + * + * C. bugs, hacks, logic errors or faults in the Work or any communication; + * + * D. system software or apparatus including but not limited to losses caused by errors + * in holding or transmitting tokens by any third-party; + * + * E. breaches or failure of security including hacker attacks, loss or disclosure of + * password, loss of private key, unauthorised use or misuse of such passwords or keys; + * + * F. any losses including loss of anticipated savings or other benefits resulting from + * use of the Work or any changes to the Work (however implemented). + * + * You are solely responsible for; testing, validating and evaluation of all operation + * logic, functionality, security and appropriateness of using the Work for any commercial + * or non-commercial purpose and for any reproduction or redistribution by You of the + * Work. You assume all risks associated with Your use of the Work and the exercise of + * permissions under this License. + */ + +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + /// + public partial class AddValidatorCumulativeEmissionHistoryIdx : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateIndex( + name: "IX_validator_cumulative_emission_history_validator_entity_id_f~", + table: "validator_cumulative_emission_history", + columns: new[] { "validator_entity_id", "from_state_version" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_validator_cumulative_emission_history_validator_entity_id_f~", + table: "validator_cumulative_emission_history"); + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index 51e4c956f..fba409baa 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -1282,3 +1282,22 @@ BEGIN END $EF$; COMMIT; +START TRANSACTION; + + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240827101440_AddValidatorCumulativeEmissionHistoryIdx') THEN + CREATE INDEX "IX_validator_cumulative_emission_history_validator_entity_id_f~" ON validator_cumulative_emission_history (validator_entity_id, from_state_version); + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240827101440_AddValidatorCumulativeEmissionHistoryIdx') THEN + INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") + VALUES ('20240827101440_AddValidatorCumulativeEmissionHistoryIdx', '8.0.2'); + END IF; +END $EF$; +COMMIT; + diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index 8ee876e95..80aa769b0 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -1827,6 +1827,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ValidatorEntityId", "EpochNumber"); + b.HasIndex("ValidatorEntityId", "FromStateVersion"); + b.ToTable("validator_cumulative_emission_history"); });