From faa14723f6ab3524490e37b01990f8a24c8310ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Wed, 20 Dec 2023 17:20:08 +0100 Subject: [PATCH 1/2] return only assigned modules role assignments. --- CHANGELOG.md | 1 + .../PostgresLedgerExtenderService.cs | 19 + .../LedgerExtension/WriteHelper.cs | 4 +- ..._TrackComponentAssignedModules.Designer.cs | 2440 +++++++++++++++++ ...220153048_TrackComponentAssignedModules.cs | 94 + .../Migrations/IdempotentApplyMigrations.sql | 47 +- .../MigrationsDbContextModelSnapshot.cs | 98 +- .../Models/Entity.cs | 3 + .../Services/RoleAssignmentsKeyProvider.cs | 5 +- .../Services/RoleAssignmentsMapper.cs | 3 +- 10 files changed, 2707 insertions(+), 7 deletions(-) create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.Designer.cs create mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index de9bf3be4..c15432caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Release Date: _unreleased_ - extended validator's data returned from `/state/validators/list`. Added `effective_fee_factor` field which returns `current` fee_factor and optionally `pending` change. +- return components effective role assignments only for assigned modules. ## 1.2.3 Release Date: 19.12.2023 diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs index 73d30219c..6a227bf2c 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs @@ -406,6 +406,25 @@ private async Task ProcessTransactions(ReadWriteDbContext db case CoreModel.ObjectTypeInfoDetails objectDetails: referencedEntity.PostResolveConfigure((ComponentEntity e) => { + // TODO PP: + // What about non global components? + // we don't return role assignments for them + // but we also dont have specific db type/entity for only global components + e.AssignedModuleIds = objectDetails + .ModuleVersions + .Select(x => + { + return x.Module switch + { + CoreModel.AttachedModuleId.Metadata => ModuleId.Metadata, + CoreModel.AttachedModuleId.Royalty => ModuleId.Royalty, + CoreModel.AttachedModuleId.RoleAssignment => ModuleId.RoleAssignment, + _ => throw new ArgumentOutOfRangeException(nameof(x.Module), x.Module, "Unexpected value of AssignedModule"), + }; + }) + .OrderBy(x => x) + .ToList(); + e.PackageId = referencedEntities.Get((EntityAddress)objectDetails.BlueprintInfo.PackageAddress).DatabaseId; e.BlueprintName = objectDetails.BlueprintInfo.BlueprintName; e.BlueprintVersion = objectDetails.BlueprintInfo.BlueprintVersion; diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs index 701d594c3..2c31dca02 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/WriteHelper.cs @@ -104,7 +104,7 @@ public async Task CopyEntity(ICollection entities, CancellationToke var sw = Stopwatch.GetTimestamp(); await using var writer = await _connection.BeginBinaryImportAsync( - "COPY entities (id, from_state_version, address, is_global, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, correlated_entities, discriminator, package_id, blueprint_name, blueprint_version, divisibility, non_fungible_id_type, vm_type, stake_vault_entity_id, pending_xrd_withdraw_vault_entity_id, locked_owner_stake_unit_vault_entity_id, pending_owner_stake_unit_unlock_vault_entity_id, resource_entity_id, royalty_vault_of_entity_id) FROM STDIN (FORMAT BINARY)", + "COPY entities (id, from_state_version, address, is_global, ancestor_ids, parent_ancestor_id, owner_ancestor_id, global_ancestor_id, correlated_entities, discriminator, package_id, blueprint_name, blueprint_version, assigned_module_ids, divisibility, non_fungible_id_type, vm_type, stake_vault_entity_id, pending_xrd_withdraw_vault_entity_id, locked_owner_stake_unit_vault_entity_id, pending_owner_stake_unit_unlock_vault_entity_id, resource_entity_id, royalty_vault_of_entity_id) FROM STDIN (FORMAT BINARY)", token); foreach (var e in entities) @@ -128,12 +128,14 @@ public async Task CopyEntity(ICollection entities, CancellationToke await writer.WriteAsync(ce.PackageId, NpgsqlDbType.Bigint, token); await writer.WriteAsync(ce.BlueprintName, NpgsqlDbType.Text, token); await writer.WriteAsync(ce.BlueprintVersion, NpgsqlDbType.Text, token); + await writer.WriteAsync(ce.AssignedModuleIds, "module_id[]", token); } else { await writer.WriteNullAsync(token); await writer.WriteNullAsync(token); await writer.WriteNullAsync(token); + await writer.WriteNullAsync(token); } if (e is GlobalFungibleResourceEntity frme) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.Designer.cs new file mode 100644 index 000000000..b7aa67d48 --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.Designer.cs @@ -0,0 +1,2440 @@ +/* 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.Addressing; +using RadixDlt.NetworkGateway.Abstractions.Model; +using RadixDlt.NetworkGateway.PostgresIntegration; +using RadixDlt.NetworkGateway.PostgresIntegration.Models; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + [DbContext(typeof(MigrationsDbContext))] + [Migration("20231220153048_TrackComponentAssignedModules")] + partial class TrackComponentAssignedModules + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.11") + .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, "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" }); + 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" }); + 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" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update" }); + 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, "state_type", new[] { "json", "sbor" }); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + 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.AccountResourcePreferenceRuleHistory", 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_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>("CorrelatedEntities") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("correlated_entities"); + + 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") + .HasFilter("discriminator = 'non_fungible'"); + + 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.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("Key") + .IsRequired() + .HasColumnType("bytea") + .HasColumnName("key"); + + b.Property("KeyValueStoreEntityId") + .HasColumnType("bigint") + .HasColumnName("key_value_store_entity_id"); + + b.Property("Value") + .HasColumnType("bytea") + .HasColumnName("value"); + + b.HasKey("Id"); + + b.HasIndex("KeyValueStoreEntityId", "Key", "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("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.NetworkConfiguration", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id"); + + b.Property("AddressTypeDefinitions") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("address_type_definitions"); + + b.Property("GenesisEpoch") + .HasColumnType("bigint") + .HasColumnName("genesis_epoch"); + + b.Property("GenesisRound") + .HasColumnType("bigint") + .HasColumnName("genesis_round"); + + b.Property("HrpDefinition") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("hrp_definition"); + + b.Property("NetworkHrpSuffix") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_hrp_suffix"); + + b.Property("NetworkId") + .HasColumnType("smallint") + .HasColumnName("network_id"); + + b.Property("NetworkName") + .IsRequired() + .HasColumnType("text") + .HasColumnName("network_name"); + + b.Property("WellKnownAddresses") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("well_known_addresses"); + + b.HasKey("Id"); + + b.ToTable("network_configuration"); + }); + + modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", 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(); + + b.ToTable("non_fungible_id_data"); + }); + + 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("NonFungibleIdDataId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_id_data_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); + + b.ToTable("non_fungible_id_data_history"); + }); + + 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_data_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.NonFungibleIdStoreHistory", 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>("NonFungibleIdDataIds") + .IsRequired() + .HasColumnType("bigint[]") + .HasColumnName("non_fungible_id_data_ids"); + + b.Property("NonFungibleResourceEntityId") + .HasColumnType("bigint") + .HasColumnName("non_fungible_resource_entity_id"); + + b.HasKey("Id"); + + b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); + + b.ToTable("non_fungible_id_store_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.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.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("PackageEntityId") + .HasColumnType("bigint") + .HasColumnName("package_entity_id"); + + 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("numeric(20,0)") + .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.SchemaHistory", 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", "FromStateVersion"); + + b.HasIndex("SchemaHash", "FromStateVersion"); + + b.ToTable("schema_history"); + }); + + 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.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.ValidatorEmissionStatistics", 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("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.ToTable("validator_emission_statistics"); + }); + + 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.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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.ToTable("entities"); + + b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); + }); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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("NonFungibleIdType") + .HasColumnType("non_fungible_id_type") + .HasColumnName("non_fungible_id_type"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("VmType") + .HasColumnType("package_vm_type") + .HasColumnName("vm_type"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("LockedOwnerStakeUnitVault") + .HasColumnType("bigint") + .HasColumnName("locked_owner_stake_unit_vault_entity_id"); + + b.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("PendingOwnerStakeUnitUnlockVault") + .HasColumnType("bigint") + .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); + + b.Property("PendingXrdWithdrawVault") + .HasColumnType("bigint") + .HasColumnName("pending_xrd_withdraw_vault_entity_id"); + + b.Property("StakeVaultEntityId") + .HasColumnType("bigint") + .HasColumnName("stake_vault_entity_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + b.Property("RoyaltyVaultOfEntityId") + .HasColumnType("bigint") + .HasColumnName("royalty_vault_of_entity_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + 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.Property("PackageId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("package_id"); + + b.Property("ResourceEntityId") + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("bigint") + .HasColumnName("resource_entity_id"); + + 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.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("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") + .HasFilter("discriminator = 'affected_global_entity'"); + + b.ToTable("ledger_transaction_markers"); + + b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); + }); + + 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.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.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/20231220153048_TrackComponentAssignedModules.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.cs new file mode 100644 index 000000000..41bb930ce --- /dev/null +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.cs @@ -0,0 +1,94 @@ +/* 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.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using RadixDlt.NetworkGateway.Abstractions.Model; + +#nullable disable + +namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations +{ + /// + public partial class TrackComponentAssignedModules : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn>( + name: "assigned_module_ids", + table: "entities", + type: "module_id[]", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "assigned_module_ids", + table: "entities"); + } + } +} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index 2eff1b421..175b25bd8 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -1036,7 +1036,7 @@ END $EF$; DO $EF$ BEGIN IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - DELETE FROM pending_transaction_payloads WHERE id IN (SELECT ptp.id FROM pending_transaction_payloads ptp LEFT JOIN pending_transactions pt ON ptp.id = pt.payload_id WHERE pt.id IS NULL); + DELETE FROM pending_transaction_payloads WHERE id IN (SELECT ptp.id FROM pending_transaction_payloads ptp LEFT JOIN pending_transactions pt ON ptp.id = pt.payload_id WHERE pt.id IS NULL); END IF; END $EF$; @@ -1049,3 +1049,48 @@ BEGIN END $EF$; COMMIT; +START TRANSACTION; + + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231130132946_AddNetworkHrpSuffixToNetworkConfiguration') THEN + ALTER TABLE network_configuration ADD network_hrp_suffix text NULL; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231130132946_AddNetworkHrpSuffixToNetworkConfiguration') THEN + update network_configuration set network_hrp_suffix = (select substring(recordset."HrpPrefix"::text,'_(.+)') from network_configuration, jsonb_to_recordset(address_type_definitions) as recordset("HrpPrefix" TEXT) WHERE recordset."HrpPrefix" like '%account%' limit 1) + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231130132946_AddNetworkHrpSuffixToNetworkConfiguration') THEN + INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") + VALUES ('20231130132946_AddNetworkHrpSuffixToNetworkConfiguration', '7.0.11'); + END IF; +END $EF$; +COMMIT; + +START TRANSACTION; + + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231220153048_TrackComponentAssignedModules') THEN + ALTER TABLE entities ADD assigned_module_ids module_id[] NULL; + END IF; +END $EF$; + +DO $EF$ +BEGIN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231220153048_TrackComponentAssignedModules') THEN + INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") + VALUES ('20231220153048_TrackComponentAssignedModules', '7.0.11'); + END IF; +END $EF$; +COMMIT; + diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs index 9c7b45a81..a7706764b 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/MigrationsDbContextModelSnapshot.cs @@ -62,7 +62,7 @@ * permissions under this License. */ -// +// using System; using System.Collections.Generic; using System.Numerics; @@ -1492,6 +1492,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1518,6 +1524,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1544,6 +1556,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1570,6 +1588,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1600,6 +1624,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1626,6 +1656,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1652,6 +1688,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1678,6 +1720,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1708,6 +1756,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1734,6 +1788,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1764,6 +1824,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1790,6 +1856,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1816,6 +1888,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1858,6 +1936,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1893,6 +1977,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() @@ -1928,6 +2018,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); + b.Property>("AssignedModuleIds") + .IsRequired() + .ValueGeneratedOnUpdateSometimes() + .HasColumnType("module_id[]") + .HasColumnName("assigned_module_ids"); + b.Property("BlueprintName") .IsRequired() .ValueGeneratedOnUpdateSometimes() diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs index 5f5aeb720..14e04d0cc 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Models/Entity.cs @@ -145,6 +145,9 @@ internal abstract class ComponentEntity : Entity [Column("blueprint_version")] public string BlueprintVersion { get; set; } + [Column("assigned_module_ids")] + public List AssignedModuleIds { get; set; } + public override List CorrelatedEntities { get diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsKeyProvider.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsKeyProvider.cs index 248cd2819..73622d341 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsKeyProvider.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsKeyProvider.cs @@ -62,7 +62,6 @@ * permissions under this License. */ -using RadixDlt.NetworkGateway.Abstractions.Model; using System.Collections.Generic; using System.Linq; using CoreModel = RadixDlt.CoreApiSdk.Model; @@ -110,8 +109,8 @@ public List ExtractKeysFromBlueprintAuthConfig(CoreModel.Au ?.Roles ?.Select(x => new RoleAssignmentEntry( - new RoleAssignmentRuleKey(x.Key, ModuleId.Main), - x.Value.UpdaterRoles.Select(u => new RoleAssignmentRuleKey(u, ModuleId.Main)).ToArray() + new RoleAssignmentRuleKey(x.Key, GatewayModel.ModuleId.Main), + x.Value.UpdaterRoles.Select(u => new RoleAssignmentRuleKey(u, GatewayModel.ModuleId.Main)).ToArray() )) .ToList() ?? new List(); } diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsMapper.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsMapper.cs index cf89a8591..f5d0d03a5 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsMapper.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Services/RoleAssignmentsMapper.cs @@ -116,7 +116,8 @@ public RoleAssignmentsMapper(IRoleAssignmentsKeyProvider roleAssignmentsKeyProvi var mainModuleKeys = _roleAssignmentsKeyProvider.ExtractKeysFromBlueprintAuthConfig(authConfig!); - var allModulesKeys = mainModuleKeys.Concat(nativeModulesKeys).ToList(); + var assignedNativeModuleKeys = nativeModulesKeys.Where(x => entity.AssignedModuleIds.Contains(x.Key.ModuleId)); + var allModulesKeys = mainModuleKeys.Concat(assignedNativeModuleKeys).ToList(); return new GatewayApiSdk.Model.ComponentEntityRoleAssignments( new JRaw(ownerRole), From c33e4b32d4aeabe0feb7334dacbedbc15679dfca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pawelec?= Date: Thu, 4 Jan 2024 13:31:38 +0100 Subject: [PATCH 2/2] regenerate initial migration. --- .../PostgresLedgerExtenderService.cs | 4 - .../20230922041840_InitialCreate.Designer.cs | 2378 ----------------- ...TransactionPayloadRelationship.Designer.cs | 2339 ---------------- ...sePendingTransactionPayloadRelationship.cs | 156 -- ...rpSuffixToNetworkConfiguration.Designer.cs | 2344 ---------------- ...dNetworkHrpSuffixToNetworkConfiguration.cs | 101 - ...220153048_TrackComponentAssignedModules.cs | 94 - ... 20240104122654_InitialCreate.Designer.cs} | 4 +- ...ate.cs => 20240104122654_InitialCreate.cs} | 74 +- .../Migrations/IdempotentApplyMigrations.sql | 352 +-- 10 files changed, 162 insertions(+), 7684 deletions(-) delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20230922041840_InitialCreate.Designer.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231101101154_InversePendingTransactionPayloadRelationship.Designer.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231101101154_InversePendingTransactionPayloadRelationship.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.Designer.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.cs delete mode 100644 src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.cs rename src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/{20231220153048_TrackComponentAssignedModules.Designer.cs => 20240104122654_InitialCreate.Designer.cs} (99%) rename src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/{20230922041840_InitialCreate.cs => 20240104122654_InitialCreate.cs} (98%) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs index 6a227bf2c..bf7985180 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/LedgerExtension/PostgresLedgerExtenderService.cs @@ -406,10 +406,6 @@ private async Task ProcessTransactions(ReadWriteDbContext db case CoreModel.ObjectTypeInfoDetails objectDetails: referencedEntity.PostResolveConfigure((ComponentEntity e) => { - // TODO PP: - // What about non global components? - // we don't return role assignments for them - // but we also dont have specific db type/entity for only global components e.AssignedModuleIds = objectDetails .ModuleVersions .Select(x => diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20230922041840_InitialCreate.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20230922041840_InitialCreate.Designer.cs deleted file mode 100644 index fe5b63ade..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20230922041840_InitialCreate.Designer.cs +++ /dev/null @@ -1,2378 +0,0 @@ -/* 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.Addressing; -using RadixDlt.NetworkGateway.Abstractions.Model; -using RadixDlt.NetworkGateway.PostgresIntegration; -using RadixDlt.NetworkGateway.PostgresIntegration.Models; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - [DbContext(typeof(MigrationsDbContext))] - [Migration("20230922041840_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .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, "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" }); - 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" }); - 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" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update" }); - 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, "state_type", new[] { "json", "sbor" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - 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.AccountResourcePreferenceRuleHistory", 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_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>("CorrelatedEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("correlated_entities"); - - 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") - .HasFilter("discriminator = 'non_fungible'"); - - 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.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("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "Key", "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("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("RoundInEpoch") - .HasColumnType("bigint") - .HasColumnName("round_in_epoch"); - - b.Property("RoundTimestamp") - .HasColumnType("timestamp with time zone") - .HasColumnName("round_timestamp"); - - b.Property("TipPaid") - .HasPrecision(1000) - .HasColumnType("numeric") - .HasColumnName("tip_paid"); - - 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.NetworkConfiguration", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("AddressTypeDefinitions") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("address_type_definitions"); - - b.Property("GenesisEpoch") - .HasColumnType("bigint") - .HasColumnName("genesis_epoch"); - - b.Property("GenesisRound") - .HasColumnType("bigint") - .HasColumnName("genesis_round"); - - b.Property("HrpDefinition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("hrp_definition"); - - b.Property("NetworkId") - .HasColumnType("smallint") - .HasColumnName("network_id"); - - b.Property("NetworkName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_name"); - - b.Property("WellKnownAddresses") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("well_known_addresses"); - - b.HasKey("Id"); - - b.ToTable("network_configuration"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", 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(); - - b.ToTable("non_fungible_id_data"); - }); - - 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("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_data_history"); - }); - - 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_data_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.NonFungibleIdStoreHistory", 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>("NonFungibleIdDataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_id_data_ids"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_id_store_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.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.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("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - 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("numeric(20,0)") - .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.HasIndex("PayloadId"); - - 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.HasKey("Id"); - - 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.SchemaHistory", 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", "FromStateVersion"); - - b.HasIndex("SchemaHash", "FromStateVersion"); - - b.ToTable("schema_history"); - }); - - 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.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.ValidatorEmissionStatistics", 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("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.ToTable("validator_emission_statistics"); - }); - - 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.GlobalAccessControllerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("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.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("NonFungibleIdType") - .HasColumnType("non_fungible_id_type") - .HasColumnName("non_fungible_id_type"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("VmType") - .HasColumnType("package_vm_type") - .HasColumnName("vm_type"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("LockedOwnerStakeUnitVault") - .HasColumnType("bigint") - .HasColumnName("locked_owner_stake_unit_vault_entity_id"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("PendingOwnerStakeUnitUnlockVault") - .HasColumnType("bigint") - .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); - - b.Property("PendingXrdWithdrawVault") - .HasColumnType("bigint") - .HasColumnName("pending_xrd_withdraw_vault_entity_id"); - - b.Property("StakeVaultEntityId") - .HasColumnType("bigint") - .HasColumnName("stake_vault_entity_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("RoyaltyVaultOfEntityId") - .HasColumnType("bigint") - .HasColumnName("royalty_vault_of_entity_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - 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.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("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") - .HasFilter("discriminator = 'affected_global_entity'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); - }); - - 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.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.LedgerTransaction", b => - { - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.LedgerHashes", "LedgerHashes", b1 => - { - b1.Property("LedgerTransactionStateVersion") - .HasColumnType("bigint"); - - b1.Property("ReceiptTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("receipt_tree_hash"); - - b1.Property("StateTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("state_tree_hash"); - - b1.Property("TransactionTreeHash") - .IsRequired() - .HasColumnType("text") - .HasColumnName("transaction_tree_hash"); - - b1.HasKey("LedgerTransactionStateVersion"); - - b1.ToTable("ledger_transactions"); - - b1.WithOwner() - .HasForeignKey("LedgerTransactionStateVersion"); - }); - - b.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.TransactionReceipt", "EngineReceipt", b1 => - { - b1.Property("LedgerTransactionStateVersion") - .HasColumnType("bigint"); - - b1.Property("CostingParameters") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_costing_parameters"); - - b1.Property("ErrorMessage") - .HasColumnType("text") - .HasColumnName("receipt_error_message"); - - b1.Property("FeeDestination") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_destination"); - - b1.Property("FeeSource") - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_source"); - - b1.Property("FeeSummary") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_fee_summary"); - - b1.Property("NextEpoch") - .HasColumnType("jsonb") - .HasColumnName("receipt_next_epoch"); - - b1.Property("Output") - .HasColumnType("jsonb") - .HasColumnName("receipt_output"); - - b1.Property("StateUpdates") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("receipt_state_updates"); - - b1.Property("Status") - .HasColumnType("ledger_transaction_status") - .HasColumnName("receipt_status"); - - b1.HasKey("LedgerTransactionStateVersion"); - - b1.ToTable("ledger_transactions"); - - b1.WithOwner() - .HasForeignKey("LedgerTransactionStateVersion"); - - b1.OwnsOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.ReceiptEvents", "Events", b2 => - { - b2.Property("TransactionReceiptLedgerTransactionStateVersion") - .HasColumnType("bigint"); - - b2.Property("Emitters") - .IsRequired() - .HasColumnType("jsonb[]") - .HasColumnName("receipt_event_emitters"); - - b2.Property("Names") - .IsRequired() - .HasColumnType("text[]") - .HasColumnName("receipt_event_names"); - - b2.Property("SborTypeKinds") - .IsRequired() - .HasColumnType("sbor_type_kind[]") - .HasColumnName("receipt_event_sbor_type_kinds"); - - b2.Property("Sbors") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_sbors"); - - b2.Property("SchemaEntityIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_schema_entity_ids"); - - b2.Property("SchemaHashes") - .IsRequired() - .HasColumnType("bytea[]") - .HasColumnName("receipt_event_schema_hashes"); - - b2.Property("TypeIndexes") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("receipt_event_type_indexes"); - - b2.HasKey("TransactionReceiptLedgerTransactionStateVersion"); - - b2.ToTable("ledger_transactions"); - - b2.WithOwner() - .HasForeignKey("TransactionReceiptLedgerTransactionStateVersion"); - }); - - b1.Navigation("Events") - .IsRequired(); - }); - - b.Navigation("EngineReceipt") - .IsRequired(); - - b.Navigation("LedgerHashes") - .IsRequired(); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransaction", b => - { - b.HasOne("RadixDlt.NetworkGateway.PostgresIntegration.Models.PendingTransactionPayload", "Payload") - .WithMany() - .HasForeignKey("PayloadId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - 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(); - - b.Navigation("Payload"); - }); - - 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"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231101101154_InversePendingTransactionPayloadRelationship.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231101101154_InversePendingTransactionPayloadRelationship.Designer.cs deleted file mode 100644 index a7c89111b..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231101101154_InversePendingTransactionPayloadRelationship.Designer.cs +++ /dev/null @@ -1,2339 +0,0 @@ -/* 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.Addressing; -using RadixDlt.NetworkGateway.Abstractions.Model; -using RadixDlt.NetworkGateway.PostgresIntegration; -using RadixDlt.NetworkGateway.PostgresIntegration.Models; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - [DbContext(typeof(MigrationsDbContext))] - [Migration("20231101101154_InversePendingTransactionPayloadRelationship")] - partial class InversePendingTransactionPayloadRelationship - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .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, "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" }); - 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" }); - 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" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update" }); - 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, "state_type", new[] { "json", "sbor" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - 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.AccountResourcePreferenceRuleHistory", 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_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>("CorrelatedEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("correlated_entities"); - - 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") - .HasFilter("discriminator = 'non_fungible'"); - - 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.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("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "Key", "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("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.NetworkConfiguration", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("AddressTypeDefinitions") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("address_type_definitions"); - - b.Property("GenesisEpoch") - .HasColumnType("bigint") - .HasColumnName("genesis_epoch"); - - b.Property("GenesisRound") - .HasColumnType("bigint") - .HasColumnName("genesis_round"); - - b.Property("HrpDefinition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("hrp_definition"); - - b.Property("NetworkId") - .HasColumnType("smallint") - .HasColumnName("network_id"); - - b.Property("NetworkName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_name"); - - b.Property("WellKnownAddresses") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("well_known_addresses"); - - b.HasKey("Id"); - - b.ToTable("network_configuration"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", 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(); - - b.ToTable("non_fungible_id_data"); - }); - - 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("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_data_history"); - }); - - 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_data_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.NonFungibleIdStoreHistory", 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>("NonFungibleIdDataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_id_data_ids"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_id_store_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.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.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("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - 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("numeric(20,0)") - .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.SchemaHistory", 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", "FromStateVersion"); - - b.HasIndex("SchemaHash", "FromStateVersion"); - - b.ToTable("schema_history"); - }); - - 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.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.ValidatorEmissionStatistics", 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("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.ToTable("validator_emission_statistics"); - }); - - 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.GlobalAccessControllerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("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.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("NonFungibleIdType") - .HasColumnType("non_fungible_id_type") - .HasColumnName("non_fungible_id_type"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("VmType") - .HasColumnType("package_vm_type") - .HasColumnName("vm_type"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("LockedOwnerStakeUnitVault") - .HasColumnType("bigint") - .HasColumnName("locked_owner_stake_unit_vault_entity_id"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("PendingOwnerStakeUnitUnlockVault") - .HasColumnType("bigint") - .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); - - b.Property("PendingXrdWithdrawVault") - .HasColumnType("bigint") - .HasColumnName("pending_xrd_withdraw_vault_entity_id"); - - b.Property("StakeVaultEntityId") - .HasColumnType("bigint") - .HasColumnName("stake_vault_entity_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("RoyaltyVaultOfEntityId") - .HasColumnType("bigint") - .HasColumnName("royalty_vault_of_entity_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - 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.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("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") - .HasFilter("discriminator = 'affected_global_entity'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); - }); - - 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.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.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/20231101101154_InversePendingTransactionPayloadRelationship.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231101101154_InversePendingTransactionPayloadRelationship.cs deleted file mode 100644 index edb828d59..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231101101154_InversePendingTransactionPayloadRelationship.cs +++ /dev/null @@ -1,156 +0,0 @@ -/* 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 InversePendingTransactionPayloadRelationship : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_pending_transactions_pending_transaction_payloads_payload_id", - table: "pending_transactions"); - - migrationBuilder.DropIndex( - name: "IX_pending_transactions_payload_id", - table: "pending_transactions"); - - migrationBuilder.AlterColumn( - name: "payload_id", - table: "pending_transactions", - type: "bigint", - nullable: true, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AddColumn( - name: "pending_transaction_id", - table: "pending_transaction_payloads", - type: "bigint", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_pending_transaction_payloads_pending_transaction_id", - table: "pending_transaction_payloads", - column: "pending_transaction_id", - unique: true); - - migrationBuilder.AddForeignKey( - name: "FK_pending_transaction_payloads_pending_transactions_pending_t~", - table: "pending_transaction_payloads", - column: "pending_transaction_id", - principalTable: "pending_transactions", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.Sql("UPDATE pending_transaction_payloads ptp SET pending_transaction_id = pt.id FROM pending_transactions pt WHERE pt.payload_id = ptp.id;"); - migrationBuilder.Sql("DELETE FROM pending_transaction_payloads WHERE id IN (SELECT ptp.id FROM pending_transaction_payloads ptp LEFT JOIN pending_transactions pt ON ptp.id = pt.payload_id WHERE pt.id IS NULL);"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_pending_transaction_payloads_pending_transactions_pending_t~", - table: "pending_transaction_payloads"); - - migrationBuilder.DropIndex( - name: "IX_pending_transaction_payloads_pending_transaction_id", - table: "pending_transaction_payloads"); - - migrationBuilder.DropColumn( - name: "pending_transaction_id", - table: "pending_transaction_payloads"); - - migrationBuilder.AlterColumn( - name: "payload_id", - table: "pending_transactions", - type: "bigint", - nullable: false, - defaultValue: 0L, - oldClrType: typeof(long), - oldType: "bigint", - oldNullable: true); - - migrationBuilder.CreateIndex( - name: "IX_pending_transactions_payload_id", - table: "pending_transactions", - column: "payload_id"); - - migrationBuilder.AddForeignKey( - name: "FK_pending_transactions_pending_transaction_payloads_payload_id", - table: "pending_transactions", - column: "payload_id", - principalTable: "pending_transaction_payloads", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.Designer.cs deleted file mode 100644 index d2add6540..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.Designer.cs +++ /dev/null @@ -1,2344 +0,0 @@ -/* 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.Addressing; -using RadixDlt.NetworkGateway.Abstractions.Model; -using RadixDlt.NetworkGateway.PostgresIntegration; -using RadixDlt.NetworkGateway.PostgresIntegration.Models; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - [DbContext(typeof(MigrationsDbContext))] - [Migration("20231130132946_AddNetworkHrpSuffixToNetworkConfiguration")] - partial class AddNetworkHrpSuffixToNetworkConfiguration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .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, "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" }); - 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" }); - 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" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_status", new[] { "succeeded", "failed" }); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "ledger_transaction_type", new[] { "genesis", "user", "round_update" }); - 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, "state_type", new[] { "json", "sbor" }); - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - 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.AccountResourcePreferenceRuleHistory", 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_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>("CorrelatedEntities") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("correlated_entities"); - - 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") - .HasFilter("discriminator = 'non_fungible'"); - - 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.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("Key") - .IsRequired() - .HasColumnType("bytea") - .HasColumnName("key"); - - b.Property("KeyValueStoreEntityId") - .HasColumnType("bigint") - .HasColumnName("key_value_store_entity_id"); - - b.Property("Value") - .HasColumnType("bytea") - .HasColumnName("value"); - - b.HasKey("Id"); - - b.HasIndex("KeyValueStoreEntityId", "Key", "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("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.NetworkConfiguration", b => - { - b.Property("Id") - .HasColumnType("integer") - .HasColumnName("id"); - - b.Property("AddressTypeDefinitions") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("address_type_definitions"); - - b.Property("GenesisEpoch") - .HasColumnType("bigint") - .HasColumnName("genesis_epoch"); - - b.Property("GenesisRound") - .HasColumnType("bigint") - .HasColumnName("genesis_round"); - - b.Property("HrpDefinition") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("hrp_definition"); - - b.Property("NetworkHrpSuffix") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_hrp_suffix"); - - b.Property("NetworkId") - .HasColumnType("smallint") - .HasColumnName("network_id"); - - b.Property("NetworkName") - .IsRequired() - .HasColumnType("text") - .HasColumnName("network_name"); - - b.Property("WellKnownAddresses") - .IsRequired() - .HasColumnType("jsonb") - .HasColumnName("well_known_addresses"); - - b.HasKey("Id"); - - b.ToTable("network_configuration"); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.NonFungibleIdData", 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(); - - b.ToTable("non_fungible_id_data"); - }); - - 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("NonFungibleIdDataId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_id_data_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleIdDataId", "FromStateVersion"); - - b.ToTable("non_fungible_id_data_history"); - }); - - 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_data_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.NonFungibleIdStoreHistory", 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>("NonFungibleIdDataIds") - .IsRequired() - .HasColumnType("bigint[]") - .HasColumnName("non_fungible_id_data_ids"); - - b.Property("NonFungibleResourceEntityId") - .HasColumnType("bigint") - .HasColumnName("non_fungible_resource_entity_id"); - - b.HasKey("Id"); - - b.HasIndex("NonFungibleResourceEntityId", "FromStateVersion"); - - b.ToTable("non_fungible_id_store_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.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.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("PackageEntityId") - .HasColumnType("bigint") - .HasColumnName("package_entity_id"); - - 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("numeric(20,0)") - .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.SchemaHistory", 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", "FromStateVersion"); - - b.HasIndex("SchemaHash", "FromStateVersion"); - - b.ToTable("schema_history"); - }); - - 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.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.ValidatorEmissionStatistics", 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("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.ToTable("validator_emission_statistics"); - }); - - 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.GlobalAccessControllerEntity", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.ToTable("entities"); - - b.HasDiscriminator().HasValue(EntityType.GlobalAccountComponent); - }); - - modelBuilder.Entity("RadixDlt.NetworkGateway.PostgresIntegration.Models.GlobalConsensusManager", b => - { - b.HasBaseType("RadixDlt.NetworkGateway.PostgresIntegration.Models.Entity"); - - b.Property("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("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.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("NonFungibleIdType") - .HasColumnType("non_fungible_id_type") - .HasColumnName("non_fungible_id_type"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("VmType") - .HasColumnType("package_vm_type") - .HasColumnName("vm_type"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("LockedOwnerStakeUnitVault") - .HasColumnType("bigint") - .HasColumnName("locked_owner_stake_unit_vault_entity_id"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("PendingOwnerStakeUnitUnlockVault") - .HasColumnType("bigint") - .HasColumnName("pending_owner_stake_unit_unlock_vault_entity_id"); - - b.Property("PendingXrdWithdrawVault") - .HasColumnType("bigint") - .HasColumnName("pending_xrd_withdraw_vault_entity_id"); - - b.Property("StakeVaultEntityId") - .HasColumnType("bigint") - .HasColumnName("stake_vault_entity_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - b.Property("RoyaltyVaultOfEntityId") - .HasColumnType("bigint") - .HasColumnName("royalty_vault_of_entity_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - 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("BlueprintName") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_name"); - - b.Property("BlueprintVersion") - .IsRequired() - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("text") - .HasColumnName("blueprint_version"); - - b.Property("PackageId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("package_id"); - - b.Property("ResourceEntityId") - .ValueGeneratedOnUpdateSometimes() - .HasColumnType("bigint") - .HasColumnName("resource_entity_id"); - - 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.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("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") - .HasFilter("discriminator = 'affected_global_entity'"); - - b.ToTable("ledger_transaction_markers"); - - b.HasDiscriminator().HasValue(LedgerTransactionMarkerType.AffectedGlobalEntity); - }); - - 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.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.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/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.cs deleted file mode 100644 index 3be348cc1..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231130132946_AddNetworkHrpSuffixToNetworkConfiguration.cs +++ /dev/null @@ -1,101 +0,0 @@ -/* 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 AddNetworkHrpSuffixToNetworkConfiguration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "network_hrp_suffix", - table: "network_configuration", - type: "text", - nullable: true, - defaultValue: null); - - migrationBuilder.Sql("update network_configuration set network_hrp_suffix = (select substring(recordset.\"HrpPrefix\"::text,'_(.+)') from network_configuration, jsonb_to_recordset(address_type_definitions) as recordset(\"HrpPrefix\" TEXT) WHERE recordset.\"HrpPrefix\" like '%account%' limit 1)"); - - migrationBuilder.AlterColumn( - name: "network_hrp_suffix", - table: "network_configuration", - type: "text", - nullable: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "network_hrp_suffix", - table: "network_configuration"); - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.cs deleted file mode 100644 index 41bb930ce..000000000 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.cs +++ /dev/null @@ -1,94 +0,0 @@ -/* 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.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; -using RadixDlt.NetworkGateway.Abstractions.Model; - -#nullable disable - -namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations -{ - /// - public partial class TrackComponentAssignedModules : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "assigned_module_ids", - table: "entities", - type: "module_id[]", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "assigned_module_ids", - table: "entities"); - } - } -} diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.Designer.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240104122654_InitialCreate.Designer.cs similarity index 99% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.Designer.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240104122654_InitialCreate.Designer.cs index b7aa67d48..6d88d07ef 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20231220153048_TrackComponentAssignedModules.Designer.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240104122654_InitialCreate.Designer.cs @@ -81,8 +81,8 @@ namespace RadixDlt.NetworkGateway.PostgresIntegration.Migrations { [DbContext(typeof(MigrationsDbContext))] - [Migration("20231220153048_TrackComponentAssignedModules")] - partial class TrackComponentAssignedModules + [Migration("20240104122654_InitialCreate")] + partial class InitialCreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20230922041840_InitialCreate.cs b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240104122654_InitialCreate.cs similarity index 98% rename from src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20230922041840_InitialCreate.cs rename to src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240104122654_InitialCreate.cs index 2825b6523..bd1401305 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20230922041840_InitialCreate.cs +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/20240104122654_InitialCreate.cs @@ -62,7 +62,7 @@ * permissions under this License. */ -using System; +using System; using System.Collections.Generic; using System.Numerics; using Microsoft.EntityFrameworkCore.Migrations; @@ -168,6 +168,7 @@ protected override void Up(MigrationBuilder migrationBuilder) package_id = table.Column(type: "bigint", nullable: true), blueprint_name = table.Column(type: "text", nullable: true), blueprint_version = table.Column(type: "text", nullable: true), + assigned_module_ids = table.Column>(type: "module_id[]", nullable: true), divisibility = table.Column(type: "integer", nullable: true), non_fungible_id_type = table.Column(type: "non_fungible_id_type", nullable: true), vm_type = table.Column(type: "package_vm_type", nullable: true), @@ -451,6 +452,7 @@ protected override void Up(MigrationBuilder migrationBuilder) id = table.Column(type: "integer", nullable: false), network_id = table.Column(type: "smallint", nullable: false), network_name = table.Column(type: "text", nullable: false), + network_hrp_suffix = table.Column(type: "text", nullable: false), hrp_definition = table.Column(type: "jsonb", nullable: false), well_known_addresses = table.Column(type: "jsonb", nullable: false), address_type_definitions = table.Column(type: "jsonb", nullable: false), @@ -581,16 +583,34 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "pending_transaction_payloads", + name: "pending_transactions", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - notarized_transaction_blob = table.Column(type: "bytea", nullable: false) + payload_hash = table.Column(type: "text", nullable: false), + intent_hash = table.Column(type: "text", nullable: false), + end_epoch_exclusive = table.Column(type: "numeric(20,0)", nullable: false), + payload_id = table.Column(type: "bigint", nullable: true), + xmin = table.Column(type: "xid", rowVersion: true, nullable: false), + payload_status = table.Column(type: "pending_transaction_payload_ledger_status", nullable: false), + intent_status = table.Column(type: "pending_transaction_intent_ledger_status", nullable: false), + initial_rejection_reason = table.Column(type: "text", nullable: true), + latest_rejection_reason = table.Column(type: "text", nullable: true), + latest_rejection_timestamp = table.Column(type: "timestamp with time zone", nullable: true), + commit_timestamp = table.Column(type: "timestamp with time zone", nullable: true), + resubmit_from_timestamp = table.Column(type: "timestamp with time zone", nullable: true), + handling_status_reason = table.Column(type: "text", nullable: true), + first_submitted_to_gateway_timestamp = table.Column(type: "timestamp with time zone", nullable: false), + node_submission_count = table.Column(type: "integer", nullable: false), + latest_node_submission_timestamp = table.Column(type: "timestamp with time zone", nullable: true), + latest_submitted_to_node_name = table.Column(type: "text", nullable: true), + latest_node_submission_was_accepted = table.Column(type: "boolean", nullable: false), + last_submit_error = table.Column(type: "text", nullable: true) }, constraints: table => { - table.PrimaryKey("PK_pending_transaction_payloads", x => x.id); + table.PrimaryKey("PK_pending_transactions", x => x.id); }); migrationBuilder.CreateTable( @@ -681,38 +701,21 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "pending_transactions", + name: "pending_transaction_payloads", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - payload_hash = table.Column(type: "text", nullable: false), - intent_hash = table.Column(type: "text", nullable: false), - end_epoch_exclusive = table.Column(type: "numeric(20,0)", nullable: false), - payload_id = table.Column(type: "bigint", nullable: false), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false), - payload_status = table.Column(type: "pending_transaction_payload_ledger_status", nullable: false), - intent_status = table.Column(type: "pending_transaction_intent_ledger_status", nullable: false), - initial_rejection_reason = table.Column(type: "text", nullable: true), - latest_rejection_reason = table.Column(type: "text", nullable: true), - latest_rejection_timestamp = table.Column(type: "timestamp with time zone", nullable: true), - commit_timestamp = table.Column(type: "timestamp with time zone", nullable: true), - resubmit_from_timestamp = table.Column(type: "timestamp with time zone", nullable: true), - handling_status_reason = table.Column(type: "text", nullable: true), - first_submitted_to_gateway_timestamp = table.Column(type: "timestamp with time zone", nullable: false), - node_submission_count = table.Column(type: "integer", nullable: false), - latest_node_submission_timestamp = table.Column(type: "timestamp with time zone", nullable: true), - latest_submitted_to_node_name = table.Column(type: "text", nullable: true), - latest_node_submission_was_accepted = table.Column(type: "boolean", nullable: false), - last_submit_error = table.Column(type: "text", nullable: true) + pending_transaction_id = table.Column(type: "bigint", nullable: true), + notarized_transaction_blob = table.Column(type: "bytea", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_pending_transactions", x => x.id); + table.PrimaryKey("PK_pending_transaction_payloads", x => x.id); table.ForeignKey( - name: "FK_pending_transactions_pending_transaction_payloads_payload_id", - column: x => x.payload_id, - principalTable: "pending_transaction_payloads", + name: "FK_pending_transaction_payloads_pending_transactions_pending_t~", + column: x => x.pending_transaction_id, + principalTable: "pending_transactions", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); @@ -948,6 +951,12 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "package_code_history", columns: new[] { "package_entity_id", "from_state_version" }); + migrationBuilder.CreateIndex( + name: "IX_pending_transaction_payloads_pending_transaction_id", + table: "pending_transaction_payloads", + column: "pending_transaction_id", + unique: true); + migrationBuilder.CreateIndex( name: "IX_pending_transactions_first_submitted_to_gateway_timestamp", table: "pending_transactions", @@ -964,11 +973,6 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "payload_hash", unique: true); - migrationBuilder.CreateIndex( - name: "IX_pending_transactions_payload_id", - table: "pending_transactions", - column: "payload_id"); - migrationBuilder.CreateIndex( name: "IX_pending_transactions_resubmit_from_timestamp", table: "pending_transactions", @@ -1104,7 +1108,7 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "package_code_history"); migrationBuilder.DropTable( - name: "pending_transactions"); + name: "pending_transaction_payloads"); migrationBuilder.DropTable( name: "resource_entity_supply_history"); @@ -1122,7 +1126,7 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "validator_emission_statistics"); migrationBuilder.DropTable( - name: "pending_transaction_payloads"); + name: "pending_transactions"); migrationBuilder.DropTable( name: "validator_public_key_history"); diff --git a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql index 175b25bd8..3d9562cd1 100644 --- a/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql +++ b/src/RadixDlt.NetworkGateway.PostgresIntegration/Migrations/IdempotentApplyMigrations.sql @@ -9,7 +9,7 @@ START TRANSACTION; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TYPE account_default_deposit_rule AS ENUM ('accept', 'reject', 'allow_existing'); CREATE TYPE account_resource_preference_rule AS ENUM ('allowed', 'disallowed'); CREATE TYPE entity_type AS ENUM ('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'); @@ -33,7 +33,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE account_default_deposit_rule_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -46,7 +46,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE account_resource_preference_rule_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -61,7 +61,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE component_method_royalty_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -76,7 +76,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entities ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -91,6 +91,7 @@ BEGIN package_id bigint NULL, blueprint_name text NULL, blueprint_version text NULL, + assigned_module_ids module_id[] NULL, divisibility integer NULL, non_fungible_id_type non_fungible_id_type NULL, vm_type package_vm_type NULL, @@ -107,7 +108,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_metadata_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -120,7 +121,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_metadata_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -136,7 +137,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_resource_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -152,7 +153,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_resource_aggregated_vaults_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -168,7 +169,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_resource_vault_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -182,7 +183,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_role_assignments_aggregate_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -196,7 +197,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_role_assignments_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -212,7 +213,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_role_assignments_owner_role_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -225,7 +226,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE entity_vault_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -244,7 +245,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE key_value_store_entry_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -260,7 +261,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE key_value_store_schema_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -280,7 +281,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE ledger_transaction_markers ( id bigint GENERATED BY DEFAULT AS IDENTITY, state_version bigint NOT NULL, @@ -298,7 +299,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE ledger_transactions ( state_version bigint NOT NULL, epoch bigint NOT NULL, @@ -343,11 +344,12 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE network_configuration ( id integer NOT NULL, network_id smallint NOT NULL, network_name text NOT NULL, + network_hrp_suffix text NOT NULL, hrp_definition jsonb NOT NULL, well_known_addresses jsonb NOT NULL, address_type_definitions jsonb NOT NULL, @@ -360,7 +362,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE non_fungible_id_data ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -373,7 +375,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE non_fungible_id_data_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -388,7 +390,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE non_fungible_id_location_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -401,7 +403,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE non_fungible_id_store_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -414,7 +416,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE non_fungible_schema_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -430,7 +432,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE package_blueprint_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -450,7 +452,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE package_code_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -464,18 +466,35 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN - CREATE TABLE pending_transaction_payloads ( + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN + CREATE TABLE pending_transactions ( id bigint GENERATED BY DEFAULT AS IDENTITY, - notarized_transaction_blob bytea NOT NULL, - CONSTRAINT "PK_pending_transaction_payloads" PRIMARY KEY (id) + payload_hash text NOT NULL, + intent_hash text NOT NULL, + end_epoch_exclusive numeric(20,0) NOT NULL, + payload_id bigint NULL, + payload_status pending_transaction_payload_ledger_status NOT NULL, + intent_status pending_transaction_intent_ledger_status NOT NULL, + initial_rejection_reason text NULL, + latest_rejection_reason text NULL, + latest_rejection_timestamp timestamp with time zone NULL, + commit_timestamp timestamp with time zone NULL, + resubmit_from_timestamp timestamp with time zone NULL, + handling_status_reason text NULL, + first_submitted_to_gateway_timestamp timestamp with time zone NOT NULL, + node_submission_count integer NOT NULL, + latest_node_submission_timestamp timestamp with time zone NULL, + latest_submitted_to_node_name text NULL, + latest_node_submission_was_accepted boolean NOT NULL, + last_submit_error text NULL, + CONSTRAINT "PK_pending_transactions" PRIMARY KEY (id) ); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE resource_entity_supply_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -490,7 +509,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE schema_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -504,7 +523,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE state_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -523,7 +542,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE validator_emission_statistics ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -538,7 +557,7 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE validator_public_key_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -552,36 +571,20 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN - CREATE TABLE pending_transactions ( + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN + CREATE TABLE pending_transaction_payloads ( id bigint GENERATED BY DEFAULT AS IDENTITY, - payload_hash text NOT NULL, - intent_hash text NOT NULL, - end_epoch_exclusive numeric(20,0) NOT NULL, - payload_id bigint NOT NULL, - payload_status pending_transaction_payload_ledger_status NOT NULL, - intent_status pending_transaction_intent_ledger_status NOT NULL, - initial_rejection_reason text NULL, - latest_rejection_reason text NULL, - latest_rejection_timestamp timestamp with time zone NULL, - commit_timestamp timestamp with time zone NULL, - resubmit_from_timestamp timestamp with time zone NULL, - handling_status_reason text NULL, - first_submitted_to_gateway_timestamp timestamp with time zone NOT NULL, - node_submission_count integer NOT NULL, - latest_node_submission_timestamp timestamp with time zone NULL, - latest_submitted_to_node_name text NULL, - latest_node_submission_was_accepted boolean NOT NULL, - last_submit_error text NULL, - CONSTRAINT "PK_pending_transactions" PRIMARY KEY (id), - CONSTRAINT "FK_pending_transactions_pending_transaction_payloads_payload_id" FOREIGN KEY (payload_id) REFERENCES pending_transaction_payloads (id) ON DELETE CASCADE + pending_transaction_id bigint NULL, + notarized_transaction_blob bytea NOT NULL, + CONSTRAINT "PK_pending_transaction_payloads" PRIMARY KEY (id), + CONSTRAINT "FK_pending_transaction_payloads_pending_transactions_pending_t~" FOREIGN KEY (pending_transaction_id) REFERENCES pending_transactions (id) ON DELETE CASCADE ); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE TABLE validator_active_set_history ( id bigint GENERATED BY DEFAULT AS IDENTITY, from_state_version bigint NOT NULL, @@ -596,500 +599,387 @@ END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_account_default_deposit_rule_history_account_entity_id_from~" ON account_default_deposit_rule_history (account_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_account_resource_preference_rule_history_account_entity_id_~" ON account_resource_preference_rule_history (account_entity_id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_component_method_royalty_entry_history_entity_id_from_state~" ON component_method_royalty_entry_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_component_method_royalty_entry_history_entity_id_method_nam~" ON component_method_royalty_entry_history (entity_id, method_name, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE UNIQUE INDEX "IX_entities_address" ON entities (address); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entities_from_state_version" ON entities (from_state_version) WHERE discriminator = 'global_validator'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_metadata_aggregate_history_entity_id_from_state_vers~" ON entity_metadata_aggregate_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_metadata_history_entity_id_key_from_state_version" ON entity_metadata_history (entity_id, key, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_resource_aggregate_history_entity_id_from_state_vers~" ON entity_resource_aggregate_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_resource_aggregated_vaults_history_entity_id_resourc~" ON entity_resource_aggregated_vaults_history (entity_id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_resource_vault_aggregate_history_entity_id_resource_~" ON entity_resource_vault_aggregate_history (entity_id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_role_assignments_aggregate_history_entity_id_from_st~" ON entity_role_assignments_aggregate_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_role_assignments_entry_history_entity_id_key_role_ke~" ON entity_role_assignments_entry_history (entity_id, key_role, key_module, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_role_assignments_owner_role_history_entity_id_from_s~" ON entity_role_assignments_owner_role_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_vault_history_global_entity_id_from_state_version" ON entity_vault_history (global_entity_id, from_state_version) WHERE is_royalty_vault = true; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_vault_history_global_entity_id_vault_entity_id_from_~" ON entity_vault_history (global_entity_id, vault_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_vault_history_id_resource_entity_id_from_state_versi~" ON entity_vault_history (id, resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_vault_history_owner_entity_id_from_state_version" ON entity_vault_history (owner_entity_id, from_state_version) WHERE is_royalty_vault = true; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_vault_history_owner_entity_id_vault_entity_id_from_s~" ON entity_vault_history (owner_entity_id, vault_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_entity_vault_history_vault_entity_id_from_state_version" ON entity_vault_history (vault_entity_id, from_state_version) WHERE discriminator = 'non_fungible'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_key_value_store_entry_history_key_value_store_entity_id_key~" ON key_value_store_entry_history (key_value_store_entity_id, key, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_key_value_store_schema_history_key_value_store_entity_id_fr~" ON key_value_store_schema_history (key_value_store_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_entity_id_state_version" ON ledger_transaction_markers (entity_id, state_version) WHERE discriminator = 'affected_global_entity'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_event_type_entity_id_state_versi~" ON ledger_transaction_markers (event_type, entity_id, state_version) WHERE discriminator = 'event'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_operation_type_entity_id_state_v~" ON ledger_transaction_markers (operation_type, entity_id, state_version) WHERE discriminator = 'manifest_address'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_origin_type_state_version" ON ledger_transaction_markers (origin_type, state_version) WHERE discriminator = 'origin'; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_ledger_transaction_markers_state_version" ON ledger_transaction_markers (state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE UNIQUE INDEX "IX_ledger_transactions_epoch_round_in_epoch" ON ledger_transactions (epoch, round_in_epoch) WHERE index_in_round = 0; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_ledger_transactions_intent_hash" ON ledger_transactions USING hash (intent_hash) WHERE intent_hash IS NOT NULL; END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_ledger_transactions_round_timestamp" ON ledger_transactions (round_timestamp); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_non_fungible_id_data_non_fungible_resource_entity_id_from_s~" ON non_fungible_id_data (non_fungible_resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE UNIQUE INDEX "IX_non_fungible_id_data_non_fungible_resource_entity_id_non_fu~" ON non_fungible_id_data (non_fungible_resource_entity_id, non_fungible_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_non_fungible_id_data_history_non_fungible_id_data_id_from_s~" ON non_fungible_id_data_history (non_fungible_id_data_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_non_fungible_id_location_history_non_fungible_id_data_id_fr~" ON non_fungible_id_location_history (non_fungible_id_data_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_non_fungible_id_store_history_non_fungible_resource_entity_~" ON non_fungible_id_store_history (non_fungible_resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_non_fungible_schema_history_resource_entity_id_from_state_v~" ON non_fungible_schema_history (resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_package_blueprint_history_package_entity_id_from_state_vers~" ON package_blueprint_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_package_blueprint_history_package_entity_id_name_version_fr~" ON package_blueprint_history (package_entity_id, name, version, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_package_code_history_package_entity_id_from_state_version" ON package_code_history (package_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN - CREATE INDEX "IX_pending_transactions_first_submitted_to_gateway_timestamp" ON pending_transactions (first_submitted_to_gateway_timestamp); + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN + CREATE UNIQUE INDEX "IX_pending_transaction_payloads_pending_transaction_id" ON pending_transaction_payloads (pending_transaction_id); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN - CREATE INDEX "IX_pending_transactions_intent_hash" ON pending_transactions (intent_hash); + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN + CREATE INDEX "IX_pending_transactions_first_submitted_to_gateway_timestamp" ON pending_transactions (first_submitted_to_gateway_timestamp); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN - CREATE UNIQUE INDEX "IX_pending_transactions_payload_hash" ON pending_transactions (payload_hash); + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN + CREATE INDEX "IX_pending_transactions_intent_hash" ON pending_transactions (intent_hash); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN - CREATE INDEX "IX_pending_transactions_payload_id" ON pending_transactions (payload_id); + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN + CREATE UNIQUE INDEX "IX_pending_transactions_payload_hash" ON pending_transactions (payload_hash); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_pending_transactions_resubmit_from_timestamp" ON pending_transactions (resubmit_from_timestamp); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_resource_entity_supply_history_resource_entity_id_from_stat~" ON resource_entity_supply_history (resource_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_schema_history_entity_id_from_state_version" ON schema_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_schema_history_schema_hash_from_state_version" ON schema_history (schema_hash, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_state_history_entity_id_from_state_version" ON state_history (entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_validator_active_set_history_epoch" ON validator_active_set_history (epoch); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_validator_active_set_history_from_state_version" ON validator_active_set_history (from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_validator_active_set_history_validator_public_key_history_id" ON validator_active_set_history (validator_public_key_history_id); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_validator_emission_statistics_validator_entity_id_epoch_num~" ON validator_emission_statistics (validator_entity_id, epoch_number); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_validator_public_key_history_validator_entity_id_from_state~" ON validator_public_key_history (validator_entity_id, from_state_version); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN CREATE INDEX "IX_validator_public_key_history_validator_entity_id_key_type_k~" ON validator_public_key_history (validator_entity_id, key_type, key); END IF; END $EF$; DO $EF$ BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20230922041840_InitialCreate') THEN - INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20230922041840_InitialCreate', '7.0.11'); - END IF; -END $EF$; -COMMIT; - -START TRANSACTION; - - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - ALTER TABLE pending_transactions DROP CONSTRAINT "FK_pending_transactions_pending_transaction_payloads_payload_id"; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - DROP INDEX "IX_pending_transactions_payload_id"; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - ALTER TABLE pending_transactions ALTER COLUMN payload_id DROP NOT NULL; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - ALTER TABLE pending_transaction_payloads ADD pending_transaction_id bigint NULL; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - CREATE UNIQUE INDEX "IX_pending_transaction_payloads_pending_transaction_id" ON pending_transaction_payloads (pending_transaction_id); - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - ALTER TABLE pending_transaction_payloads ADD CONSTRAINT "FK_pending_transaction_payloads_pending_transactions_pending_t~" FOREIGN KEY (pending_transaction_id) REFERENCES pending_transactions (id) ON DELETE CASCADE; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - UPDATE pending_transaction_payloads ptp SET pending_transaction_id = pt.id FROM pending_transactions pt WHERE pt.payload_id = ptp.id; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - DELETE FROM pending_transaction_payloads WHERE id IN (SELECT ptp.id FROM pending_transaction_payloads ptp LEFT JOIN pending_transactions pt ON ptp.id = pt.payload_id WHERE pt.id IS NULL); - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231101101154_InversePendingTransactionPayloadRelationship') THEN - INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20231101101154_InversePendingTransactionPayloadRelationship', '7.0.11'); - END IF; -END $EF$; -COMMIT; - -START TRANSACTION; - - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231130132946_AddNetworkHrpSuffixToNetworkConfiguration') THEN - ALTER TABLE network_configuration ADD network_hrp_suffix text NULL; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231130132946_AddNetworkHrpSuffixToNetworkConfiguration') THEN - update network_configuration set network_hrp_suffix = (select substring(recordset."HrpPrefix"::text,'_(.+)') from network_configuration, jsonb_to_recordset(address_type_definitions) as recordset("HrpPrefix" TEXT) WHERE recordset."HrpPrefix" like '%account%' limit 1) - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231130132946_AddNetworkHrpSuffixToNetworkConfiguration') THEN - INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20231130132946_AddNetworkHrpSuffixToNetworkConfiguration', '7.0.11'); - END IF; -END $EF$; -COMMIT; - -START TRANSACTION; - - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231220153048_TrackComponentAssignedModules') THEN - ALTER TABLE entities ADD assigned_module_ids module_id[] NULL; - END IF; -END $EF$; - -DO $EF$ -BEGIN - IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20231220153048_TrackComponentAssignedModules') THEN + IF NOT EXISTS(SELECT 1 FROM "__EFMigrationsHistory" WHERE "MigrationId" = '20240104122654_InitialCreate') THEN INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") - VALUES ('20231220153048_TrackComponentAssignedModules', '7.0.11'); + VALUES ('20240104122654_InitialCreate', '7.0.11'); END IF; END $EF$; COMMIT;