diff --git a/Tzkt.Data/Migrations/20210714124853_Initial.Designer.cs b/Tzkt.Data/Migrations/20210714124853_Initial.Designer.cs deleted file mode 100644 index 817427094..000000000 --- a/Tzkt.Data/Migrations/20210714124853_Initial.Designer.cs +++ /dev/null @@ -1,2852 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Tzkt.Data; - -namespace Tzkt.Data.Migrations -{ - [DbContext(typeof(TzktContext))] - [Migration("20210714124853_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character(36)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("ContractsCount") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("DelegationLevel") - .HasColumnType("integer"); - - b.Property("DelegationsCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationsCount") - .HasColumnType("integer"); - - b.Property("OriginationsCount") - .HasColumnType("integer"); - - b.Property("RevealsCount") - .HasColumnType("integer"); - - b.Property("Staked") - .HasColumnType("boolean"); - - b.Property("TransactionsCount") - .HasColumnType("integer"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("DelegateId"); - - b.HasIndex("FirstLevel"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Metadata") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Staked"); - - b.HasIndex("Type"); - - b.ToTable("Accounts"); - - b.HasDiscriminator("Type"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("ActivationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.AppState", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountCounter") - .HasColumnType("integer"); - - b.Property("AccountsCount") - .HasColumnType("integer"); - - b.Property("ActivationOpsCount") - .HasColumnType("integer"); - - b.Property("BallotOpsCount") - .HasColumnType("integer"); - - b.Property("BigMapCounter") - .HasColumnType("integer"); - - b.Property("BigMapKeyCounter") - .HasColumnType("integer"); - - b.Property("BigMapUpdateCounter") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("Chain") - .HasColumnType("text"); - - b.Property("ChainId") - .HasColumnType("text"); - - b.Property("CommitmentsCount") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("CyclesCount") - .HasColumnType("integer"); - - b.Property("DelegationOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingOpsCount") - .HasColumnType("integer"); - - b.Property("EndorsementOpsCount") - .HasColumnType("integer"); - - b.Property("Hash") - .HasColumnType("text"); - - b.Property("KnownHead") - .HasColumnType("integer"); - - b.Property("LastSync") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerCounter") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationOpsCount") - .HasColumnType("integer"); - - b.Property("NextProtocol") - .HasColumnType("text"); - - b.Property("NonceRevelationOpsCount") - .HasColumnType("integer"); - - b.Property("OperationCounter") - .HasColumnType("integer"); - - b.Property("OriginationOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Protocol") - .HasColumnType("text"); - - b.Property("ProtocolsCount") - .HasColumnType("integer"); - - b.Property("QuoteBtc") - .HasColumnType("double precision"); - - b.Property("QuoteCny") - .HasColumnType("double precision"); - - b.Property("QuoteEth") - .HasColumnType("double precision"); - - b.Property("QuoteEur") - .HasColumnType("double precision"); - - b.Property("QuoteJpy") - .HasColumnType("double precision"); - - b.Property("QuoteKrw") - .HasColumnType("double precision"); - - b.Property("QuoteLevel") - .HasColumnType("integer"); - - b.Property("QuoteUsd") - .HasColumnType("double precision"); - - b.Property("RevealOpsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltyOpsCount") - .HasColumnType("integer"); - - b.Property("ScriptCounter") - .HasColumnType("integer"); - - b.Property("StorageCounter") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("TransactionOpsCount") - .HasColumnType("integer"); - - b.Property("VotingEpoch") - .HasColumnType("integer"); - - b.Property("VotingPeriod") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("AppState"); - - b.HasData( - new - { - Id = -1, - AccountCounter = 0, - AccountsCount = 0, - ActivationOpsCount = 0, - BallotOpsCount = 0, - BigMapCounter = 0, - BigMapKeyCounter = 0, - BigMapUpdateCounter = 0, - BlocksCount = 0, - CommitmentsCount = 0, - Cycle = -1, - CyclesCount = 0, - DelegationOpsCount = 0, - DoubleBakingOpsCount = 0, - DoubleEndorsingOpsCount = 0, - EndorsementOpsCount = 0, - Hash = "", - KnownHead = 0, - LastSync = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - Level = -1, - ManagerCounter = 0, - MigrationOpsCount = 0, - NextProtocol = "", - NonceRevelationOpsCount = 0, - OperationCounter = 0, - OriginationOpsCount = 0, - ProposalOpsCount = 0, - ProposalsCount = 0, - Protocol = "", - ProtocolsCount = 0, - QuoteBtc = 0.0, - QuoteCny = 0.0, - QuoteEth = 0.0, - QuoteEur = 0.0, - QuoteJpy = 0.0, - QuoteKrw = 0.0, - QuoteLevel = -1, - QuoteUsd = 0.0, - RevealOpsCount = 0, - RevelationPenaltyOpsCount = 0, - ScriptCounter = 0, - StorageCounter = 0, - Timestamp = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - TransactionOpsCount = 0, - VotingEpoch = -1, - VotingPeriod = -1 - }); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakerCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("BlockDeposits") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatedBalance") - .HasColumnType("bigint"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleBakingRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingRewards") - .HasColumnType("bigint"); - - b.Property("EndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("EndorsementRewards") - .HasColumnType("bigint"); - - b.Property("Endorsements") - .HasColumnType("integer"); - - b.Property("ExpectedBlocks") - .HasColumnType("double precision"); - - b.Property("ExpectedEndorsements") - .HasColumnType("double precision"); - - b.Property("ExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("ExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("ExtraBlocks") - .HasColumnType("integer"); - - b.Property("FutureBlockDeposits") - .HasColumnType("bigint"); - - b.Property("FutureBlockRewards") - .HasColumnType("bigint"); - - b.Property("FutureBlocks") - .HasColumnType("integer"); - - b.Property("FutureEndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("FutureEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("FutureEndorsements") - .HasColumnType("integer"); - - b.Property("MissedEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("MissedEndorsements") - .HasColumnType("integer"); - - b.Property("MissedExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlocks") - .HasColumnType("integer"); - - b.Property("MissedOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlocks") - .HasColumnType("integer"); - - b.Property("OwnBlockFees") - .HasColumnType("bigint"); - - b.Property("OwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("OwnBlocks") - .HasColumnType("integer"); - - b.Property("RevelationLostFees") - .HasColumnType("bigint"); - - b.Property("RevelationLostRewards") - .HasColumnType("bigint"); - - b.Property("RevelationRewards") - .HasColumnType("bigint"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsements") - .HasColumnType("integer"); - - b.Property("UncoveredExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlocks") - .HasColumnType("integer"); - - b.Property("UncoveredOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlocks") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Cycle"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Cycle", "BakerId") - .IsUnique(); - - b.ToTable("BakerCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakingRight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("Level"); - - b.HasIndex("Cycle", "BakerId"); - - b.ToTable("BakingRights"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Vote") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("BallotOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMap", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("ActiveKeys") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("KeyType") - .HasColumnType("bytea"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Ptr") - .HasColumnType("integer"); - - b.Property("StoragePath") - .HasColumnType("text"); - - b.Property("Tags") - .HasColumnType("integer"); - - b.Property("TotalKeys") - .HasColumnType("integer"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.Property("ValueType") - .HasColumnType("bytea"); - - b.HasKey("Id"); - - b.HasAlternateKey("Ptr"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Ptr") - .IsUnique(); - - b.ToTable("BigMaps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("JsonKey") - .HasColumnType("jsonb"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("KeyHash") - .HasMaxLength(54) - .HasColumnType("character varying(54)"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("RawKey") - .HasColumnType("bytea"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("JsonKey") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("JsonValue") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("LastLevel"); - - b.HasIndex("BigMapPtr", "Active") - .HasFilter("\"Active\" = true"); - - b.HasIndex("BigMapPtr", "KeyHash"); - - b.ToTable("BigMapKeys"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapUpdate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Action") - .HasColumnType("integer"); - - b.Property("BigMapKeyId") - .HasColumnType("integer"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapKeyId") - .HasFilter("\"BigMapKeyId\" is not null"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("MigrationId") - .HasFilter("\"MigrationId\" is not null"); - - b.HasIndex("OriginationId") - .HasFilter("\"OriginationId\" is not null"); - - b.HasIndex("TransactionId") - .HasFilter("\"TransactionId\" is not null"); - - b.ToTable("BigMapUpdates"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Events") - .HasColumnType("integer"); - - b.Property("Fees") - .HasColumnType("bigint"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeEma") - .HasColumnType("integer"); - - b.Property("LBEscapeVote") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Operations") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("ProtoCode") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("RevelationId") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Validations") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Hash") - .IsUnique(); - - b.HasIndex("Level") - .IsUnique(); - - b.HasIndex("ProtoCode"); - - b.HasIndex("RevelationId") - .IsUnique(); - - b.HasIndex("SoftwareId"); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Commitment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(37) - .HasColumnType("character(37)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("Id") - .IsUnique(); - - b.ToTable("Commitments"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Cycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Seed") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character(64)") - .IsFixedLength(true); - - b.Property("SnapshotIndex") - .HasColumnType("integer"); - - b.Property("SnapshotLevel") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalDelegated") - .HasColumnType("bigint"); - - b.Property("TotalDelegators") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("TotalStaking") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("Cycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("PrevDelegateId") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("PrevDelegateId"); - - b.HasIndex("SenderId"); - - b.ToTable("DelegationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegatorCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatorId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("DelegatorId"); - - b.HasIndex("Cycle", "BakerId"); - - b.HasIndex("Cycle", "DelegatorId") - .IsUnique(); - - b.ToTable("DelegatorCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleBakingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleEndorsingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("EndorsementOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("BalanceChange") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("Level"); - - b.HasIndex("ScriptId"); - - b.HasIndex("StorageId"); - - b.ToTable("MigrationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RevealedLevel") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("NonceRevelationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("ManagerId"); - - b.HasIndex("OpHash"); - - b.HasIndex("ScriptId"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.ToTable("OriginationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Proposal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstPeriod") - .HasColumnType("integer"); - - b.Property("Hash") - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("LastPeriod") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Upvotes") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Hash"); - - b.ToTable("Proposals"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Duplicated") - .HasColumnType("boolean"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("ProposalOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Protocol", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotQuorumMax") - .HasColumnType("integer"); - - b.Property("BallotQuorumMin") - .HasColumnType("integer"); - - b.Property("BlockDeposit") - .HasColumnType("bigint"); - - b.Property("BlockReward0") - .HasColumnType("bigint"); - - b.Property("BlockReward1") - .HasColumnType("bigint"); - - b.Property("BlocksPerCommitment") - .HasColumnType("integer"); - - b.Property("BlocksPerCycle") - .HasColumnType("integer"); - - b.Property("BlocksPerSnapshot") - .HasColumnType("integer"); - - b.Property("BlocksPerVoting") - .HasColumnType("integer"); - - b.Property("ByteCost") - .HasColumnType("integer"); - - b.Property("Code") - .HasColumnType("integer"); - - b.Property("EndorsementDeposit") - .HasColumnType("bigint"); - - b.Property("EndorsementReward0") - .HasColumnType("bigint"); - - b.Property("EndorsementReward1") - .HasColumnType("bigint"); - - b.Property("EndorsersPerBlock") - .HasColumnType("integer"); - - b.Property("FirstCycle") - .HasColumnType("integer"); - - b.Property("FirstCycleLevel") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("HardBlockGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationStorageLimit") - .HasColumnType("integer"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeThreshold") - .HasColumnType("integer"); - - b.Property("LBSubsidy") - .HasColumnType("integer"); - - b.Property("LBSunsetLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("NoRewardCycles") - .HasColumnType("integer"); - - b.Property("OriginationSize") - .HasColumnType("integer"); - - b.Property("PreservedCycles") - .HasColumnType("integer"); - - b.Property("ProposalQuorum") - .HasColumnType("integer"); - - b.Property("RampUpCycles") - .HasColumnType("integer"); - - b.Property("RevelationReward") - .HasColumnType("bigint"); - - b.Property("TimeBetweenBlocks") - .HasColumnType("integer"); - - b.Property("TokensPerRoll") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.ToTable("Protocols"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Quote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Btc") - .HasColumnType("double precision"); - - b.Property("Cny") - .HasColumnType("double precision"); - - b.Property("Eth") - .HasColumnType("double precision"); - - b.Property("Eur") - .HasColumnType("double precision"); - - b.Property("Jpy") - .HasColumnType("double precision"); - - b.Property("Krw") - .HasColumnType("double precision"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Usd") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Quotes"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("RevealOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("LostFees") - .HasColumnType("bigint"); - - b.Property("LostReward") - .HasColumnType("bigint"); - - b.Property("MissedLevel") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.ToTable("RevelationPenaltyOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Script", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CodeSchema") - .HasColumnType("bytea"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("ParameterSchema") - .HasColumnType("bytea"); - - b.Property("StorageSchema") - .HasColumnType("bytea"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Scripts"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.SnapshotBalance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.ToTable("SnapshotBalances"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Software", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("ShortHash") - .IsRequired() - .HasMaxLength(8) - .HasColumnType("character(8)") - .IsFixedLength(true); - - b.HasKey("Id"); - - b.ToTable("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Statistics", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("TotalActivated") - .HasColumnType("bigint"); - - b.Property("TotalBanished") - .HasColumnType("bigint"); - - b.Property("TotalBootstrapped") - .HasColumnType("bigint"); - - b.Property("TotalBurned") - .HasColumnType("bigint"); - - b.Property("TotalCommitments") - .HasColumnType("bigint"); - - b.Property("TotalCreated") - .HasColumnType("bigint"); - - b.Property("TotalFrozen") - .HasColumnType("bigint"); - - b.Property("TotalVested") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle") - .IsUnique() - .HasFilter("\"Cycle\" IS NOT NULL"); - - b.HasIndex("Date") - .IsUnique() - .HasFilter("\"Date\" IS NOT NULL"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Statistics"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Storage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Storages"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Entrypoint") - .HasColumnType("text"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("InternalDelegations") - .HasColumnType("smallint"); - - b.Property("InternalOperations") - .HasColumnType("smallint"); - - b.Property("InternalOriginations") - .HasColumnType("smallint"); - - b.Property("InternalTransactions") - .HasColumnType("smallint"); - - b.Property("JsonParameters") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RawParameters") - .HasColumnType("bytea"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("JsonParameters") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.HasIndex("TargetId"); - - b.ToTable("TransactionOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingPeriod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotsQuorum") - .HasColumnType("integer"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("NayBallots") - .HasColumnType("integer"); - - b.Property("NayRolls") - .HasColumnType("integer"); - - b.Property("ParticipationEma") - .HasColumnType("integer"); - - b.Property("PassBallots") - .HasColumnType("integer"); - - b.Property("PassRolls") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Supermajority") - .HasColumnType("integer"); - - b.Property("TopRolls") - .HasColumnType("integer"); - - b.Property("TopUpvotes") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("UpvotesQuorum") - .HasColumnType("integer"); - - b.Property("YayBallots") - .HasColumnType("integer"); - - b.Property("YayRolls") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Epoch"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("VotingPeriods"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingSnapshot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Period"); - - b.HasIndex("Period", "BakerId") - .IsUnique(); - - b.ToTable("VotingSnapshots"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CreatorId") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("smallint"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Spendable") - .HasColumnType("boolean"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.Property("Tzips") - .HasColumnType("integer"); - - b.Property("WeirdDelegateId") - .HasColumnType("integer"); - - b.HasIndex("CodeHash"); - - b.HasIndex("CreatorId"); - - b.HasIndex("ManagerId"); - - b.HasIndex("TypeHash"); - - b.HasIndex("WeirdDelegateId"); - - b.HasIndex("Type", "Kind") - .HasFilter("\"Type\" = 2"); - - b.HasDiscriminator().HasValue((byte)2); - }); - - modelBuilder.Entity("Tzkt.Data.Models.User", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("Activated") - .HasColumnType("boolean"); - - b.Property("PublicKey") - .HasMaxLength(55) - .HasColumnType("character varying(55)"); - - b.Property("Revealed") - .HasColumnType("boolean"); - - b.HasDiscriminator().HasValue((byte)0); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasBaseType("Tzkt.Data.Models.User"); - - b.Property("ActivationLevel") - .HasColumnType("integer"); - - b.Property("BallotsCount") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("DeactivationLevel") - .HasColumnType("integer"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingCount") - .HasColumnType("integer"); - - b.Property("EndorsementsCount") - .HasColumnType("integer"); - - b.Property("FrozenDeposits") - .HasColumnType("bigint"); - - b.Property("FrozenFees") - .HasColumnType("bigint"); - - b.Property("FrozenRewards") - .HasColumnType("bigint"); - - b.Property("NonceRevelationsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltiesCount") - .HasColumnType("integer"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.HasIndex("SoftwareId"); - - b.HasIndex("Type", "Staked") - .HasFilter("\"Type\" = 1"); - - b.HasDiscriminator().HasValue((byte)1); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany("DelegatedAccounts") - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Block", "FirstBlock") - .WithMany("CreatedAccounts") - .HasForeignKey("FirstLevel") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Delegate"); - - b.Navigation("FirstBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.HasOne("Tzkt.Data.Models.User", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Activations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Ballots") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId"); - - b.HasOne("Tzkt.Data.Models.Protocol", "Protocol") - .WithMany() - .HasForeignKey("ProtoCode") - .HasPrincipalKey("Code") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.NonceRevelationOperation", "Revelation") - .WithOne("RevealedBlock") - .HasForeignKey("Tzkt.Data.Models.Block", "RevelationId") - .HasPrincipalKey("Tzkt.Data.Models.NonceRevelationOperation", "RevealedLevel"); - - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Baker"); - - b.Navigation("Protocol"); - - b.Navigation("Revelation"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Delegations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "PrevDelegate") - .WithMany() - .HasForeignKey("PrevDelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("PrevDelegate"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleBakings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleEndorsings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Endorsements") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Migrations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Account"); - - b.Navigation("Block"); - - b.Navigation("Script"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Revelations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Contract", "Contract") - .WithMany() - .HasForeignKey("ContractId"); - - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Originations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Block"); - - b.Navigation("Contract"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("Manager"); - - b.Navigation("Script"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Proposals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Reveals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("RevelationPenalties") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Transactions") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.HasOne("Tzkt.Data.Models.Account", "Target") - .WithMany() - .HasForeignKey("TargetId"); - - b.Navigation("Block"); - - b.Navigation("Initiator"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Creator") - .WithMany() - .HasForeignKey("CreatorId"); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.User", "WeirdDelegate") - .WithMany() - .HasForeignKey("WeirdDelegateId"); - - b.Navigation("Creator"); - - b.Navigation("Manager"); - - b.Navigation("WeirdDelegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Navigation("Activations"); - - b.Navigation("Ballots"); - - b.Navigation("CreatedAccounts"); - - b.Navigation("Delegations"); - - b.Navigation("DoubleBakings"); - - b.Navigation("DoubleEndorsings"); - - b.Navigation("Endorsements"); - - b.Navigation("Migrations"); - - b.Navigation("Originations"); - - b.Navigation("Proposals"); - - b.Navigation("Reveals"); - - b.Navigation("RevelationPenalties"); - - b.Navigation("Revelations"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Navigation("RevealedBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.Navigation("DelegatedAccounts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Tzkt.Data/Migrations/20210714125513_Triggers.Designer.cs b/Tzkt.Data/Migrations/20210714125513_Triggers.Designer.cs deleted file mode 100644 index fa142aae3..000000000 --- a/Tzkt.Data/Migrations/20210714125513_Triggers.Designer.cs +++ /dev/null @@ -1,2852 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Tzkt.Data; - -namespace Tzkt.Data.Migrations -{ - [DbContext(typeof(TzktContext))] - [Migration("20210714125513_Triggers")] - partial class Triggers - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.6") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character(36)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("ContractsCount") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("DelegationLevel") - .HasColumnType("integer"); - - b.Property("DelegationsCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationsCount") - .HasColumnType("integer"); - - b.Property("OriginationsCount") - .HasColumnType("integer"); - - b.Property("RevealsCount") - .HasColumnType("integer"); - - b.Property("Staked") - .HasColumnType("boolean"); - - b.Property("TransactionsCount") - .HasColumnType("integer"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("DelegateId"); - - b.HasIndex("FirstLevel"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Metadata") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Staked"); - - b.HasIndex("Type"); - - b.ToTable("Accounts"); - - b.HasDiscriminator("Type"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("ActivationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.AppState", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountCounter") - .HasColumnType("integer"); - - b.Property("AccountsCount") - .HasColumnType("integer"); - - b.Property("ActivationOpsCount") - .HasColumnType("integer"); - - b.Property("BallotOpsCount") - .HasColumnType("integer"); - - b.Property("BigMapCounter") - .HasColumnType("integer"); - - b.Property("BigMapKeyCounter") - .HasColumnType("integer"); - - b.Property("BigMapUpdateCounter") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("Chain") - .HasColumnType("text"); - - b.Property("ChainId") - .HasColumnType("text"); - - b.Property("CommitmentsCount") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("CyclesCount") - .HasColumnType("integer"); - - b.Property("DelegationOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingOpsCount") - .HasColumnType("integer"); - - b.Property("EndorsementOpsCount") - .HasColumnType("integer"); - - b.Property("Hash") - .HasColumnType("text"); - - b.Property("KnownHead") - .HasColumnType("integer"); - - b.Property("LastSync") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerCounter") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationOpsCount") - .HasColumnType("integer"); - - b.Property("NextProtocol") - .HasColumnType("text"); - - b.Property("NonceRevelationOpsCount") - .HasColumnType("integer"); - - b.Property("OperationCounter") - .HasColumnType("integer"); - - b.Property("OriginationOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Protocol") - .HasColumnType("text"); - - b.Property("ProtocolsCount") - .HasColumnType("integer"); - - b.Property("QuoteBtc") - .HasColumnType("double precision"); - - b.Property("QuoteCny") - .HasColumnType("double precision"); - - b.Property("QuoteEth") - .HasColumnType("double precision"); - - b.Property("QuoteEur") - .HasColumnType("double precision"); - - b.Property("QuoteJpy") - .HasColumnType("double precision"); - - b.Property("QuoteKrw") - .HasColumnType("double precision"); - - b.Property("QuoteLevel") - .HasColumnType("integer"); - - b.Property("QuoteUsd") - .HasColumnType("double precision"); - - b.Property("RevealOpsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltyOpsCount") - .HasColumnType("integer"); - - b.Property("ScriptCounter") - .HasColumnType("integer"); - - b.Property("StorageCounter") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("TransactionOpsCount") - .HasColumnType("integer"); - - b.Property("VotingEpoch") - .HasColumnType("integer"); - - b.Property("VotingPeriod") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("AppState"); - - b.HasData( - new - { - Id = -1, - AccountCounter = 0, - AccountsCount = 0, - ActivationOpsCount = 0, - BallotOpsCount = 0, - BigMapCounter = 0, - BigMapKeyCounter = 0, - BigMapUpdateCounter = 0, - BlocksCount = 0, - CommitmentsCount = 0, - Cycle = -1, - CyclesCount = 0, - DelegationOpsCount = 0, - DoubleBakingOpsCount = 0, - DoubleEndorsingOpsCount = 0, - EndorsementOpsCount = 0, - Hash = "", - KnownHead = 0, - LastSync = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - Level = -1, - ManagerCounter = 0, - MigrationOpsCount = 0, - NextProtocol = "", - NonceRevelationOpsCount = 0, - OperationCounter = 0, - OriginationOpsCount = 0, - ProposalOpsCount = 0, - ProposalsCount = 0, - Protocol = "", - ProtocolsCount = 0, - QuoteBtc = 0.0, - QuoteCny = 0.0, - QuoteEth = 0.0, - QuoteEur = 0.0, - QuoteJpy = 0.0, - QuoteKrw = 0.0, - QuoteLevel = -1, - QuoteUsd = 0.0, - RevealOpsCount = 0, - RevelationPenaltyOpsCount = 0, - ScriptCounter = 0, - StorageCounter = 0, - Timestamp = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - TransactionOpsCount = 0, - VotingEpoch = -1, - VotingPeriod = -1 - }); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakerCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("BlockDeposits") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatedBalance") - .HasColumnType("bigint"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleBakingRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingRewards") - .HasColumnType("bigint"); - - b.Property("EndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("EndorsementRewards") - .HasColumnType("bigint"); - - b.Property("Endorsements") - .HasColumnType("integer"); - - b.Property("ExpectedBlocks") - .HasColumnType("double precision"); - - b.Property("ExpectedEndorsements") - .HasColumnType("double precision"); - - b.Property("ExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("ExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("ExtraBlocks") - .HasColumnType("integer"); - - b.Property("FutureBlockDeposits") - .HasColumnType("bigint"); - - b.Property("FutureBlockRewards") - .HasColumnType("bigint"); - - b.Property("FutureBlocks") - .HasColumnType("integer"); - - b.Property("FutureEndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("FutureEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("FutureEndorsements") - .HasColumnType("integer"); - - b.Property("MissedEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("MissedEndorsements") - .HasColumnType("integer"); - - b.Property("MissedExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlocks") - .HasColumnType("integer"); - - b.Property("MissedOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlocks") - .HasColumnType("integer"); - - b.Property("OwnBlockFees") - .HasColumnType("bigint"); - - b.Property("OwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("OwnBlocks") - .HasColumnType("integer"); - - b.Property("RevelationLostFees") - .HasColumnType("bigint"); - - b.Property("RevelationLostRewards") - .HasColumnType("bigint"); - - b.Property("RevelationRewards") - .HasColumnType("bigint"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsements") - .HasColumnType("integer"); - - b.Property("UncoveredExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlocks") - .HasColumnType("integer"); - - b.Property("UncoveredOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlocks") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Cycle"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Cycle", "BakerId") - .IsUnique(); - - b.ToTable("BakerCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakingRight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("Level"); - - b.HasIndex("Cycle", "BakerId"); - - b.ToTable("BakingRights"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Vote") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("BallotOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMap", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("ActiveKeys") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("KeyType") - .HasColumnType("bytea"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Ptr") - .HasColumnType("integer"); - - b.Property("StoragePath") - .HasColumnType("text"); - - b.Property("Tags") - .HasColumnType("integer"); - - b.Property("TotalKeys") - .HasColumnType("integer"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.Property("ValueType") - .HasColumnType("bytea"); - - b.HasKey("Id"); - - b.HasAlternateKey("Ptr"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Ptr") - .IsUnique(); - - b.ToTable("BigMaps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("JsonKey") - .HasColumnType("jsonb"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("KeyHash") - .HasMaxLength(54) - .HasColumnType("character varying(54)"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("RawKey") - .HasColumnType("bytea"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("JsonKey") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("JsonValue") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("LastLevel"); - - b.HasIndex("BigMapPtr", "Active") - .HasFilter("\"Active\" = true"); - - b.HasIndex("BigMapPtr", "KeyHash"); - - b.ToTable("BigMapKeys"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapUpdate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Action") - .HasColumnType("integer"); - - b.Property("BigMapKeyId") - .HasColumnType("integer"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapKeyId") - .HasFilter("\"BigMapKeyId\" is not null"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("MigrationId") - .HasFilter("\"MigrationId\" is not null"); - - b.HasIndex("OriginationId") - .HasFilter("\"OriginationId\" is not null"); - - b.HasIndex("TransactionId") - .HasFilter("\"TransactionId\" is not null"); - - b.ToTable("BigMapUpdates"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Events") - .HasColumnType("integer"); - - b.Property("Fees") - .HasColumnType("bigint"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeEma") - .HasColumnType("integer"); - - b.Property("LBEscapeVote") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Operations") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("ProtoCode") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("RevelationId") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Validations") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Hash") - .IsUnique(); - - b.HasIndex("Level") - .IsUnique(); - - b.HasIndex("ProtoCode"); - - b.HasIndex("RevelationId") - .IsUnique(); - - b.HasIndex("SoftwareId"); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Commitment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(37) - .HasColumnType("character(37)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("Id") - .IsUnique(); - - b.ToTable("Commitments"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Cycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Seed") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character(64)") - .IsFixedLength(true); - - b.Property("SnapshotIndex") - .HasColumnType("integer"); - - b.Property("SnapshotLevel") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalDelegated") - .HasColumnType("bigint"); - - b.Property("TotalDelegators") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("TotalStaking") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("Cycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("PrevDelegateId") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("PrevDelegateId"); - - b.HasIndex("SenderId"); - - b.ToTable("DelegationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegatorCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatorId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("DelegatorId"); - - b.HasIndex("Cycle", "BakerId"); - - b.HasIndex("Cycle", "DelegatorId") - .IsUnique(); - - b.ToTable("DelegatorCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleBakingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleEndorsingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("EndorsementOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("BalanceChange") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("Level"); - - b.HasIndex("ScriptId"); - - b.HasIndex("StorageId"); - - b.ToTable("MigrationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RevealedLevel") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("NonceRevelationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("ManagerId"); - - b.HasIndex("OpHash"); - - b.HasIndex("ScriptId"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.ToTable("OriginationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Proposal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstPeriod") - .HasColumnType("integer"); - - b.Property("Hash") - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("LastPeriod") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Upvotes") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Hash"); - - b.ToTable("Proposals"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Duplicated") - .HasColumnType("boolean"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("ProposalOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Protocol", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotQuorumMax") - .HasColumnType("integer"); - - b.Property("BallotQuorumMin") - .HasColumnType("integer"); - - b.Property("BlockDeposit") - .HasColumnType("bigint"); - - b.Property("BlockReward0") - .HasColumnType("bigint"); - - b.Property("BlockReward1") - .HasColumnType("bigint"); - - b.Property("BlocksPerCommitment") - .HasColumnType("integer"); - - b.Property("BlocksPerCycle") - .HasColumnType("integer"); - - b.Property("BlocksPerSnapshot") - .HasColumnType("integer"); - - b.Property("BlocksPerVoting") - .HasColumnType("integer"); - - b.Property("ByteCost") - .HasColumnType("integer"); - - b.Property("Code") - .HasColumnType("integer"); - - b.Property("EndorsementDeposit") - .HasColumnType("bigint"); - - b.Property("EndorsementReward0") - .HasColumnType("bigint"); - - b.Property("EndorsementReward1") - .HasColumnType("bigint"); - - b.Property("EndorsersPerBlock") - .HasColumnType("integer"); - - b.Property("FirstCycle") - .HasColumnType("integer"); - - b.Property("FirstCycleLevel") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("HardBlockGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationStorageLimit") - .HasColumnType("integer"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeThreshold") - .HasColumnType("integer"); - - b.Property("LBSubsidy") - .HasColumnType("integer"); - - b.Property("LBSunsetLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("NoRewardCycles") - .HasColumnType("integer"); - - b.Property("OriginationSize") - .HasColumnType("integer"); - - b.Property("PreservedCycles") - .HasColumnType("integer"); - - b.Property("ProposalQuorum") - .HasColumnType("integer"); - - b.Property("RampUpCycles") - .HasColumnType("integer"); - - b.Property("RevelationReward") - .HasColumnType("bigint"); - - b.Property("TimeBetweenBlocks") - .HasColumnType("integer"); - - b.Property("TokensPerRoll") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.ToTable("Protocols"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Quote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Btc") - .HasColumnType("double precision"); - - b.Property("Cny") - .HasColumnType("double precision"); - - b.Property("Eth") - .HasColumnType("double precision"); - - b.Property("Eur") - .HasColumnType("double precision"); - - b.Property("Jpy") - .HasColumnType("double precision"); - - b.Property("Krw") - .HasColumnType("double precision"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Usd") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Quotes"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("RevealOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("LostFees") - .HasColumnType("bigint"); - - b.Property("LostReward") - .HasColumnType("bigint"); - - b.Property("MissedLevel") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.ToTable("RevelationPenaltyOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Script", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CodeSchema") - .HasColumnType("bytea"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("ParameterSchema") - .HasColumnType("bytea"); - - b.Property("StorageSchema") - .HasColumnType("bytea"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Scripts"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.SnapshotBalance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.ToTable("SnapshotBalances"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Software", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("ShortHash") - .IsRequired() - .HasMaxLength(8) - .HasColumnType("character(8)") - .IsFixedLength(true); - - b.HasKey("Id"); - - b.ToTable("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Statistics", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("TotalActivated") - .HasColumnType("bigint"); - - b.Property("TotalBanished") - .HasColumnType("bigint"); - - b.Property("TotalBootstrapped") - .HasColumnType("bigint"); - - b.Property("TotalBurned") - .HasColumnType("bigint"); - - b.Property("TotalCommitments") - .HasColumnType("bigint"); - - b.Property("TotalCreated") - .HasColumnType("bigint"); - - b.Property("TotalFrozen") - .HasColumnType("bigint"); - - b.Property("TotalVested") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle") - .IsUnique() - .HasFilter("\"Cycle\" IS NOT NULL"); - - b.HasIndex("Date") - .IsUnique() - .HasFilter("\"Date\" IS NOT NULL"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Statistics"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Storage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Storages"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Entrypoint") - .HasColumnType("text"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("InternalDelegations") - .HasColumnType("smallint"); - - b.Property("InternalOperations") - .HasColumnType("smallint"); - - b.Property("InternalOriginations") - .HasColumnType("smallint"); - - b.Property("InternalTransactions") - .HasColumnType("smallint"); - - b.Property("JsonParameters") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RawParameters") - .HasColumnType("bytea"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("JsonParameters") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.HasIndex("TargetId"); - - b.ToTable("TransactionOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingPeriod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotsQuorum") - .HasColumnType("integer"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("NayBallots") - .HasColumnType("integer"); - - b.Property("NayRolls") - .HasColumnType("integer"); - - b.Property("ParticipationEma") - .HasColumnType("integer"); - - b.Property("PassBallots") - .HasColumnType("integer"); - - b.Property("PassRolls") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Supermajority") - .HasColumnType("integer"); - - b.Property("TopRolls") - .HasColumnType("integer"); - - b.Property("TopUpvotes") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("UpvotesQuorum") - .HasColumnType("integer"); - - b.Property("YayBallots") - .HasColumnType("integer"); - - b.Property("YayRolls") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Epoch"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("VotingPeriods"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingSnapshot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Period"); - - b.HasIndex("Period", "BakerId") - .IsUnique(); - - b.ToTable("VotingSnapshots"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CreatorId") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("smallint"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Spendable") - .HasColumnType("boolean"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.Property("Tzips") - .HasColumnType("integer"); - - b.Property("WeirdDelegateId") - .HasColumnType("integer"); - - b.HasIndex("CodeHash"); - - b.HasIndex("CreatorId"); - - b.HasIndex("ManagerId"); - - b.HasIndex("TypeHash"); - - b.HasIndex("WeirdDelegateId"); - - b.HasIndex("Type", "Kind") - .HasFilter("\"Type\" = 2"); - - b.HasDiscriminator().HasValue((byte)2); - }); - - modelBuilder.Entity("Tzkt.Data.Models.User", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("Activated") - .HasColumnType("boolean"); - - b.Property("PublicKey") - .HasMaxLength(55) - .HasColumnType("character varying(55)"); - - b.Property("Revealed") - .HasColumnType("boolean"); - - b.HasDiscriminator().HasValue((byte)0); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasBaseType("Tzkt.Data.Models.User"); - - b.Property("ActivationLevel") - .HasColumnType("integer"); - - b.Property("BallotsCount") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("DeactivationLevel") - .HasColumnType("integer"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingCount") - .HasColumnType("integer"); - - b.Property("EndorsementsCount") - .HasColumnType("integer"); - - b.Property("FrozenDeposits") - .HasColumnType("bigint"); - - b.Property("FrozenFees") - .HasColumnType("bigint"); - - b.Property("FrozenRewards") - .HasColumnType("bigint"); - - b.Property("NonceRevelationsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltiesCount") - .HasColumnType("integer"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.HasIndex("SoftwareId"); - - b.HasIndex("Type", "Staked") - .HasFilter("\"Type\" = 1"); - - b.HasDiscriminator().HasValue((byte)1); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany("DelegatedAccounts") - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Block", "FirstBlock") - .WithMany("CreatedAccounts") - .HasForeignKey("FirstLevel") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Delegate"); - - b.Navigation("FirstBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.HasOne("Tzkt.Data.Models.User", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Activations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Ballots") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId"); - - b.HasOne("Tzkt.Data.Models.Protocol", "Protocol") - .WithMany() - .HasForeignKey("ProtoCode") - .HasPrincipalKey("Code") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.NonceRevelationOperation", "Revelation") - .WithOne("RevealedBlock") - .HasForeignKey("Tzkt.Data.Models.Block", "RevelationId") - .HasPrincipalKey("Tzkt.Data.Models.NonceRevelationOperation", "RevealedLevel"); - - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Baker"); - - b.Navigation("Protocol"); - - b.Navigation("Revelation"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Delegations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "PrevDelegate") - .WithMany() - .HasForeignKey("PrevDelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("PrevDelegate"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleBakings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleEndorsings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Endorsements") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Migrations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Account"); - - b.Navigation("Block"); - - b.Navigation("Script"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Revelations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Contract", "Contract") - .WithMany() - .HasForeignKey("ContractId"); - - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Originations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Block"); - - b.Navigation("Contract"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("Manager"); - - b.Navigation("Script"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Proposals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Reveals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("RevelationPenalties") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Transactions") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.HasOne("Tzkt.Data.Models.Account", "Target") - .WithMany() - .HasForeignKey("TargetId"); - - b.Navigation("Block"); - - b.Navigation("Initiator"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Creator") - .WithMany() - .HasForeignKey("CreatorId"); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.User", "WeirdDelegate") - .WithMany() - .HasForeignKey("WeirdDelegateId"); - - b.Navigation("Creator"); - - b.Navigation("Manager"); - - b.Navigation("WeirdDelegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Navigation("Activations"); - - b.Navigation("Ballots"); - - b.Navigation("CreatedAccounts"); - - b.Navigation("Delegations"); - - b.Navigation("DoubleBakings"); - - b.Navigation("DoubleEndorsings"); - - b.Navigation("Endorsements"); - - b.Navigation("Migrations"); - - b.Navigation("Originations"); - - b.Navigation("Proposals"); - - b.Navigation("Reveals"); - - b.Navigation("RevelationPenalties"); - - b.Navigation("Revelations"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Navigation("RevealedBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.Navigation("DelegatedAccounts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Tzkt.Data/Migrations/20211023122032_GBP.Designer.cs b/Tzkt.Data/Migrations/20211023122032_GBP.Designer.cs deleted file mode 100644 index 9e162f874..000000000 --- a/Tzkt.Data/Migrations/20211023122032_GBP.Designer.cs +++ /dev/null @@ -1,2859 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Tzkt.Data; - -namespace Tzkt.Data.Migrations -{ - [DbContext(typeof(TzktContext))] - [Migration("20211023122032_GBP")] - partial class GBP - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.8") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character(36)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("ContractsCount") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("DelegationLevel") - .HasColumnType("integer"); - - b.Property("DelegationsCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationsCount") - .HasColumnType("integer"); - - b.Property("OriginationsCount") - .HasColumnType("integer"); - - b.Property("RevealsCount") - .HasColumnType("integer"); - - b.Property("Staked") - .HasColumnType("boolean"); - - b.Property("TransactionsCount") - .HasColumnType("integer"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("DelegateId"); - - b.HasIndex("FirstLevel"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Metadata") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Staked"); - - b.HasIndex("Type"); - - b.ToTable("Accounts"); - - b.HasDiscriminator("Type"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("ActivationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.AppState", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountCounter") - .HasColumnType("integer"); - - b.Property("AccountsCount") - .HasColumnType("integer"); - - b.Property("ActivationOpsCount") - .HasColumnType("integer"); - - b.Property("BallotOpsCount") - .HasColumnType("integer"); - - b.Property("BigMapCounter") - .HasColumnType("integer"); - - b.Property("BigMapKeyCounter") - .HasColumnType("integer"); - - b.Property("BigMapUpdateCounter") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("Chain") - .HasColumnType("text"); - - b.Property("ChainId") - .HasColumnType("text"); - - b.Property("CommitmentsCount") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("CyclesCount") - .HasColumnType("integer"); - - b.Property("DelegationOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingOpsCount") - .HasColumnType("integer"); - - b.Property("EndorsementOpsCount") - .HasColumnType("integer"); - - b.Property("Hash") - .HasColumnType("text"); - - b.Property("KnownHead") - .HasColumnType("integer"); - - b.Property("LastSync") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerCounter") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationOpsCount") - .HasColumnType("integer"); - - b.Property("NextProtocol") - .HasColumnType("text"); - - b.Property("NonceRevelationOpsCount") - .HasColumnType("integer"); - - b.Property("OperationCounter") - .HasColumnType("integer"); - - b.Property("OriginationOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Protocol") - .HasColumnType("text"); - - b.Property("ProtocolsCount") - .HasColumnType("integer"); - - b.Property("QuoteBtc") - .HasColumnType("double precision"); - - b.Property("QuoteCny") - .HasColumnType("double precision"); - - b.Property("QuoteEth") - .HasColumnType("double precision"); - - b.Property("QuoteEur") - .HasColumnType("double precision"); - - b.Property("QuoteGbp") - .HasColumnType("double precision"); - - b.Property("QuoteJpy") - .HasColumnType("double precision"); - - b.Property("QuoteKrw") - .HasColumnType("double precision"); - - b.Property("QuoteLevel") - .HasColumnType("integer"); - - b.Property("QuoteUsd") - .HasColumnType("double precision"); - - b.Property("RevealOpsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltyOpsCount") - .HasColumnType("integer"); - - b.Property("ScriptCounter") - .HasColumnType("integer"); - - b.Property("StorageCounter") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("TransactionOpsCount") - .HasColumnType("integer"); - - b.Property("VotingEpoch") - .HasColumnType("integer"); - - b.Property("VotingPeriod") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("AppState"); - - b.HasData( - new - { - Id = -1, - AccountCounter = 0, - AccountsCount = 0, - ActivationOpsCount = 0, - BallotOpsCount = 0, - BigMapCounter = 0, - BigMapKeyCounter = 0, - BigMapUpdateCounter = 0, - BlocksCount = 0, - CommitmentsCount = 0, - Cycle = -1, - CyclesCount = 0, - DelegationOpsCount = 0, - DoubleBakingOpsCount = 0, - DoubleEndorsingOpsCount = 0, - EndorsementOpsCount = 0, - Hash = "", - KnownHead = 0, - LastSync = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - Level = -1, - ManagerCounter = 0, - MigrationOpsCount = 0, - NextProtocol = "", - NonceRevelationOpsCount = 0, - OperationCounter = 0, - OriginationOpsCount = 0, - ProposalOpsCount = 0, - ProposalsCount = 0, - Protocol = "", - ProtocolsCount = 0, - QuoteBtc = 0.0, - QuoteCny = 0.0, - QuoteEth = 0.0, - QuoteEur = 0.0, - QuoteGbp = 0.0, - QuoteJpy = 0.0, - QuoteKrw = 0.0, - QuoteLevel = -1, - QuoteUsd = 0.0, - RevealOpsCount = 0, - RevelationPenaltyOpsCount = 0, - ScriptCounter = 0, - StorageCounter = 0, - Timestamp = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - TransactionOpsCount = 0, - VotingEpoch = -1, - VotingPeriod = -1 - }); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakerCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("BlockDeposits") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatedBalance") - .HasColumnType("bigint"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleBakingRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingRewards") - .HasColumnType("bigint"); - - b.Property("EndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("EndorsementRewards") - .HasColumnType("bigint"); - - b.Property("Endorsements") - .HasColumnType("integer"); - - b.Property("ExpectedBlocks") - .HasColumnType("double precision"); - - b.Property("ExpectedEndorsements") - .HasColumnType("double precision"); - - b.Property("ExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("ExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("ExtraBlocks") - .HasColumnType("integer"); - - b.Property("FutureBlockDeposits") - .HasColumnType("bigint"); - - b.Property("FutureBlockRewards") - .HasColumnType("bigint"); - - b.Property("FutureBlocks") - .HasColumnType("integer"); - - b.Property("FutureEndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("FutureEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("FutureEndorsements") - .HasColumnType("integer"); - - b.Property("MissedEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("MissedEndorsements") - .HasColumnType("integer"); - - b.Property("MissedExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlocks") - .HasColumnType("integer"); - - b.Property("MissedOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlocks") - .HasColumnType("integer"); - - b.Property("OwnBlockFees") - .HasColumnType("bigint"); - - b.Property("OwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("OwnBlocks") - .HasColumnType("integer"); - - b.Property("RevelationLostFees") - .HasColumnType("bigint"); - - b.Property("RevelationLostRewards") - .HasColumnType("bigint"); - - b.Property("RevelationRewards") - .HasColumnType("bigint"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsements") - .HasColumnType("integer"); - - b.Property("UncoveredExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlocks") - .HasColumnType("integer"); - - b.Property("UncoveredOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlocks") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Cycle"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Cycle", "BakerId") - .IsUnique(); - - b.ToTable("BakerCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakingRight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("Level"); - - b.HasIndex("Cycle", "BakerId"); - - b.ToTable("BakingRights"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Vote") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("BallotOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMap", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("ActiveKeys") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("KeyType") - .HasColumnType("bytea"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Ptr") - .HasColumnType("integer"); - - b.Property("StoragePath") - .HasColumnType("text"); - - b.Property("Tags") - .HasColumnType("integer"); - - b.Property("TotalKeys") - .HasColumnType("integer"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.Property("ValueType") - .HasColumnType("bytea"); - - b.HasKey("Id"); - - b.HasAlternateKey("Ptr"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Ptr") - .IsUnique(); - - b.ToTable("BigMaps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("JsonKey") - .HasColumnType("jsonb"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("KeyHash") - .HasMaxLength(54) - .HasColumnType("character varying(54)"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("RawKey") - .HasColumnType("bytea"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("JsonKey") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("JsonValue") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("LastLevel"); - - b.HasIndex("BigMapPtr", "Active") - .HasFilter("\"Active\" = true"); - - b.HasIndex("BigMapPtr", "KeyHash"); - - b.ToTable("BigMapKeys"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapUpdate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Action") - .HasColumnType("integer"); - - b.Property("BigMapKeyId") - .HasColumnType("integer"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapKeyId") - .HasFilter("\"BigMapKeyId\" is not null"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("MigrationId") - .HasFilter("\"MigrationId\" is not null"); - - b.HasIndex("OriginationId") - .HasFilter("\"OriginationId\" is not null"); - - b.HasIndex("TransactionId") - .HasFilter("\"TransactionId\" is not null"); - - b.ToTable("BigMapUpdates"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Events") - .HasColumnType("integer"); - - b.Property("Fees") - .HasColumnType("bigint"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeEma") - .HasColumnType("integer"); - - b.Property("LBEscapeVote") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Operations") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("ProtoCode") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("RevelationId") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Validations") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Hash") - .IsUnique(); - - b.HasIndex("Level") - .IsUnique(); - - b.HasIndex("ProtoCode"); - - b.HasIndex("RevelationId") - .IsUnique(); - - b.HasIndex("SoftwareId"); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Commitment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(37) - .HasColumnType("character(37)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("Id") - .IsUnique(); - - b.ToTable("Commitments"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Cycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Seed") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character(64)") - .IsFixedLength(true); - - b.Property("SnapshotIndex") - .HasColumnType("integer"); - - b.Property("SnapshotLevel") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalDelegated") - .HasColumnType("bigint"); - - b.Property("TotalDelegators") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("TotalStaking") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("Cycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("PrevDelegateId") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("PrevDelegateId"); - - b.HasIndex("SenderId"); - - b.ToTable("DelegationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegatorCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatorId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("DelegatorId"); - - b.HasIndex("Cycle", "BakerId"); - - b.HasIndex("Cycle", "DelegatorId") - .IsUnique(); - - b.ToTable("DelegatorCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleBakingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleEndorsingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("EndorsementOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("BalanceChange") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("Level"); - - b.HasIndex("ScriptId"); - - b.HasIndex("StorageId"); - - b.ToTable("MigrationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RevealedLevel") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("NonceRevelationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("ManagerId"); - - b.HasIndex("OpHash"); - - b.HasIndex("ScriptId"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.ToTable("OriginationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Proposal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstPeriod") - .HasColumnType("integer"); - - b.Property("Hash") - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("LastPeriod") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Upvotes") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Hash"); - - b.ToTable("Proposals"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Duplicated") - .HasColumnType("boolean"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("ProposalOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Protocol", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotQuorumMax") - .HasColumnType("integer"); - - b.Property("BallotQuorumMin") - .HasColumnType("integer"); - - b.Property("BlockDeposit") - .HasColumnType("bigint"); - - b.Property("BlockReward0") - .HasColumnType("bigint"); - - b.Property("BlockReward1") - .HasColumnType("bigint"); - - b.Property("BlocksPerCommitment") - .HasColumnType("integer"); - - b.Property("BlocksPerCycle") - .HasColumnType("integer"); - - b.Property("BlocksPerSnapshot") - .HasColumnType("integer"); - - b.Property("BlocksPerVoting") - .HasColumnType("integer"); - - b.Property("ByteCost") - .HasColumnType("integer"); - - b.Property("Code") - .HasColumnType("integer"); - - b.Property("EndorsementDeposit") - .HasColumnType("bigint"); - - b.Property("EndorsementReward0") - .HasColumnType("bigint"); - - b.Property("EndorsementReward1") - .HasColumnType("bigint"); - - b.Property("EndorsersPerBlock") - .HasColumnType("integer"); - - b.Property("FirstCycle") - .HasColumnType("integer"); - - b.Property("FirstCycleLevel") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("HardBlockGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationStorageLimit") - .HasColumnType("integer"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeThreshold") - .HasColumnType("integer"); - - b.Property("LBSubsidy") - .HasColumnType("integer"); - - b.Property("LBSunsetLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("NoRewardCycles") - .HasColumnType("integer"); - - b.Property("OriginationSize") - .HasColumnType("integer"); - - b.Property("PreservedCycles") - .HasColumnType("integer"); - - b.Property("ProposalQuorum") - .HasColumnType("integer"); - - b.Property("RampUpCycles") - .HasColumnType("integer"); - - b.Property("RevelationReward") - .HasColumnType("bigint"); - - b.Property("TimeBetweenBlocks") - .HasColumnType("integer"); - - b.Property("TokensPerRoll") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.ToTable("Protocols"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Quote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Btc") - .HasColumnType("double precision"); - - b.Property("Cny") - .HasColumnType("double precision"); - - b.Property("Eth") - .HasColumnType("double precision"); - - b.Property("Eur") - .HasColumnType("double precision"); - - b.Property("Gbp") - .HasColumnType("double precision"); - - b.Property("Jpy") - .HasColumnType("double precision"); - - b.Property("Krw") - .HasColumnType("double precision"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Usd") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Quotes"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("RevealOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("LostFees") - .HasColumnType("bigint"); - - b.Property("LostReward") - .HasColumnType("bigint"); - - b.Property("MissedLevel") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.ToTable("RevelationPenaltyOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Script", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CodeSchema") - .HasColumnType("bytea"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("ParameterSchema") - .HasColumnType("bytea"); - - b.Property("StorageSchema") - .HasColumnType("bytea"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Scripts"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.SnapshotBalance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.ToTable("SnapshotBalances"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Software", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("ShortHash") - .IsRequired() - .HasMaxLength(8) - .HasColumnType("character(8)") - .IsFixedLength(true); - - b.HasKey("Id"); - - b.ToTable("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Statistics", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("TotalActivated") - .HasColumnType("bigint"); - - b.Property("TotalBanished") - .HasColumnType("bigint"); - - b.Property("TotalBootstrapped") - .HasColumnType("bigint"); - - b.Property("TotalBurned") - .HasColumnType("bigint"); - - b.Property("TotalCommitments") - .HasColumnType("bigint"); - - b.Property("TotalCreated") - .HasColumnType("bigint"); - - b.Property("TotalFrozen") - .HasColumnType("bigint"); - - b.Property("TotalVested") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle") - .IsUnique() - .HasFilter("\"Cycle\" IS NOT NULL"); - - b.HasIndex("Date") - .IsUnique() - .HasFilter("\"Date\" IS NOT NULL"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Statistics"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Storage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Storages"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Entrypoint") - .HasColumnType("text"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("InternalDelegations") - .HasColumnType("smallint"); - - b.Property("InternalOperations") - .HasColumnType("smallint"); - - b.Property("InternalOriginations") - .HasColumnType("smallint"); - - b.Property("InternalTransactions") - .HasColumnType("smallint"); - - b.Property("JsonParameters") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RawParameters") - .HasColumnType("bytea"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("JsonParameters") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.HasIndex("TargetId"); - - b.ToTable("TransactionOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingPeriod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotsQuorum") - .HasColumnType("integer"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("NayBallots") - .HasColumnType("integer"); - - b.Property("NayRolls") - .HasColumnType("integer"); - - b.Property("ParticipationEma") - .HasColumnType("integer"); - - b.Property("PassBallots") - .HasColumnType("integer"); - - b.Property("PassRolls") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Supermajority") - .HasColumnType("integer"); - - b.Property("TopRolls") - .HasColumnType("integer"); - - b.Property("TopUpvotes") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("UpvotesQuorum") - .HasColumnType("integer"); - - b.Property("YayBallots") - .HasColumnType("integer"); - - b.Property("YayRolls") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Epoch"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("VotingPeriods"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingSnapshot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Period"); - - b.HasIndex("Period", "BakerId") - .IsUnique(); - - b.ToTable("VotingSnapshots"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CreatorId") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("smallint"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Spendable") - .HasColumnType("boolean"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.Property("Tzips") - .HasColumnType("integer"); - - b.Property("WeirdDelegateId") - .HasColumnType("integer"); - - b.HasIndex("CodeHash"); - - b.HasIndex("CreatorId"); - - b.HasIndex("ManagerId"); - - b.HasIndex("TypeHash"); - - b.HasIndex("WeirdDelegateId"); - - b.HasIndex("Type", "Kind") - .HasFilter("\"Type\" = 2"); - - b.HasDiscriminator().HasValue((byte)2); - }); - - modelBuilder.Entity("Tzkt.Data.Models.User", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("Activated") - .HasColumnType("boolean"); - - b.Property("PublicKey") - .HasMaxLength(55) - .HasColumnType("character varying(55)"); - - b.Property("Revealed") - .HasColumnType("boolean"); - - b.HasDiscriminator().HasValue((byte)0); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasBaseType("Tzkt.Data.Models.User"); - - b.Property("ActivationLevel") - .HasColumnType("integer"); - - b.Property("BallotsCount") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("DeactivationLevel") - .HasColumnType("integer"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingCount") - .HasColumnType("integer"); - - b.Property("EndorsementsCount") - .HasColumnType("integer"); - - b.Property("FrozenDeposits") - .HasColumnType("bigint"); - - b.Property("FrozenFees") - .HasColumnType("bigint"); - - b.Property("FrozenRewards") - .HasColumnType("bigint"); - - b.Property("NonceRevelationsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltiesCount") - .HasColumnType("integer"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.HasIndex("SoftwareId"); - - b.HasIndex("Type", "Staked") - .HasFilter("\"Type\" = 1"); - - b.HasDiscriminator().HasValue((byte)1); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany("DelegatedAccounts") - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Block", "FirstBlock") - .WithMany("CreatedAccounts") - .HasForeignKey("FirstLevel") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Delegate"); - - b.Navigation("FirstBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.HasOne("Tzkt.Data.Models.User", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Activations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Ballots") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId"); - - b.HasOne("Tzkt.Data.Models.Protocol", "Protocol") - .WithMany() - .HasForeignKey("ProtoCode") - .HasPrincipalKey("Code") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.NonceRevelationOperation", "Revelation") - .WithOne("RevealedBlock") - .HasForeignKey("Tzkt.Data.Models.Block", "RevelationId") - .HasPrincipalKey("Tzkt.Data.Models.NonceRevelationOperation", "RevealedLevel"); - - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Baker"); - - b.Navigation("Protocol"); - - b.Navigation("Revelation"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Delegations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "PrevDelegate") - .WithMany() - .HasForeignKey("PrevDelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("PrevDelegate"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleBakings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleEndorsings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Endorsements") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Migrations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Account"); - - b.Navigation("Block"); - - b.Navigation("Script"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Revelations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Contract", "Contract") - .WithMany() - .HasForeignKey("ContractId"); - - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Originations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Block"); - - b.Navigation("Contract"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("Manager"); - - b.Navigation("Script"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Proposals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Reveals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("RevelationPenalties") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Transactions") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.HasOne("Tzkt.Data.Models.Account", "Target") - .WithMany() - .HasForeignKey("TargetId"); - - b.Navigation("Block"); - - b.Navigation("Initiator"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Creator") - .WithMany() - .HasForeignKey("CreatorId"); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.User", "WeirdDelegate") - .WithMany() - .HasForeignKey("WeirdDelegateId"); - - b.Navigation("Creator"); - - b.Navigation("Manager"); - - b.Navigation("WeirdDelegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Navigation("Activations"); - - b.Navigation("Ballots"); - - b.Navigation("CreatedAccounts"); - - b.Navigation("Delegations"); - - b.Navigation("DoubleBakings"); - - b.Navigation("DoubleEndorsings"); - - b.Navigation("Endorsements"); - - b.Navigation("Migrations"); - - b.Navigation("Originations"); - - b.Navigation("Proposals"); - - b.Navigation("Reveals"); - - b.Navigation("RevelationPenalties"); - - b.Navigation("Revelations"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Navigation("RevealedBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.Navigation("DelegatedAccounts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Tzkt.Data/Migrations/20211023122032_GBP.cs b/Tzkt.Data/Migrations/20211023122032_GBP.cs deleted file mode 100644 index 6b9b793c7..000000000 --- a/Tzkt.Data/Migrations/20211023122032_GBP.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Tzkt.Data.Migrations -{ - public partial class GBP : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.Sql(@"DELETE FROM ""Quotes"""); - migrationBuilder.Sql(@"UPDATE ""AppState"" SET ""QuoteLevel"" = -1"); - - - migrationBuilder.AddColumn( - name: "Gbp", - table: "Quotes", - type: "double precision", - nullable: false, - defaultValue: 0.0); - - migrationBuilder.AddColumn( - name: "QuoteGbp", - table: "AppState", - type: "double precision", - nullable: false, - defaultValue: 0.0); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Gbp", - table: "Quotes"); - - migrationBuilder.DropColumn( - name: "QuoteGbp", - table: "AppState"); - } - } -} diff --git a/Tzkt.Data/Migrations/20211105193322_Hangzhou.Designer.cs b/Tzkt.Data/Migrations/20211105193322_Hangzhou.Designer.cs deleted file mode 100644 index c1821b899..000000000 --- a/Tzkt.Data/Migrations/20211105193322_Hangzhou.Designer.cs +++ /dev/null @@ -1,2972 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using Tzkt.Data; - -namespace Tzkt.Data.Migrations -{ - [DbContext(typeof(TzktContext))] - [Migration("20211105193322_Hangzhou")] - partial class Hangzhou - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.10") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(36) - .HasColumnType("character(36)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("ContractsCount") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("DelegationLevel") - .HasColumnType("integer"); - - b.Property("DelegationsCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationsCount") - .HasColumnType("integer"); - - b.Property("OriginationsCount") - .HasColumnType("integer"); - - b.Property("RevealsCount") - .HasColumnType("integer"); - - b.Property("Staked") - .HasColumnType("boolean"); - - b.Property("TransactionsCount") - .HasColumnType("integer"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("DelegateId"); - - b.HasIndex("FirstLevel"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Metadata") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Staked"); - - b.HasIndex("Type"); - - b.ToTable("Accounts"); - - b.HasDiscriminator("Type"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("ActivationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.AppState", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountCounter") - .HasColumnType("integer"); - - b.Property("AccountsCount") - .HasColumnType("integer"); - - b.Property("ActivationOpsCount") - .HasColumnType("integer"); - - b.Property("BallotOpsCount") - .HasColumnType("integer"); - - b.Property("BigMapCounter") - .HasColumnType("integer"); - - b.Property("BigMapKeyCounter") - .HasColumnType("integer"); - - b.Property("BigMapUpdateCounter") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("Chain") - .HasColumnType("text"); - - b.Property("ChainId") - .HasColumnType("text"); - - b.Property("CommitmentsCount") - .HasColumnType("integer"); - - b.Property("ConstantsCount") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("CyclesCount") - .HasColumnType("integer"); - - b.Property("DelegationOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingOpsCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingOpsCount") - .HasColumnType("integer"); - - b.Property("EndorsementOpsCount") - .HasColumnType("integer"); - - b.Property("Hash") - .HasColumnType("text"); - - b.Property("KnownHead") - .HasColumnType("integer"); - - b.Property("LastSync") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerCounter") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("MigrationOpsCount") - .HasColumnType("integer"); - - b.Property("NextProtocol") - .HasColumnType("text"); - - b.Property("NonceRevelationOpsCount") - .HasColumnType("integer"); - - b.Property("OperationCounter") - .HasColumnType("integer"); - - b.Property("OriginationOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalOpsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Protocol") - .HasColumnType("text"); - - b.Property("ProtocolsCount") - .HasColumnType("integer"); - - b.Property("QuoteBtc") - .HasColumnType("double precision"); - - b.Property("QuoteCny") - .HasColumnType("double precision"); - - b.Property("QuoteEth") - .HasColumnType("double precision"); - - b.Property("QuoteEur") - .HasColumnType("double precision"); - - b.Property("QuoteGbp") - .HasColumnType("double precision"); - - b.Property("QuoteJpy") - .HasColumnType("double precision"); - - b.Property("QuoteKrw") - .HasColumnType("double precision"); - - b.Property("QuoteLevel") - .HasColumnType("integer"); - - b.Property("QuoteUsd") - .HasColumnType("double precision"); - - b.Property("RegisterConstantOpsCount") - .HasColumnType("integer"); - - b.Property("RevealOpsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltyOpsCount") - .HasColumnType("integer"); - - b.Property("ScriptCounter") - .HasColumnType("integer"); - - b.Property("StorageCounter") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("TransactionOpsCount") - .HasColumnType("integer"); - - b.Property("VotingEpoch") - .HasColumnType("integer"); - - b.Property("VotingPeriod") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.ToTable("AppState"); - - b.HasData( - new - { - Id = -1, - AccountCounter = 0, - AccountsCount = 0, - ActivationOpsCount = 0, - BallotOpsCount = 0, - BigMapCounter = 0, - BigMapKeyCounter = 0, - BigMapUpdateCounter = 0, - BlocksCount = 0, - CommitmentsCount = 0, - ConstantsCount = 0, - Cycle = -1, - CyclesCount = 0, - DelegationOpsCount = 0, - DoubleBakingOpsCount = 0, - DoubleEndorsingOpsCount = 0, - EndorsementOpsCount = 0, - Hash = "", - KnownHead = 0, - LastSync = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - Level = -1, - ManagerCounter = 0, - MigrationOpsCount = 0, - NextProtocol = "", - NonceRevelationOpsCount = 0, - OperationCounter = 0, - OriginationOpsCount = 0, - ProposalOpsCount = 0, - ProposalsCount = 0, - Protocol = "", - ProtocolsCount = 0, - QuoteBtc = 0.0, - QuoteCny = 0.0, - QuoteEth = 0.0, - QuoteEur = 0.0, - QuoteGbp = 0.0, - QuoteJpy = 0.0, - QuoteKrw = 0.0, - QuoteLevel = -1, - QuoteUsd = 0.0, - RegisterConstantOpsCount = 0, - RevealOpsCount = 0, - RevelationPenaltyOpsCount = 0, - ScriptCounter = 0, - StorageCounter = 0, - Timestamp = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), - TransactionOpsCount = 0, - VotingEpoch = -1, - VotingPeriod = -1 - }); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakerCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("BlockDeposits") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatedBalance") - .HasColumnType("bigint"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleBakingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleBakingRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostDeposits") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostFees") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingLostRewards") - .HasColumnType("bigint"); - - b.Property("DoubleEndorsingRewards") - .HasColumnType("bigint"); - - b.Property("EndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("EndorsementRewards") - .HasColumnType("bigint"); - - b.Property("Endorsements") - .HasColumnType("integer"); - - b.Property("ExpectedBlocks") - .HasColumnType("double precision"); - - b.Property("ExpectedEndorsements") - .HasColumnType("double precision"); - - b.Property("ExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("ExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("ExtraBlocks") - .HasColumnType("integer"); - - b.Property("FutureBlockDeposits") - .HasColumnType("bigint"); - - b.Property("FutureBlockRewards") - .HasColumnType("bigint"); - - b.Property("FutureBlocks") - .HasColumnType("integer"); - - b.Property("FutureEndorsementDeposits") - .HasColumnType("bigint"); - - b.Property("FutureEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("FutureEndorsements") - .HasColumnType("integer"); - - b.Property("MissedEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("MissedEndorsements") - .HasColumnType("integer"); - - b.Property("MissedExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedExtraBlocks") - .HasColumnType("integer"); - - b.Property("MissedOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("MissedOwnBlocks") - .HasColumnType("integer"); - - b.Property("OwnBlockFees") - .HasColumnType("bigint"); - - b.Property("OwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("OwnBlocks") - .HasColumnType("integer"); - - b.Property("RevelationLostFees") - .HasColumnType("bigint"); - - b.Property("RevelationLostRewards") - .HasColumnType("bigint"); - - b.Property("RevelationRewards") - .HasColumnType("bigint"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsementRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredEndorsements") - .HasColumnType("integer"); - - b.Property("UncoveredExtraBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredExtraBlocks") - .HasColumnType("integer"); - - b.Property("UncoveredOwnBlockFees") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlockRewards") - .HasColumnType("bigint"); - - b.Property("UncoveredOwnBlocks") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Cycle"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Cycle", "BakerId") - .IsUnique(); - - b.ToTable("BakerCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BakingRight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("Type") - .HasColumnType("smallint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("Level"); - - b.HasIndex("Cycle", "BakerId"); - - b.ToTable("BakingRights"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Vote") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("BallotOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMap", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("ActiveKeys") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("KeyType") - .HasColumnType("bytea"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Ptr") - .HasColumnType("integer"); - - b.Property("StoragePath") - .HasColumnType("text"); - - b.Property("Tags") - .HasColumnType("integer"); - - b.Property("TotalKeys") - .HasColumnType("integer"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.Property("ValueType") - .HasColumnType("bytea"); - - b.HasKey("Id"); - - b.HasAlternateKey("Ptr"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Ptr") - .IsUnique(); - - b.ToTable("BigMaps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapKey", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("JsonKey") - .HasColumnType("jsonb"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("KeyHash") - .HasMaxLength(54) - .HasColumnType("character varying(54)"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("RawKey") - .HasColumnType("bytea"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("Updates") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("JsonKey") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("JsonValue") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("LastLevel"); - - b.HasIndex("BigMapPtr", "Active") - .HasFilter("\"Active\" = true"); - - b.HasIndex("BigMapPtr", "KeyHash"); - - b.ToTable("BigMapKeys"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BigMapUpdate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Action") - .HasColumnType("integer"); - - b.Property("BigMapKeyId") - .HasColumnType("integer"); - - b.Property("BigMapPtr") - .HasColumnType("integer"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BigMapKeyId") - .HasFilter("\"BigMapKeyId\" is not null"); - - b.HasIndex("BigMapPtr"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("MigrationId") - .HasFilter("\"MigrationId\" is not null"); - - b.HasIndex("OriginationId") - .HasFilter("\"OriginationId\" is not null"); - - b.HasIndex("TransactionId") - .HasFilter("\"TransactionId\" is not null"); - - b.ToTable("BigMapUpdates"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Events") - .HasColumnType("integer"); - - b.Property("Fees") - .HasColumnType("bigint"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeEma") - .HasColumnType("integer"); - - b.Property("LBEscapeVote") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Operations") - .HasColumnType("integer"); - - b.Property("Priority") - .HasColumnType("integer"); - - b.Property("ProtoCode") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("RevelationId") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Validations") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Hash") - .IsUnique(); - - b.HasIndex("Level") - .IsUnique(); - - b.HasIndex("ProtoCode"); - - b.HasIndex("RevelationId") - .IsUnique(); - - b.HasIndex("SoftwareId"); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Commitment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Address") - .IsRequired() - .HasMaxLength(37) - .HasColumnType("character(37)") - .IsFixedLength(true); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique(); - - b.HasIndex("Id") - .IsUnique(); - - b.ToTable("Commitments"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Cycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Seed") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character(64)") - .IsFixedLength(true); - - b.Property("SnapshotIndex") - .HasColumnType("integer"); - - b.Property("SnapshotLevel") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalDelegated") - .HasColumnType("bigint"); - - b.Property("TotalDelegators") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("TotalStaking") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("Cycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("PrevDelegateId") - .HasColumnType("integer"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("PrevDelegateId"); - - b.HasIndex("SenderId"); - - b.ToTable("DelegationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegatorCycle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("DelegatorId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Cycle"); - - b.HasIndex("DelegatorId"); - - b.HasIndex("Cycle", "BakerId"); - - b.HasIndex("Cycle", "DelegatorId") - .IsUnique(); - - b.ToTable("DelegatorCycles"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleBakingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccusedLevel") - .HasColumnType("integer"); - - b.Property("AccuserId") - .HasColumnType("integer"); - - b.Property("AccuserReward") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OffenderId") - .HasColumnType("integer"); - - b.Property("OffenderLostDeposit") - .HasColumnType("bigint"); - - b.Property("OffenderLostFee") - .HasColumnType("bigint"); - - b.Property("OffenderLostReward") - .HasColumnType("bigint"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccuserId"); - - b.HasIndex("Level"); - - b.HasIndex("OffenderId"); - - b.HasIndex("OpHash"); - - b.ToTable("DoubleEndorsingOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Deposit") - .HasColumnType("bigint"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("Reward") - .HasColumnType("bigint"); - - b.Property("Slots") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("DelegateId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.ToTable("EndorsementOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("BalanceChange") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("Level"); - - b.HasIndex("ScriptId"); - - b.HasIndex("StorageId"); - - b.ToTable("MigrationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RevealedLevel") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("NonceRevelationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("ScriptId") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("DelegateId"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("Level"); - - b.HasIndex("ManagerId"); - - b.HasIndex("OpHash"); - - b.HasIndex("ScriptId"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.ToTable("OriginationOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Proposal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstPeriod") - .HasColumnType("integer"); - - b.Property("Hash") - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("LastPeriod") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Upvotes") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Hash"); - - b.ToTable("Proposals"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Duplicated") - .HasColumnType("boolean"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("ProposalId") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Epoch"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("Period"); - - b.HasIndex("ProposalId"); - - b.HasIndex("SenderId"); - - b.ToTable("ProposalOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Protocol", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotQuorumMax") - .HasColumnType("integer"); - - b.Property("BallotQuorumMin") - .HasColumnType("integer"); - - b.Property("BlockDeposit") - .HasColumnType("bigint"); - - b.Property("BlockReward0") - .HasColumnType("bigint"); - - b.Property("BlockReward1") - .HasColumnType("bigint"); - - b.Property("BlocksPerCommitment") - .HasColumnType("integer"); - - b.Property("BlocksPerCycle") - .HasColumnType("integer"); - - b.Property("BlocksPerSnapshot") - .HasColumnType("integer"); - - b.Property("BlocksPerVoting") - .HasColumnType("integer"); - - b.Property("ByteCost") - .HasColumnType("integer"); - - b.Property("Code") - .HasColumnType("integer"); - - b.Property("EndorsementDeposit") - .HasColumnType("bigint"); - - b.Property("EndorsementReward0") - .HasColumnType("bigint"); - - b.Property("EndorsementReward1") - .HasColumnType("bigint"); - - b.Property("EndorsersPerBlock") - .HasColumnType("integer"); - - b.Property("FirstCycle") - .HasColumnType("integer"); - - b.Property("FirstCycleLevel") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("HardBlockGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationGasLimit") - .HasColumnType("integer"); - - b.Property("HardOperationStorageLimit") - .HasColumnType("integer"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("LBEscapeThreshold") - .HasColumnType("integer"); - - b.Property("LBSubsidy") - .HasColumnType("integer"); - - b.Property("LBSunsetLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("NoRewardCycles") - .HasColumnType("integer"); - - b.Property("OriginationSize") - .HasColumnType("integer"); - - b.Property("PreservedCycles") - .HasColumnType("integer"); - - b.Property("ProposalQuorum") - .HasColumnType("integer"); - - b.Property("RampUpCycles") - .HasColumnType("integer"); - - b.Property("RevelationReward") - .HasColumnType("bigint"); - - b.Property("TimeBetweenBlocks") - .HasColumnType("integer"); - - b.Property("TokensPerRoll") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.ToTable("Protocols"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Quote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Btc") - .HasColumnType("double precision"); - - b.Property("Cny") - .HasColumnType("double precision"); - - b.Property("Eth") - .HasColumnType("double precision"); - - b.Property("Eur") - .HasColumnType("double precision"); - - b.Property("Gbp") - .HasColumnType("double precision"); - - b.Property("Jpy") - .HasColumnType("double precision"); - - b.Property("Krw") - .HasColumnType("double precision"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Usd") - .HasColumnType("double precision"); - - b.HasKey("Id"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Quotes"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RegisterConstantOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Address") - .HasMaxLength(54) - .HasColumnType("character varying(54)"); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("OpHash") - .HasColumnType("text"); - - b.Property("Refs") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.Property("Value") - .HasColumnType("bytea"); - - b.HasKey("Id"); - - b.HasIndex("Address") - .IsUnique() - .HasFilter("\"Address\" is not null"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("RegisterConstantOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.ToTable("RevealOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("LostFees") - .HasColumnType("bigint"); - - b.Property("LostReward") - .HasColumnType("bigint"); - - b.Property("MissedLevel") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("BakerId"); - - b.HasIndex("Level"); - - b.ToTable("RevelationPenaltyOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Script", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CodeSchema") - .HasColumnType("bytea"); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("ParameterSchema") - .HasColumnType("bytea"); - - b.Property("StorageSchema") - .HasColumnType("bytea"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.Property("Views") - .HasColumnType("bytea[]"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Scripts"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.SnapshotBalance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AccountId") - .HasColumnType("integer"); - - b.Property("Balance") - .HasColumnType("bigint"); - - b.Property("DelegateId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Level"); - - b.ToTable("SnapshotBalances"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Software", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("Metadata") - .HasColumnType("jsonb"); - - b.Property("ShortHash") - .IsRequired() - .HasMaxLength(8) - .HasColumnType("character(8)") - .IsFixedLength(true); - - b.HasKey("Id"); - - b.ToTable("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Statistics", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("Cycle") - .HasColumnType("integer"); - - b.Property("Date") - .HasColumnType("timestamp without time zone"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("TotalActivated") - .HasColumnType("bigint"); - - b.Property("TotalBanished") - .HasColumnType("bigint"); - - b.Property("TotalBootstrapped") - .HasColumnType("bigint"); - - b.Property("TotalBurned") - .HasColumnType("bigint"); - - b.Property("TotalCommitments") - .HasColumnType("bigint"); - - b.Property("TotalCreated") - .HasColumnType("bigint"); - - b.Property("TotalFrozen") - .HasColumnType("bigint"); - - b.Property("TotalVested") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("Cycle") - .IsUnique() - .HasFilter("\"Cycle\" IS NOT NULL"); - - b.HasIndex("Date") - .IsUnique() - .HasFilter("\"Date\" IS NOT NULL"); - - b.HasIndex("Level") - .IsUnique(); - - b.ToTable("Statistics"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Storage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("ContractId") - .HasColumnType("integer"); - - b.Property("Current") - .HasColumnType("boolean"); - - b.Property("JsonValue") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("MigrationId") - .HasColumnType("integer"); - - b.Property("OriginationId") - .HasColumnType("integer"); - - b.Property("RawValue") - .HasColumnType("bytea"); - - b.Property("TransactionId") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Level"); - - b.HasIndex("ContractId", "Current") - .HasFilter("\"Current\" = true"); - - b.ToTable("Storages"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("AllocationFee") - .HasColumnType("bigint"); - - b.Property("Amount") - .HasColumnType("bigint"); - - b.Property("BakerFee") - .HasColumnType("bigint"); - - b.Property("BigMapUpdates") - .HasColumnType("integer"); - - b.Property("Counter") - .HasColumnType("integer"); - - b.Property("Entrypoint") - .HasColumnType("text"); - - b.Property("Errors") - .HasColumnType("text"); - - b.Property("GasLimit") - .HasColumnType("integer"); - - b.Property("GasUsed") - .HasColumnType("integer"); - - b.Property("InitiatorId") - .HasColumnType("integer"); - - b.Property("InternalDelegations") - .HasColumnType("smallint"); - - b.Property("InternalOperations") - .HasColumnType("smallint"); - - b.Property("InternalOriginations") - .HasColumnType("smallint"); - - b.Property("InternalTransactions") - .HasColumnType("smallint"); - - b.Property("JsonParameters") - .HasColumnType("jsonb"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Nonce") - .HasColumnType("integer"); - - b.Property("OpHash") - .IsRequired() - .HasMaxLength(51) - .HasColumnType("character(51)") - .IsFixedLength(true); - - b.Property("RawParameters") - .HasColumnType("bytea"); - - b.Property("ResetDeactivation") - .HasColumnType("integer"); - - b.Property("SenderId") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("smallint"); - - b.Property("StorageFee") - .HasColumnType("bigint"); - - b.Property("StorageId") - .HasColumnType("integer"); - - b.Property("StorageLimit") - .HasColumnType("integer"); - - b.Property("StorageUsed") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("integer"); - - b.Property("Timestamp") - .HasColumnType("timestamp without time zone"); - - b.HasKey("Id"); - - b.HasIndex("InitiatorId"); - - b.HasIndex("JsonParameters") - .HasMethod("gin") - .HasOperators(new[] { "jsonb_path_ops" }); - - b.HasIndex("Level"); - - b.HasIndex("OpHash"); - - b.HasIndex("SenderId"); - - b.HasIndex("StorageId"); - - b.HasIndex("TargetId"); - - b.ToTable("TransactionOps"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingPeriod", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BallotsQuorum") - .HasColumnType("integer"); - - b.Property("Epoch") - .HasColumnType("integer"); - - b.Property("FirstLevel") - .HasColumnType("integer"); - - b.Property("Index") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("integer"); - - b.Property("LastLevel") - .HasColumnType("integer"); - - b.Property("NayBallots") - .HasColumnType("integer"); - - b.Property("NayRolls") - .HasColumnType("integer"); - - b.Property("ParticipationEma") - .HasColumnType("integer"); - - b.Property("PassBallots") - .HasColumnType("integer"); - - b.Property("PassRolls") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("Supermajority") - .HasColumnType("integer"); - - b.Property("TopRolls") - .HasColumnType("integer"); - - b.Property("TopUpvotes") - .HasColumnType("integer"); - - b.Property("TotalBakers") - .HasColumnType("integer"); - - b.Property("TotalRolls") - .HasColumnType("integer"); - - b.Property("UpvotesQuorum") - .HasColumnType("integer"); - - b.Property("YayBallots") - .HasColumnType("integer"); - - b.Property("YayRolls") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasAlternateKey("Index"); - - b.HasIndex("Epoch"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("Index") - .IsUnique(); - - b.ToTable("VotingPeriods"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.VotingSnapshot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("BakerId") - .HasColumnType("integer"); - - b.Property("Level") - .HasColumnType("integer"); - - b.Property("Period") - .HasColumnType("integer"); - - b.Property("Rolls") - .HasColumnType("integer"); - - b.Property("Status") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("Period"); - - b.HasIndex("Period", "BakerId") - .IsUnique(); - - b.ToTable("VotingSnapshots"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("CodeHash") - .HasColumnType("integer"); - - b.Property("CreatorId") - .HasColumnType("integer"); - - b.Property("Kind") - .HasColumnType("smallint"); - - b.Property("ManagerId") - .HasColumnType("integer"); - - b.Property("Spendable") - .HasColumnType("boolean"); - - b.Property("Tags") - .HasColumnType("integer"); - - b.Property("TypeHash") - .HasColumnType("integer"); - - b.Property("WeirdDelegateId") - .HasColumnType("integer"); - - b.HasIndex("CodeHash"); - - b.HasIndex("CreatorId"); - - b.HasIndex("ManagerId"); - - b.HasIndex("TypeHash"); - - b.HasIndex("WeirdDelegateId"); - - b.HasIndex("Type", "Kind") - .HasFilter("\"Type\" = 2"); - - b.HasDiscriminator().HasValue((byte)2); - }); - - modelBuilder.Entity("Tzkt.Data.Models.User", b => - { - b.HasBaseType("Tzkt.Data.Models.Account"); - - b.Property("Activated") - .HasColumnType("boolean"); - - b.Property("PublicKey") - .HasMaxLength(55) - .HasColumnType("character varying(55)"); - - b.Property("RegisterConstantsCount") - .HasColumnType("integer"); - - b.Property("Revealed") - .HasColumnType("boolean"); - - b.HasDiscriminator().HasValue((byte)0); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasBaseType("Tzkt.Data.Models.User"); - - b.Property("ActivationLevel") - .HasColumnType("integer"); - - b.Property("BallotsCount") - .HasColumnType("integer"); - - b.Property("BlocksCount") - .HasColumnType("integer"); - - b.Property("DeactivationLevel") - .HasColumnType("integer"); - - b.Property("DelegatorsCount") - .HasColumnType("integer"); - - b.Property("DoubleBakingCount") - .HasColumnType("integer"); - - b.Property("DoubleEndorsingCount") - .HasColumnType("integer"); - - b.Property("EndorsementsCount") - .HasColumnType("integer"); - - b.Property("FrozenDeposits") - .HasColumnType("bigint"); - - b.Property("FrozenFees") - .HasColumnType("bigint"); - - b.Property("FrozenRewards") - .HasColumnType("bigint"); - - b.Property("NonceRevelationsCount") - .HasColumnType("integer"); - - b.Property("ProposalsCount") - .HasColumnType("integer"); - - b.Property("RevelationPenaltiesCount") - .HasColumnType("integer"); - - b.Property("SoftwareId") - .HasColumnType("integer"); - - b.Property("StakingBalance") - .HasColumnType("bigint"); - - b.HasIndex("SoftwareId"); - - b.HasIndex("Type", "Staked") - .HasFilter("\"Type\" = 1"); - - b.HasDiscriminator().HasValue((byte)1); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Account", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany("DelegatedAccounts") - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Block", "FirstBlock") - .WithMany("CreatedAccounts") - .HasForeignKey("FirstLevel") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Delegate"); - - b.Navigation("FirstBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => - { - b.HasOne("Tzkt.Data.Models.User", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Activations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Account"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.BallotOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Ballots") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId"); - - b.HasOne("Tzkt.Data.Models.Protocol", "Protocol") - .WithMany() - .HasForeignKey("ProtoCode") - .HasPrincipalKey("Code") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.NonceRevelationOperation", "Revelation") - .WithOne("RevealedBlock") - .HasForeignKey("Tzkt.Data.Models.Block", "RevelationId") - .HasPrincipalKey("Tzkt.Data.Models.NonceRevelationOperation", "RevealedLevel"); - - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Baker"); - - b.Navigation("Protocol"); - - b.Navigation("Revelation"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DelegationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Delegations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "PrevDelegate") - .WithMany() - .HasForeignKey("PrevDelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("PrevDelegate"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleBakingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleBakings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.DoubleEndorsingOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Accuser") - .WithMany() - .HasForeignKey("AccuserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("DoubleEndorsings") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Offender") - .WithMany() - .HasForeignKey("OffenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Accuser"); - - b.Navigation("Block"); - - b.Navigation("Offender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.EndorsementOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Endorsements") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Delegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.MigrationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Account") - .WithMany() - .HasForeignKey("AccountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Migrations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Account"); - - b.Navigation("Block"); - - b.Navigation("Script"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Revelations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.OriginationOperation", b => - { - b.HasOne("Tzkt.Data.Models.Contract", "Contract") - .WithMany() - .HasForeignKey("ContractId"); - - b.HasOne("Tzkt.Data.Models.Delegate", "Delegate") - .WithMany() - .HasForeignKey("DelegateId"); - - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Originations") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.Script", "Script") - .WithMany() - .HasForeignKey("ScriptId"); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.Navigation("Block"); - - b.Navigation("Contract"); - - b.Navigation("Delegate"); - - b.Navigation("Initiator"); - - b.Navigation("Manager"); - - b.Navigation("Script"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.ProposalOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Proposals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Proposal", "Proposal") - .WithMany() - .HasForeignKey("ProposalId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Delegate", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Proposal"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RegisterConstantOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("RegisterConstants") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevealOperation", b => - { - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Reveals") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Block"); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.RevelationPenaltyOperation", b => - { - b.HasOne("Tzkt.Data.Models.Delegate", "Baker") - .WithMany() - .HasForeignKey("BakerId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("RevelationPenalties") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Baker"); - - b.Navigation("Block"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Initiator") - .WithMany() - .HasForeignKey("InitiatorId"); - - b.HasOne("Tzkt.Data.Models.Block", "Block") - .WithMany("Transactions") - .HasForeignKey("Level") - .HasPrincipalKey("Level") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Account", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Tzkt.Data.Models.Storage", "Storage") - .WithMany() - .HasForeignKey("StorageId"); - - b.HasOne("Tzkt.Data.Models.Account", "Target") - .WithMany() - .HasForeignKey("TargetId"); - - b.Navigation("Block"); - - b.Navigation("Initiator"); - - b.Navigation("Sender"); - - b.Navigation("Storage"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Contract", b => - { - b.HasOne("Tzkt.Data.Models.Account", "Creator") - .WithMany() - .HasForeignKey("CreatorId"); - - b.HasOne("Tzkt.Data.Models.User", "Manager") - .WithMany() - .HasForeignKey("ManagerId"); - - b.HasOne("Tzkt.Data.Models.User", "WeirdDelegate") - .WithMany() - .HasForeignKey("WeirdDelegateId"); - - b.Navigation("Creator"); - - b.Navigation("Manager"); - - b.Navigation("WeirdDelegate"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.HasOne("Tzkt.Data.Models.Software", "Software") - .WithMany() - .HasForeignKey("SoftwareId"); - - b.Navigation("Software"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Block", b => - { - b.Navigation("Activations"); - - b.Navigation("Ballots"); - - b.Navigation("CreatedAccounts"); - - b.Navigation("Delegations"); - - b.Navigation("DoubleBakings"); - - b.Navigation("DoubleEndorsings"); - - b.Navigation("Endorsements"); - - b.Navigation("Migrations"); - - b.Navigation("Originations"); - - b.Navigation("Proposals"); - - b.Navigation("RegisterConstants"); - - b.Navigation("Reveals"); - - b.Navigation("RevelationPenalties"); - - b.Navigation("Revelations"); - - b.Navigation("Transactions"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.NonceRevelationOperation", b => - { - b.Navigation("RevealedBlock"); - }); - - modelBuilder.Entity("Tzkt.Data.Models.Delegate", b => - { - b.Navigation("DelegatedAccounts"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Tzkt.Data/Migrations/20211105193322_Hangzhou.cs b/Tzkt.Data/Migrations/20211105193322_Hangzhou.cs deleted file mode 100644 index 9afd90838..000000000 --- a/Tzkt.Data/Migrations/20211105193322_Hangzhou.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace Tzkt.Data.Migrations -{ - public partial class Hangzhou : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Tzips", - table: "Accounts", - newName: "Tags"); - - migrationBuilder.Sql(@" - UPDATE ""Accounts"" - SET ""Tags"" = 0 - WHERE ""Type"" = 2 AND ""Tags"" IS NULL;"); - - migrationBuilder.AddColumn( - name: "RegisterConstantsCount", - table: "Accounts", - type: "integer", - nullable: true); - - migrationBuilder.Sql(@" - UPDATE ""Accounts"" - SET ""RegisterConstantsCount"" = 0 - WHERE ""Type"" < 2;"); - - migrationBuilder.AddColumn( - name: "Views", - table: "Scripts", - type: "bytea[]", - nullable: true); - - migrationBuilder.AddColumn( - name: "ConstantsCount", - table: "AppState", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "RegisterConstantOpsCount", - table: "AppState", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.CreateTable( - name: "RegisterConstantOps", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Address = table.Column(type: "character varying(54)", maxLength: 54, nullable: true), - Value = table.Column(type: "bytea", nullable: true), - Refs = table.Column(type: "integer", nullable: true), - Metadata = table.Column(type: "jsonb", nullable: true), - Level = table.Column(type: "integer", nullable: false), - Timestamp = table.Column(type: "timestamp without time zone", nullable: false), - OpHash = table.Column(type: "text", nullable: true), - SenderId = table.Column(type: "integer", nullable: false), - Counter = table.Column(type: "integer", nullable: false), - BakerFee = table.Column(type: "bigint", nullable: false), - StorageFee = table.Column(type: "bigint", nullable: true), - AllocationFee = table.Column(type: "bigint", nullable: true), - GasLimit = table.Column(type: "integer", nullable: false), - GasUsed = table.Column(type: "integer", nullable: false), - StorageLimit = table.Column(type: "integer", nullable: false), - StorageUsed = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "smallint", nullable: false), - Errors = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_RegisterConstantOps", x => x.Id); - table.ForeignKey( - name: "FK_RegisterConstantOps_Accounts_SenderId", - column: x => x.SenderId, - principalTable: "Accounts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_RegisterConstantOps_Blocks_Level", - column: x => x.Level, - principalTable: "Blocks", - principalColumn: "Level", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_RegisterConstantOps_Address", - table: "RegisterConstantOps", - column: "Address", - unique: true, - filter: "\"Address\" is not null"); - - migrationBuilder.CreateIndex( - name: "IX_RegisterConstantOps_Level", - table: "RegisterConstantOps", - column: "Level"); - - migrationBuilder.CreateIndex( - name: "IX_RegisterConstantOps_OpHash", - table: "RegisterConstantOps", - column: "OpHash"); - - migrationBuilder.CreateIndex( - name: "IX_RegisterConstantOps_SenderId", - table: "RegisterConstantOps", - column: "SenderId"); - - Triggers.AddNotificationTrigger(migrationBuilder, - "constant_metadata_changed", - "RegisterConstantOps", - "Metadata", - @"COALESCE(NEW.""Address"", '') || ':' || COALESCE(NEW.""Metadata""::text, '')"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - Triggers.RemoveNotificationTrigger(migrationBuilder, - "constant_metadata_changed", - "RegisterConstantOps"); - - migrationBuilder.DropTable( - name: "RegisterConstantOps"); - - migrationBuilder.DropColumn( - name: "Views", - table: "Scripts"); - - migrationBuilder.DropColumn( - name: "ConstantsCount", - table: "AppState"); - - migrationBuilder.DropColumn( - name: "RegisterConstantOpsCount", - table: "AppState"); - - migrationBuilder.DropColumn( - name: "RegisterConstantsCount", - table: "Accounts"); - - migrationBuilder.RenameColumn( - name: "Tags", - table: "Accounts", - newName: "Tzips"); - } - } -} diff --git a/Tzkt.Data/Migrations/20211105223424_SyncStateTriggers.cs b/Tzkt.Data/Migrations/20211105223424_SyncStateTriggers.cs deleted file mode 100644 index 0d4f6b129..000000000 --- a/Tzkt.Data/Migrations/20211105223424_SyncStateTriggers.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Tzkt.Data.Migrations -{ - public partial class SyncStateTriggers : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - Triggers.AddNotificationTrigger(migrationBuilder, - name: "sync_state_changed", - table: "AppState", - column: "LastSync", - payload: @"NEW.""KnownHead"" || ':' || NEW.""LastSync"""); // ISO 8601 (1997-12-17 07:37:16) - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - Triggers.RemoveNotificationTrigger(migrationBuilder, "sync_state_changed", "AppState"); - } - } -} diff --git a/Tzkt.Data/Migrations/20211214023259_Tokens.cs b/Tzkt.Data/Migrations/20211214023259_Tokens.cs deleted file mode 100644 index 093dc4683..000000000 --- a/Tzkt.Data/Migrations/20211214023259_Tokens.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -namespace Tzkt.Data.Migrations -{ - public partial class Tokens : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "TokenTransfers", - table: "TransactionOps", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "TokenTransfers", - table: "OriginationOps", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "TokenTransfers", - table: "MigrationOps", - type: "integer", - nullable: true); - - migrationBuilder.AddColumn( - name: "TokenBalanceCounter", - table: "AppState", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "TokenBalancesCount", - table: "AppState", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "TokenCounter", - table: "AppState", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "TokenTransfersCount", - table: "AppState", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "TokensCount", - table: "AppState", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "ActiveTokensCount", - table: "Accounts", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "TokenBalancesCount", - table: "Accounts", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "TokenTransfersCount", - table: "Accounts", - type: "integer", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "TokensCount", - table: "Accounts", - type: "integer", - nullable: true); - - migrationBuilder.CreateTable( - name: "TokenBalances", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - TokenId = table.Column(type: "integer", nullable: false), - AccountId = table.Column(type: "integer", nullable: false), - FirstLevel = table.Column(type: "integer", nullable: false), - LastLevel = table.Column(type: "integer", nullable: false), - TransfersCount = table.Column(type: "integer", nullable: false), - Balance = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TokenBalances", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Tokens", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ContractId = table.Column(type: "integer", nullable: false), - TokenId = table.Column(type: "text", nullable: false), - Tags = table.Column(type: "integer", nullable: false), - FirstLevel = table.Column(type: "integer", nullable: false), - LastLevel = table.Column(type: "integer", nullable: false), - TransfersCount = table.Column(type: "integer", nullable: false), - BalancesCount = table.Column(type: "integer", nullable: false), - HoldersCount = table.Column(type: "integer", nullable: false), - TotalMinted = table.Column(type: "text", nullable: false), - TotalBurned = table.Column(type: "text", nullable: false), - TotalSupply = table.Column(type: "text", nullable: false), - OwnerId = table.Column(type: "integer", nullable: true), - Metadata = table.Column(type: "jsonb", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Tokens", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "TokenTransfers", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Level = table.Column(type: "integer", nullable: false), - TokenId = table.Column(type: "integer", nullable: false), - Amount = table.Column(type: "text", nullable: false), - FromId = table.Column(type: "integer", nullable: true), - ToId = table.Column(type: "integer", nullable: true), - OriginationId = table.Column(type: "integer", nullable: true), - TransactionId = table.Column(type: "integer", nullable: true), - MigrationId = table.Column(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_TokenTransfers", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_TokenBalances_AccountId", - table: "TokenBalances", - column: "AccountId", - filter: "\"Balance\" != '0'"); - - migrationBuilder.CreateIndex( - name: "IX_TokenBalances_AccountId_TokenId", - table: "TokenBalances", - columns: new[] { "AccountId", "TokenId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_TokenBalances_Id", - table: "TokenBalances", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_TokenBalances_LastLevel", - table: "TokenBalances", - column: "LastLevel"); - - migrationBuilder.CreateIndex( - name: "IX_TokenBalances_TokenId", - table: "TokenBalances", - column: "TokenId", - filter: "\"Balance\" != '0'"); - - migrationBuilder.CreateIndex( - name: "IX_Tokens_ContractId", - table: "Tokens", - column: "ContractId"); - - migrationBuilder.CreateIndex( - name: "IX_Tokens_ContractId_TokenId", - table: "Tokens", - columns: new[] { "ContractId", "TokenId" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Tokens_Id", - table: "Tokens", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Tokens_LastLevel", - table: "Tokens", - column: "LastLevel"); - - migrationBuilder.CreateIndex( - name: "IX_Tokens_Metadata", - table: "Tokens", - column: "Metadata") - .Annotation("Npgsql:IndexMethod", "gin") - .Annotation("Npgsql:IndexOperators", new[] { "jsonb_path_ops" }); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_FromId", - table: "TokenTransfers", - column: "FromId", - filter: "\"FromId\" is not null"); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_Id", - table: "TokenTransfers", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_Level", - table: "TokenTransfers", - column: "Level"); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_MigrationId", - table: "TokenTransfers", - column: "MigrationId", - filter: "\"MigrationId\" is not null"); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_OriginationId", - table: "TokenTransfers", - column: "OriginationId", - filter: "\"OriginationId\" is not null"); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_ToId", - table: "TokenTransfers", - column: "ToId", - filter: "\"ToId\" is not null"); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_TokenId", - table: "TokenTransfers", - column: "TokenId"); - - migrationBuilder.CreateIndex( - name: "IX_TokenTransfers_TransactionId", - table: "TokenTransfers", - column: "TransactionId", - filter: "\"TransactionId\" is not null"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TokenBalances"); - - migrationBuilder.DropTable( - name: "Tokens"); - - migrationBuilder.DropTable( - name: "TokenTransfers"); - - migrationBuilder.DropColumn( - name: "TokenTransfers", - table: "TransactionOps"); - - migrationBuilder.DropColumn( - name: "TokenTransfers", - table: "OriginationOps"); - - migrationBuilder.DropColumn( - name: "TokenTransfers", - table: "MigrationOps"); - - migrationBuilder.DropColumn( - name: "TokenBalanceCounter", - table: "AppState"); - - migrationBuilder.DropColumn( - name: "TokenBalancesCount", - table: "AppState"); - - migrationBuilder.DropColumn( - name: "TokenCounter", - table: "AppState"); - - migrationBuilder.DropColumn( - name: "TokenTransfersCount", - table: "AppState"); - - migrationBuilder.DropColumn( - name: "TokensCount", - table: "AppState"); - - migrationBuilder.DropColumn( - name: "ActiveTokensCount", - table: "Accounts"); - - migrationBuilder.DropColumn( - name: "TokenBalancesCount", - table: "Accounts"); - - migrationBuilder.DropColumn( - name: "TokenTransfersCount", - table: "Accounts"); - - migrationBuilder.DropColumn( - name: "TokensCount", - table: "Accounts"); - } - } -} diff --git a/Tzkt.Data/Migrations/20211214023259_Tokens.Designer.cs b/Tzkt.Data/Migrations/20220126221033_Init.Designer.cs similarity index 99% rename from Tzkt.Data/Migrations/20211214023259_Tokens.Designer.cs rename to Tzkt.Data/Migrations/20220126221033_Init.Designer.cs index a4a539fc2..2118a5ff2 100644 --- a/Tzkt.Data/Migrations/20211214023259_Tokens.Designer.cs +++ b/Tzkt.Data/Migrations/20220126221033_Init.Designer.cs @@ -10,8 +10,8 @@ namespace Tzkt.Data.Migrations { [DbContext(typeof(TzktContext))] - [Migration("20211214023259_Tokens")] - partial class Tokens + [Migration("20220126221033_Init")] + partial class Init { protected override void BuildTargetModel(ModelBuilder modelBuilder) { diff --git a/Tzkt.Data/Migrations/20210714124853_Initial.cs b/Tzkt.Data/Migrations/20220126221033_Init.cs similarity index 88% rename from Tzkt.Data/Migrations/20210714124853_Initial.cs rename to Tzkt.Data/Migrations/20220126221033_Init.cs index 6a4c2abc9..502c0e4c1 100644 --- a/Tzkt.Data/Migrations/20210714124853_Initial.cs +++ b/Tzkt.Data/Migrations/20220126221033_Init.cs @@ -4,7 +4,7 @@ namespace Tzkt.Data.Migrations { - public partial class Initial : Migration + public partial class Init : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -34,6 +34,8 @@ protected override void Up(MigrationBuilder migrationBuilder) BigMapUpdateCounter = table.Column(type: "integer", nullable: false), StorageCounter = table.Column(type: "integer", nullable: false), ScriptCounter = table.Column(type: "integer", nullable: false), + TokenCounter = table.Column(type: "integer", nullable: false), + TokenBalanceCounter = table.Column(type: "integer", nullable: false), CommitmentsCount = table.Column(type: "integer", nullable: false), AccountsCount = table.Column(type: "integer", nullable: false), BlocksCount = table.Column(type: "integer", nullable: false), @@ -49,10 +51,15 @@ protected override void Up(MigrationBuilder migrationBuilder) ProposalOpsCount = table.Column(type: "integer", nullable: false), RevealOpsCount = table.Column(type: "integer", nullable: false), TransactionOpsCount = table.Column(type: "integer", nullable: false), + RegisterConstantOpsCount = table.Column(type: "integer", nullable: false), MigrationOpsCount = table.Column(type: "integer", nullable: false), RevelationPenaltyOpsCount = table.Column(type: "integer", nullable: false), ProposalsCount = table.Column(type: "integer", nullable: false), CyclesCount = table.Column(type: "integer", nullable: false), + ConstantsCount = table.Column(type: "integer", nullable: false), + TokensCount = table.Column(type: "integer", nullable: false), + TokenBalancesCount = table.Column(type: "integer", nullable: false), + TokenTransfersCount = table.Column(type: "integer", nullable: false), QuoteLevel = table.Column(type: "integer", nullable: false), QuoteBtc = table.Column(type: "double precision", nullable: false), QuoteEur = table.Column(type: "double precision", nullable: false), @@ -61,6 +68,7 @@ protected override void Up(MigrationBuilder migrationBuilder) QuoteJpy = table.Column(type: "double precision", nullable: false), QuoteKrw = table.Column(type: "double precision", nullable: false), QuoteEth = table.Column(type: "double precision", nullable: false), + QuoteGbp = table.Column(type: "double precision", nullable: false), Metadata = table.Column(type: "jsonb", nullable: true) }, constraints: table => @@ -357,7 +365,8 @@ protected override void Up(MigrationBuilder migrationBuilder) Cny = table.Column(type: "double precision", nullable: false), Jpy = table.Column(type: "double precision", nullable: false), Krw = table.Column(type: "double precision", nullable: false), - Eth = table.Column(type: "double precision", nullable: false) + Eth = table.Column(type: "double precision", nullable: false), + Gbp = table.Column(type: "double precision", nullable: false) }, constraints: table => { @@ -378,6 +387,7 @@ protected override void Up(MigrationBuilder migrationBuilder) ParameterSchema = table.Column(type: "bytea", nullable: true), StorageSchema = table.Column(type: "bytea", nullable: true), CodeSchema = table.Column(type: "bytea", nullable: true), + Views = table.Column(type: "bytea[]", nullable: true), TypeHash = table.Column(type: "integer", nullable: false), CodeHash = table.Column(type: "integer", nullable: false) }, @@ -462,6 +472,69 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_Storages", x => x.Id); }); + migrationBuilder.CreateTable( + name: "TokenBalances", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + TokenId = table.Column(type: "integer", nullable: false), + AccountId = table.Column(type: "integer", nullable: false), + FirstLevel = table.Column(type: "integer", nullable: false), + LastLevel = table.Column(type: "integer", nullable: false), + TransfersCount = table.Column(type: "integer", nullable: false), + Balance = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TokenBalances", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Tokens", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ContractId = table.Column(type: "integer", nullable: false), + TokenId = table.Column(type: "text", nullable: false), + Tags = table.Column(type: "integer", nullable: false), + FirstLevel = table.Column(type: "integer", nullable: false), + LastLevel = table.Column(type: "integer", nullable: false), + TransfersCount = table.Column(type: "integer", nullable: false), + BalancesCount = table.Column(type: "integer", nullable: false), + HoldersCount = table.Column(type: "integer", nullable: false), + TotalMinted = table.Column(type: "text", nullable: false), + TotalBurned = table.Column(type: "text", nullable: false), + TotalSupply = table.Column(type: "text", nullable: false), + OwnerId = table.Column(type: "integer", nullable: true), + Metadata = table.Column(type: "jsonb", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Tokens", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "TokenTransfers", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Level = table.Column(type: "integer", nullable: false), + TokenId = table.Column(type: "integer", nullable: false), + Amount = table.Column(type: "text", nullable: false), + FromId = table.Column(type: "integer", nullable: true), + ToId = table.Column(type: "integer", nullable: true), + OriginationId = table.Column(type: "integer", nullable: true), + TransactionId = table.Column(type: "integer", nullable: true), + MigrationId = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TokenTransfers", x => x.Id); + }); + migrationBuilder.CreateTable( name: "VotingPeriods", columns: table => new @@ -614,6 +687,9 @@ protected override void Up(MigrationBuilder migrationBuilder) Balance = table.Column(type: "bigint", nullable: false), Counter = table.Column(type: "integer", nullable: false), ContractsCount = table.Column(type: "integer", nullable: false), + ActiveTokensCount = table.Column(type: "integer", nullable: false), + TokenBalancesCount = table.Column(type: "integer", nullable: false), + TokenTransfersCount = table.Column(type: "integer", nullable: false), DelegationsCount = table.Column(type: "integer", nullable: false), OriginationsCount = table.Column(type: "integer", nullable: false), TransactionsCount = table.Column(type: "integer", nullable: false), @@ -626,7 +702,8 @@ protected override void Up(MigrationBuilder migrationBuilder) Kind = table.Column(type: "smallint", nullable: true), TypeHash = table.Column(type: "integer", nullable: true), CodeHash = table.Column(type: "integer", nullable: true), - Tzips = table.Column(type: "integer", nullable: true), + Tags = table.Column(type: "integer", nullable: true), + TokensCount = table.Column(type: "integer", nullable: true), Spendable = table.Column(type: "boolean", nullable: true), CreatorId = table.Column(type: "integer", nullable: true), ManagerId = table.Column(type: "integer", nullable: true), @@ -634,6 +711,7 @@ protected override void Up(MigrationBuilder migrationBuilder) Activated = table.Column(type: "boolean", nullable: true), PublicKey = table.Column(type: "character varying(55)", maxLength: 55, nullable: true), Revealed = table.Column(type: "boolean", nullable: true), + RegisterConstantsCount = table.Column(type: "integer", nullable: true), ActivationLevel = table.Column(type: "integer", nullable: true), DeactivationLevel = table.Column(type: "integer", nullable: true), FrozenDeposits = table.Column(type: "bigint", nullable: true), @@ -879,7 +957,8 @@ protected override void Up(MigrationBuilder migrationBuilder) BalanceChange = table.Column(type: "bigint", nullable: false), ScriptId = table.Column(type: "integer", nullable: true), StorageId = table.Column(type: "integer", nullable: true), - BigMapUpdates = table.Column(type: "integer", nullable: true) + BigMapUpdates = table.Column(type: "integer", nullable: true), + TokenTransfers = table.Column(type: "integer", nullable: true) }, constraints: table => { @@ -975,7 +1054,8 @@ protected override void Up(MigrationBuilder migrationBuilder) InitiatorId = table.Column(type: "integer", nullable: true), Nonce = table.Column(type: "integer", nullable: true), StorageId = table.Column(type: "integer", nullable: true), - BigMapUpdates = table.Column(type: "integer", nullable: true) + BigMapUpdates = table.Column(type: "integer", nullable: true), + TokenTransfers = table.Column(type: "integer", nullable: true) }, constraints: table => { @@ -1069,6 +1149,48 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "RegisterConstantOps", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Address = table.Column(type: "character varying(54)", maxLength: 54, nullable: true), + Value = table.Column(type: "bytea", nullable: true), + Refs = table.Column(type: "integer", nullable: true), + Metadata = table.Column(type: "jsonb", nullable: true), + Level = table.Column(type: "integer", nullable: false), + Timestamp = table.Column(type: "timestamp without time zone", nullable: false), + OpHash = table.Column(type: "text", nullable: true), + SenderId = table.Column(type: "integer", nullable: false), + Counter = table.Column(type: "integer", nullable: false), + BakerFee = table.Column(type: "bigint", nullable: false), + StorageFee = table.Column(type: "bigint", nullable: true), + AllocationFee = table.Column(type: "bigint", nullable: true), + GasLimit = table.Column(type: "integer", nullable: false), + GasUsed = table.Column(type: "integer", nullable: false), + StorageLimit = table.Column(type: "integer", nullable: false), + StorageUsed = table.Column(type: "integer", nullable: false), + Status = table.Column(type: "smallint", nullable: false), + Errors = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RegisterConstantOps", x => x.Id); + table.ForeignKey( + name: "FK_RegisterConstantOps_Accounts_SenderId", + column: x => x.SenderId, + principalTable: "Accounts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RegisterConstantOps_Blocks_Level", + column: x => x.Level, + principalTable: "Blocks", + principalColumn: "Level", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "RevealOps", columns: table => new @@ -1170,7 +1292,8 @@ protected override void Up(MigrationBuilder migrationBuilder) InitiatorId = table.Column(type: "integer", nullable: true), Nonce = table.Column(type: "integer", nullable: true), StorageId = table.Column(type: "integer", nullable: true), - BigMapUpdates = table.Column(type: "integer", nullable: true) + BigMapUpdates = table.Column(type: "integer", nullable: true), + TokenTransfers = table.Column(type: "integer", nullable: true) }, constraints: table => { @@ -1209,8 +1332,8 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.InsertData( table: "AppState", - columns: new[] { "Id", "AccountCounter", "AccountsCount", "ActivationOpsCount", "BallotOpsCount", "BigMapCounter", "BigMapKeyCounter", "BigMapUpdateCounter", "BlocksCount", "Chain", "ChainId", "CommitmentsCount", "Cycle", "CyclesCount", "DelegationOpsCount", "DoubleBakingOpsCount", "DoubleEndorsingOpsCount", "EndorsementOpsCount", "Hash", "KnownHead", "LastSync", "Level", "ManagerCounter", "Metadata", "MigrationOpsCount", "NextProtocol", "NonceRevelationOpsCount", "OperationCounter", "OriginationOpsCount", "ProposalOpsCount", "ProposalsCount", "Protocol", "ProtocolsCount", "QuoteBtc", "QuoteCny", "QuoteEth", "QuoteEur", "QuoteJpy", "QuoteKrw", "QuoteLevel", "QuoteUsd", "RevealOpsCount", "RevelationPenaltyOpsCount", "ScriptCounter", "StorageCounter", "Timestamp", "TransactionOpsCount", "VotingEpoch", "VotingPeriod" }, - values: new object[] { -1, 0, 0, 0, 0, 0, 0, 0, 0, null, null, 0, -1, 0, 0, 0, 0, 0, "", 0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), -1, 0, null, 0, "", 0, 0, 0, 0, 0, "", 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1, 0.0, 0, 0, 0, 0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 0, -1, -1 }); + columns: new[] { "Id", "AccountCounter", "AccountsCount", "ActivationOpsCount", "BallotOpsCount", "BigMapCounter", "BigMapKeyCounter", "BigMapUpdateCounter", "BlocksCount", "Chain", "ChainId", "CommitmentsCount", "ConstantsCount", "Cycle", "CyclesCount", "DelegationOpsCount", "DoubleBakingOpsCount", "DoubleEndorsingOpsCount", "EndorsementOpsCount", "Hash", "KnownHead", "LastSync", "Level", "ManagerCounter", "Metadata", "MigrationOpsCount", "NextProtocol", "NonceRevelationOpsCount", "OperationCounter", "OriginationOpsCount", "ProposalOpsCount", "ProposalsCount", "Protocol", "ProtocolsCount", "QuoteBtc", "QuoteCny", "QuoteEth", "QuoteEur", "QuoteGbp", "QuoteJpy", "QuoteKrw", "QuoteLevel", "QuoteUsd", "RegisterConstantOpsCount", "RevealOpsCount", "RevelationPenaltyOpsCount", "ScriptCounter", "StorageCounter", "Timestamp", "TokenBalanceCounter", "TokenBalancesCount", "TokenCounter", "TokenTransfersCount", "TokensCount", "TransactionOpsCount", "VotingEpoch", "VotingPeriod" }, + values: new object[] { -1, 0, 0, 0, 0, 0, 0, 0, 0, null, null, 0, 0, -1, 0, 0, 0, 0, 0, "", 0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), -1, 0, null, 0, "", 0, 0, 0, 0, 0, "", 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1, 0.0, 0, 0, 0, 0, 0, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 0, 0, 0, 0, 0, 0, -1, -1 }); migrationBuilder.CreateIndex( name: "IX_Accounts_Address", @@ -1762,6 +1885,28 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Level", unique: true); + migrationBuilder.CreateIndex( + name: "IX_RegisterConstantOps_Address", + table: "RegisterConstantOps", + column: "Address", + unique: true, + filter: "\"Address\" is not null"); + + migrationBuilder.CreateIndex( + name: "IX_RegisterConstantOps_Level", + table: "RegisterConstantOps", + column: "Level"); + + migrationBuilder.CreateIndex( + name: "IX_RegisterConstantOps_OpHash", + table: "RegisterConstantOps", + column: "OpHash"); + + migrationBuilder.CreateIndex( + name: "IX_RegisterConstantOps_SenderId", + table: "RegisterConstantOps", + column: "SenderId"); + migrationBuilder.CreateIndex( name: "IX_RevealOps_Level", table: "RevealOps", @@ -1846,6 +1991,110 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Storages", column: "Level"); + migrationBuilder.CreateIndex( + name: "IX_TokenBalances_AccountId", + table: "TokenBalances", + column: "AccountId", + filter: "\"Balance\" != '0'"); + + migrationBuilder.CreateIndex( + name: "IX_TokenBalances_AccountId_TokenId", + table: "TokenBalances", + columns: new[] { "AccountId", "TokenId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TokenBalances_Id", + table: "TokenBalances", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TokenBalances_LastLevel", + table: "TokenBalances", + column: "LastLevel"); + + migrationBuilder.CreateIndex( + name: "IX_TokenBalances_TokenId", + table: "TokenBalances", + column: "TokenId", + filter: "\"Balance\" != '0'"); + + migrationBuilder.CreateIndex( + name: "IX_Tokens_ContractId", + table: "Tokens", + column: "ContractId"); + + migrationBuilder.CreateIndex( + name: "IX_Tokens_ContractId_TokenId", + table: "Tokens", + columns: new[] { "ContractId", "TokenId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Tokens_Id", + table: "Tokens", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Tokens_LastLevel", + table: "Tokens", + column: "LastLevel"); + + migrationBuilder.CreateIndex( + name: "IX_Tokens_Metadata", + table: "Tokens", + column: "Metadata") + .Annotation("Npgsql:IndexMethod", "gin") + .Annotation("Npgsql:IndexOperators", new[] { "jsonb_path_ops" }); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_FromId", + table: "TokenTransfers", + column: "FromId", + filter: "\"FromId\" is not null"); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_Id", + table: "TokenTransfers", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_Level", + table: "TokenTransfers", + column: "Level"); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_MigrationId", + table: "TokenTransfers", + column: "MigrationId", + filter: "\"MigrationId\" is not null"); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_OriginationId", + table: "TokenTransfers", + column: "OriginationId", + filter: "\"OriginationId\" is not null"); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_ToId", + table: "TokenTransfers", + column: "ToId", + filter: "\"ToId\" is not null"); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_TokenId", + table: "TokenTransfers", + column: "TokenId"); + + migrationBuilder.CreateIndex( + name: "IX_TokenTransfers_TransactionId", + table: "TokenTransfers", + column: "TransactionId", + filter: "\"TransactionId\" is not null"); + migrationBuilder.CreateIndex( name: "IX_TransactionOps_InitiatorId", table: "TransactionOps", @@ -2027,6 +2276,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "Quotes"); + migrationBuilder.DropTable( + name: "RegisterConstantOps"); + migrationBuilder.DropTable( name: "RevealOps"); @@ -2039,6 +2291,15 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "Statistics"); + migrationBuilder.DropTable( + name: "TokenBalances"); + + migrationBuilder.DropTable( + name: "Tokens"); + + migrationBuilder.DropTable( + name: "TokenTransfers"); + migrationBuilder.DropTable( name: "TransactionOps"); diff --git a/Tzkt.Data/Migrations/20211105223424_SyncStateTriggers.Designer.cs b/Tzkt.Data/Migrations/20220126221116_Triggers.Designer.cs similarity index 93% rename from Tzkt.Data/Migrations/20211105223424_SyncStateTriggers.Designer.cs rename to Tzkt.Data/Migrations/20220126221116_Triggers.Designer.cs index 2fdfdf4cc..7cca860c2 100644 --- a/Tzkt.Data/Migrations/20211105223424_SyncStateTriggers.Designer.cs +++ b/Tzkt.Data/Migrations/20220126221116_Triggers.Designer.cs @@ -10,8 +10,8 @@ namespace Tzkt.Data.Migrations { [DbContext(typeof(TzktContext))] - [Migration("20211105223424_SyncStateTriggers")] - partial class SyncStateTriggers + [Migration("20220126221116_Triggers")] + partial class Triggers { protected override void BuildTargetModel(ModelBuilder modelBuilder) { @@ -28,6 +28,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + b.Property("ActiveTokensCount") + .HasColumnType("integer"); + b.Property("Address") .IsRequired() .HasMaxLength(36) @@ -73,6 +76,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Staked") .HasColumnType("boolean"); + b.Property("TokenBalancesCount") + .HasColumnType("integer"); + + b.Property("TokenTransfersCount") + .HasColumnType("integer"); + b.Property("TransactionsCount") .HasColumnType("integer"); @@ -101,7 +110,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("Accounts"); - b.HasDiscriminator("Type"); + b.HasDiscriminator("Type").HasValue((byte)3); }); modelBuilder.Entity("Tzkt.Data.Models.ActivationOperation", b => @@ -292,6 +301,21 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Timestamp") .HasColumnType("timestamp without time zone"); + b.Property("TokenBalanceCounter") + .HasColumnType("integer"); + + b.Property("TokenBalancesCount") + .HasColumnType("integer"); + + b.Property("TokenCounter") + .HasColumnType("integer"); + + b.Property("TokenTransfersCount") + .HasColumnType("integer"); + + b.Property("TokensCount") + .HasColumnType("integer"); + b.Property("TransactionOpsCount") .HasColumnType("integer"); @@ -354,6 +378,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) ScriptCounter = 0, StorageCounter = 0, Timestamp = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + TokenBalanceCounter = 0, + TokenBalancesCount = 0, + TokenCounter = 0, + TokenTransfersCount = 0, + TokensCount = 0, TransactionOpsCount = 0, VotingEpoch = -1, VotingPeriod = -1 @@ -1282,6 +1311,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Timestamp") .HasColumnType("timestamp without time zone"); + b.Property("TokenTransfers") + .HasColumnType("integer"); + b.HasKey("Id"); b.HasIndex("AccountId"); @@ -1415,6 +1447,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Timestamp") .HasColumnType("timestamp without time zone"); + b.Property("TokenTransfers") + .HasColumnType("integer"); + b.HasKey("Id"); b.HasIndex("ContractId"); @@ -2085,6 +2120,179 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("Storages"); }); + modelBuilder.Entity("Tzkt.Data.Models.Token", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BalancesCount") + .HasColumnType("integer"); + + b.Property("ContractId") + .HasColumnType("integer"); + + b.Property("FirstLevel") + .HasColumnType("integer"); + + b.Property("HoldersCount") + .HasColumnType("integer"); + + b.Property("LastLevel") + .HasColumnType("integer"); + + b.Property("Metadata") + .HasColumnType("jsonb"); + + b.Property("OwnerId") + .HasColumnType("integer"); + + b.Property("Tags") + .HasColumnType("integer"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.Property("TotalBurned") + .IsRequired() + .HasColumnType("text"); + + b.Property("TotalMinted") + .IsRequired() + .HasColumnType("text"); + + b.Property("TotalSupply") + .IsRequired() + .HasColumnType("text"); + + b.Property("TransfersCount") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ContractId"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("LastLevel"); + + b.HasIndex("Metadata") + .HasMethod("gin") + .HasOperators(new[] { "jsonb_path_ops" }); + + b.HasIndex("ContractId", "TokenId") + .IsUnique(); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Tzkt.Data.Models.TokenBalance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AccountId") + .HasColumnType("integer"); + + b.Property("Balance") + .IsRequired() + .HasColumnType("text"); + + b.Property("FirstLevel") + .HasColumnType("integer"); + + b.Property("LastLevel") + .HasColumnType("integer"); + + b.Property("TokenId") + .HasColumnType("integer"); + + b.Property("TransfersCount") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AccountId") + .HasFilter("\"Balance\" != '0'"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("LastLevel"); + + b.HasIndex("TokenId") + .HasFilter("\"Balance\" != '0'"); + + b.HasIndex("AccountId", "TokenId") + .IsUnique(); + + b.ToTable("TokenBalances"); + }); + + modelBuilder.Entity("Tzkt.Data.Models.TokenTransfer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Amount") + .IsRequired() + .HasColumnType("text"); + + b.Property("FromId") + .HasColumnType("integer"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("MigrationId") + .HasColumnType("integer"); + + b.Property("OriginationId") + .HasColumnType("integer"); + + b.Property("ToId") + .HasColumnType("integer"); + + b.Property("TokenId") + .HasColumnType("integer"); + + b.Property("TransactionId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("FromId") + .HasFilter("\"FromId\" is not null"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Level"); + + b.HasIndex("MigrationId") + .HasFilter("\"MigrationId\" is not null"); + + b.HasIndex("OriginationId") + .HasFilter("\"OriginationId\" is not null"); + + b.HasIndex("ToId") + .HasFilter("\"ToId\" is not null"); + + b.HasIndex("TokenId"); + + b.HasIndex("TransactionId") + .HasFilter("\"TransactionId\" is not null"); + + b.ToTable("TokenTransfers"); + }); + modelBuilder.Entity("Tzkt.Data.Models.TransactionOperation", b => { b.Property("Id") @@ -2179,6 +2387,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Timestamp") .HasColumnType("timestamp without time zone"); + b.Property("TokenTransfers") + .HasColumnType("integer"); + b.HasKey("Id"); b.HasIndex("InitiatorId"); @@ -2339,6 +2550,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Tags") .HasColumnType("integer"); + b.Property("TokensCount") + .HasColumnType("integer"); + b.Property("TypeHash") .HasColumnType("integer"); diff --git a/Tzkt.Data/Migrations/20210714125513_Triggers.cs b/Tzkt.Data/Migrations/20220126221116_Triggers.cs similarity index 83% rename from Tzkt.Data/Migrations/20210714125513_Triggers.cs rename to Tzkt.Data/Migrations/20220126221116_Triggers.cs index 4ceb941e1..7374bd7a4 100644 --- a/Tzkt.Data/Migrations/20210714125513_Triggers.cs +++ b/Tzkt.Data/Migrations/20220126221116_Triggers.cs @@ -73,6 +73,18 @@ protected override void Up(MigrationBuilder migrationBuilder) "Blocks", "Metadata", @"NEW.""Level"" || ':' || COALESCE(NEW.""Metadata""::text, '')"); + + AddNotificationTrigger(migrationBuilder, + "constant_metadata_changed", + "RegisterConstantOps", + "Metadata", + @"COALESCE(NEW.""Address"", '') || ':' || COALESCE(NEW.""Metadata""::text, '')"); + + AddNotificationTrigger(migrationBuilder, + name: "sync_state_changed", + table: "AppState", + column: "LastSync", + payload: @"NEW.""KnownHead"" || ':' || NEW.""LastSync"""); // ISO 8601 (1997-12-17 07:37:16) } protected override void Down(MigrationBuilder migrationBuilder) @@ -84,6 +96,8 @@ protected override void Down(MigrationBuilder migrationBuilder) RemoveNotificationTrigger(migrationBuilder, "protocol_metadata_changed", "Protocols"); RemoveNotificationTrigger(migrationBuilder, "software_metadata_changed", "Software"); RemoveNotificationTrigger(migrationBuilder, "block_metadata_changed", "Blocks"); + RemoveNotificationTrigger(migrationBuilder, "constant_metadata_changed", "RegisterConstantOps"); + RemoveNotificationTrigger(migrationBuilder, "sync_state_changed", "AppState"); } } }