diff --git a/src/Nethereum.BlockchainProcessing.Storage.sln b/src/Nethereum.BlockchainProcessing.Storage.sln index 5aa6554..0328cf0 100644 --- a/src/Nethereum.BlockchainProcessing.Storage.sln +++ b/src/Nethereum.BlockchainProcessing.Storage.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29021.104 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.32916.344 MinimumVisualStudioVersion = 15.0.26124.0 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethereum.BlockchainStore.Azure.LogProcessor.Db", "Nethereum.BlockchainStore.Azure.LogProcessor.Db\Nethereum.BlockchainStore.Azure.LogProcessor.Db.csproj", "{B4063D96-347C-476D-AC81-5E6020F5DBC4}" EndProject @@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethereum.BlockchainStore.C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethereum.BlockchainStore.CosmosCore.Console", "Nethereum.BlockchainStore.CosmosCore.Console\Nethereum.BlockchainStore.CosmosCore.Console.csproj", "{846C1948-EBED-4005-B281-AF6A055FB8EF}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5551D3F6-DE86-4AAA-9820-92D996BCB800}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethereum.BlockchainStore.Csv", "Nethereum.BlockchainStore.Csv\Nethereum.BlockchainStore.Csv.csproj", "{8D63D180-DEBD-4378-B377-3D0F142035F9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethereum.BlockchainStore.Csv.Console", "Nethereum.BlockchainStore.Csv.Console\Nethereum.BlockchainStore.Csv.Console.csproj", "{A609BF84-5995-456C-B848-854B3C4488FC}" @@ -117,6 +115,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethereum.BlockchainStore.S EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nethereum.BlockchainStore.Queue.Azure", "Nethereum.BlockchainStore.Queue.Azure\Nethereum.BlockchainStore.Queue.Azure.csproj", "{25DD3631-513A-4C26-8E1B-B038B3D530E9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nethereum.Web3", "..\..\Nethereum\src\Nethereum.Web3\Nethereum.Web3.csproj", "{9123BE6E-F492-49B2-BE08-08AE8F261489}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -595,6 +595,18 @@ Global {25DD3631-513A-4C26-8E1B-B038B3D530E9}.Release|x64.Build.0 = Release|Any CPU {25DD3631-513A-4C26-8E1B-B038B3D530E9}.Release|x86.ActiveCfg = Release|Any CPU {25DD3631-513A-4C26-8E1B-B038B3D530E9}.Release|x86.Build.0 = Release|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Debug|x64.ActiveCfg = Debug|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Debug|x64.Build.0 = Debug|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Debug|x86.ActiveCfg = Debug|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Debug|x86.Build.0 = Debug|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Release|Any CPU.Build.0 = Release|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Release|x64.ActiveCfg = Release|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Release|x64.Build.0 = Release|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Release|x86.ActiveCfg = Release|Any CPU + {9123BE6E-F492-49B2-BE08-08AE8F261489}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Nethereum.BlockchainStore.Azure.LogProcessor.Db/Nethereum.BlockchainStore.Azure.LogProcessor.Db.csproj b/src/Nethereum.BlockchainStore.Azure.LogProcessor.Db/Nethereum.BlockchainStore.Azure.LogProcessor.Db.csproj index 638298b..aa0da44 100644 --- a/src/Nethereum.BlockchainStore.Azure.LogProcessor.Db/Nethereum.BlockchainStore.Azure.LogProcessor.Db.csproj +++ b/src/Nethereum.BlockchainStore.Azure.LogProcessor.Db/Nethereum.BlockchainStore.Azure.LogProcessor.Db.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 diff --git a/src/Nethereum.BlockchainStore.AzureTables.Core.Console/Nethereum.BlockchainStore.AzureTables.Core.Console.csproj b/src/Nethereum.BlockchainStore.AzureTables.Core.Console/Nethereum.BlockchainStore.AzureTables.Core.Console.csproj index 4eeb219..f7e27bb 100644 --- a/src/Nethereum.BlockchainStore.AzureTables.Core.Console/Nethereum.BlockchainStore.AzureTables.Core.Console.csproj +++ b/src/Nethereum.BlockchainStore.AzureTables.Core.Console/Nethereum.BlockchainStore.AzureTables.Core.Console.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/src/Nethereum.BlockchainStore.AzureTables.Tests/Nethereum.BlockchainStore.AzureTables.Tests.csproj b/src/Nethereum.BlockchainStore.AzureTables.Tests/Nethereum.BlockchainStore.AzureTables.Tests.csproj index cbe6c45..3f981be 100644 --- a/src/Nethereum.BlockchainStore.AzureTables.Tests/Nethereum.BlockchainStore.AzureTables.Tests.csproj +++ b/src/Nethereum.BlockchainStore.AzureTables.Tests/Nethereum.BlockchainStore.AzureTables.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 Nethereum.BlockchainStore.AzureTables false diff --git a/src/Nethereum.BlockchainStore.AzureTables/Entities/AddressTransaction.cs b/src/Nethereum.BlockchainStore.AzureTables/Entities/AddressTransaction.cs index 4dce6cd..62ead76 100644 --- a/src/Nethereum.BlockchainStore.AzureTables/Entities/AddressTransaction.cs +++ b/src/Nethereum.BlockchainStore.AzureTables/Entities/AddressTransaction.cs @@ -29,6 +29,8 @@ public string Address //Store as a string so it can be parsed as a BigInteger public override string BlockNumber { get; set; } = string.Empty; + + public static AddressTransaction CreateAddressTransaction( RPC.Eth.DTOs.Transaction transactionSource, TransactionReceipt transactionReceipt, diff --git a/src/Nethereum.BlockchainStore.AzureTables/Entities/Block.cs b/src/Nethereum.BlockchainStore.AzureTables/Entities/Block.cs index 1f7f66c..3d5bdfa 100644 --- a/src/Nethereum.BlockchainStore.AzureTables/Entities/Block.cs +++ b/src/Nethereum.BlockchainStore.AzureTables/Entities/Block.cs @@ -35,6 +35,7 @@ public string BlockNumber public string GasUsed { get; set; } = string.Empty; public string TimeStamp { get; set; } = string.Empty; public long TransactionCount { get; set; } = 0; + public string BaseFeePerGas {get; set;} = string.Empty; public void SetBlockNumber(HexBigInteger blockNumber) { diff --git a/src/Nethereum.BlockchainStore.AzureTables/Entities/TransactionBase.cs b/src/Nethereum.BlockchainStore.AzureTables/Entities/TransactionBase.cs index f511021..3dc23c7 100644 --- a/src/Nethereum.BlockchainStore.AzureTables/Entities/TransactionBase.cs +++ b/src/Nethereum.BlockchainStore.AzureTables/Entities/TransactionBase.cs @@ -28,6 +28,8 @@ public abstract class TransactionBase : TableEntity public bool HasVmStack{ get; set; } = false; public string NewContractAddress{ get; set; } = string.Empty; public bool FailedCreateContract{ get; set; } = false; + public string MaxFeePerGas { get; set; } = string.Empty; + public string MaxPriorityFeePerGas { get; set; } = string.Empty; public static TransactionBase CreateTransaction( TransactionBase transaction, @@ -58,6 +60,8 @@ public static TransactionBase CreateTransaction( transaction.SetTimeStamp(timeStamp); transaction.Error = error ?? string.Empty; transaction.HasVmStack = hasVmStack; + transaction.MaxFeePerGas = transactionSource.MaxFeePerGas?.Value.ToString(); + transaction.MaxPriorityFeePerGas = transactionSource.MaxPriorityFeePerGas?.Value.ToString(); return transaction; } diff --git a/src/Nethereum.BlockchainStore.AzureTables/Nethereum.BlockchainStore.AzureTables.csproj b/src/Nethereum.BlockchainStore.AzureTables/Nethereum.BlockchainStore.AzureTables.csproj index 92946a3..faa1415 100644 --- a/src/Nethereum.BlockchainStore.AzureTables/Nethereum.BlockchainStore.AzureTables.csproj +++ b/src/Nethereum.BlockchainStore.AzureTables/Nethereum.BlockchainStore.AzureTables.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 $(DefaultAuthors), $(OtherAuthors) false false @@ -13,8 +13,13 @@ - + + + + + + diff --git a/src/Nethereum.BlockchainStore.Console/Nethereum.BlockchainStore.Console.csproj b/src/Nethereum.BlockchainStore.Console/Nethereum.BlockchainStore.Console.csproj index 8f31d3d..9e360d6 100644 --- a/src/Nethereum.BlockchainStore.Console/Nethereum.BlockchainStore.Console.csproj +++ b/src/Nethereum.BlockchainStore.Console/Nethereum.BlockchainStore.Console.csproj @@ -2,7 +2,7 @@ - netstandard2.0 + net6.0 @@ -11,7 +11,8 @@ - + + diff --git a/src/Nethereum.BlockchainStore.Console/StorageProcessorConsole.cs b/src/Nethereum.BlockchainStore.Console/StorageProcessorConsole.cs index b9cf670..995b02d 100644 --- a/src/Nethereum.BlockchainStore.Console/StorageProcessorConsole.cs +++ b/src/Nethereum.BlockchainStore.Console/StorageProcessorConsole.cs @@ -18,10 +18,9 @@ namespace Nethereum.BlockchainStore.Console public class StorageProcessorConsole where TRepositoryFactory : IBlockchainStoreRepositoryFactory, IBlockProgressRepositoryFactory { - ILog log = LoggerFactory + ILogger log = LoggerFactory .Create(builder => builder.AddConsole()) - .CreateLogger>() - .ToILog(); + .CreateLogger>(); public StorageProcessorConsole( string[] consoleArgs, @@ -30,7 +29,7 @@ public StorageProcessorConsole( Action disposeRepositoriesCallback = null ) { - log.Info("StorageProcessorConsole constructor"); + log.LogInformation("StorageProcessorConsole constructor"); ConsoleArgs = consoleArgs; UserSecretsId = userSecretsId; CreateRepositoryFactoryCallback = createRepositoryFactoryCallback; @@ -70,7 +69,7 @@ public async Task ExecuteAsync( } catch (Exception ex) { - log?.Error(ex); + log?.LogError(ex.Message); if(repoFactory != null) DisposeAction?.Invoke(repoFactory); return 1; } @@ -82,9 +81,9 @@ private BlockchainProcessor CreateBlockChainProcessor(TRepositoryFactory repoFac var web3 = new Web3.Web3(TargetConfiguration.BlockchainUrl); var steps = new BlockProcessingSteps(); - steps.BlockStep.AddProcessorHandler((b) => { log.Info($"Processing block {b.Number.Value}, Tx Count: {b.Transactions.Length}"); return Task.CompletedTask; }); - steps.TransactionReceiptStep.AddProcessorHandler((tx) => { log.Info($"\tTransaction: Index: {tx.Transaction.TransactionIndex}, Hash: {tx.TransactionHash}"); return Task.CompletedTask; }); - steps.FilterLogStep.AddProcessorHandler((l) => { log.Info($"\t\tLog: Index: {l.LogIndex}"); return Task.CompletedTask; }); + steps.BlockStep.AddProcessorHandler((b) => { log.LogInformation($"Processing block {b.Number.Value}, Tx Count: {b.Transactions.Length}"); return Task.CompletedTask; }); + steps.TransactionReceiptStep.AddProcessorHandler((tx) => { log.LogInformation($"\tTransaction: Index: {tx.Transaction.TransactionIndex}, Hash: {tx.TransactionHash}"); return Task.CompletedTask; }); + steps.FilterLogStep.AddProcessorHandler((l) => { log.LogInformation($"\t\tLog: Index: {l.LogIndex}"); return Task.CompletedTask; }); var orchestrator = new BlockCrawlOrchestrator(web3.Eth, steps); orchestrator.ContractCreatedCrawlerStep.RetrieveCode = true; diff --git a/src/Nethereum.BlockchainStore.CosmosCore.Console/Nethereum.BlockchainStore.CosmosCore.Console.csproj b/src/Nethereum.BlockchainStore.CosmosCore.Console/Nethereum.BlockchainStore.CosmosCore.Console.csproj index 1b9475e..67d391b 100644 --- a/src/Nethereum.BlockchainStore.CosmosCore.Console/Nethereum.BlockchainStore.CosmosCore.Console.csproj +++ b/src/Nethereum.BlockchainStore.CosmosCore.Console/Nethereum.BlockchainStore.CosmosCore.Console.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 Nethereum.BlockchainStore.CosmosCore.UserSecrets diff --git a/src/Nethereum.BlockchainStore.CosmosCore.Tests/Nethereum.BlockchainStore.CosmosCore.Tests.csproj b/src/Nethereum.BlockchainStore.CosmosCore.Tests/Nethereum.BlockchainStore.CosmosCore.Tests.csproj index 3bb1eea..6ae6b1c 100644 --- a/src/Nethereum.BlockchainStore.CosmosCore.Tests/Nethereum.BlockchainStore.CosmosCore.Tests.csproj +++ b/src/Nethereum.BlockchainStore.CosmosCore.Tests/Nethereum.BlockchainStore.CosmosCore.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false Nethereum.BlockchainStore.CosmosCore.UserSecrets.UnitTests diff --git a/src/Nethereum.BlockchainStore.CosmosCore/Nethereum.BlockchainStore.CosmosCore.csproj b/src/Nethereum.BlockchainStore.CosmosCore/Nethereum.BlockchainStore.CosmosCore.csproj index 8734ea2..8900a89 100644 --- a/src/Nethereum.BlockchainStore.CosmosCore/Nethereum.BlockchainStore.CosmosCore.csproj +++ b/src/Nethereum.BlockchainStore.CosmosCore/Nethereum.BlockchainStore.CosmosCore.csproj @@ -1,19 +1,22 @@  - netstandard2.0 + net6.0 $(OtherAuthors), $(DefaultAuthors) Nethereum.BlockchainStore.CosmosCore.UserSecrets Store Ethereum block chain data in Azure Cosmos Db. - - + + + + + diff --git a/src/Nethereum.BlockchainStore.Csv.Console/Nethereum.BlockchainStore.Csv.Console.csproj b/src/Nethereum.BlockchainStore.Csv.Console/Nethereum.BlockchainStore.Csv.Console.csproj index 5e3eb57..f97382e 100644 --- a/src/Nethereum.BlockchainStore.Csv.Console/Nethereum.BlockchainStore.Csv.Console.csproj +++ b/src/Nethereum.BlockchainStore.Csv.Console/Nethereum.BlockchainStore.Csv.Console.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/src/Nethereum.BlockchainStore.Csv.Tests/Nethereum.BlockchainStore.Csv.Tests.csproj b/src/Nethereum.BlockchainStore.Csv.Tests/Nethereum.BlockchainStore.Csv.Tests.csproj index b910eab..27c70d9 100644 --- a/src/Nethereum.BlockchainStore.Csv.Tests/Nethereum.BlockchainStore.Csv.Tests.csproj +++ b/src/Nethereum.BlockchainStore.Csv.Tests/Nethereum.BlockchainStore.Csv.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false diff --git a/src/Nethereum.BlockchainStore.Csv/Nethereum.BlockchainStore.Csv.csproj b/src/Nethereum.BlockchainStore.Csv/Nethereum.BlockchainStore.Csv.csproj index ced3286..8819d07 100644 --- a/src/Nethereum.BlockchainStore.Csv/Nethereum.BlockchainStore.Csv.csproj +++ b/src/Nethereum.BlockchainStore.Csv/Nethereum.BlockchainStore.Csv.csproj @@ -2,17 +2,16 @@ $(OtherAuthors), $(DefaultAuthors) - netstandard2.0 + net6.0 Store Ethereum blockchain data in CSV format. - - - - - + + + + diff --git a/src/Nethereum.BlockchainStore.EF.Hana.Tests/Nethereum.BlockchainStore.EF.Hana.Tests.csproj b/src/Nethereum.BlockchainStore.EF.Hana.Tests/Nethereum.BlockchainStore.EF.Hana.Tests.csproj index 63788ca..da2ed77 100644 --- a/src/Nethereum.BlockchainStore.EF.Hana.Tests/Nethereum.BlockchainStore.EF.Hana.Tests.csproj +++ b/src/Nethereum.BlockchainStore.EF.Hana.Tests/Nethereum.BlockchainStore.EF.Hana.Tests.csproj @@ -2,7 +2,7 @@ Kevin Small - net461 + net6.0 Store Ethereum blockchain data in SAP Hana using Entity Framework. false diff --git a/src/Nethereum.BlockchainStore.EF.Hana/Nethereum.BlockchainStore.EF.Hana.csproj b/src/Nethereum.BlockchainStore.EF.Hana/Nethereum.BlockchainStore.EF.Hana.csproj index 38078e3..9c7dffc 100644 --- a/src/Nethereum.BlockchainStore.EF.Hana/Nethereum.BlockchainStore.EF.Hana.csproj +++ b/src/Nethereum.BlockchainStore.EF.Hana/Nethereum.BlockchainStore.EF.Hana.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 Kevin Small, $(OtherAuthors), $(DefaultAuthors) Store Ethereum blockchain data in SAP Hana using Entity Framework (not core). false diff --git a/src/Nethereum.BlockchainStore.EF.SqlServer.Tests/Nethereum.BlockchainStore.EF.SqlServer.Tests.csproj b/src/Nethereum.BlockchainStore.EF.SqlServer.Tests/Nethereum.BlockchainStore.EF.SqlServer.Tests.csproj index efbeefc..e045c2b 100644 --- a/src/Nethereum.BlockchainStore.EF.SqlServer.Tests/Nethereum.BlockchainStore.EF.SqlServer.Tests.csproj +++ b/src/Nethereum.BlockchainStore.EF.SqlServer.Tests/Nethereum.BlockchainStore.EF.SqlServer.Tests.csproj @@ -2,7 +2,7 @@ $(OtherAuthors) - net461 + net6.0 Store Ethereum blockchain data in Sql Server using Entity Framework. false diff --git a/src/Nethereum.BlockchainStore.EF.SqlServer/Nethereum.BlockchainStore.EF.SqlServer.csproj b/src/Nethereum.BlockchainStore.EF.SqlServer/Nethereum.BlockchainStore.EF.SqlServer.csproj index 97c3e0d..3206892 100644 --- a/src/Nethereum.BlockchainStore.EF.SqlServer/Nethereum.BlockchainStore.EF.SqlServer.csproj +++ b/src/Nethereum.BlockchainStore.EF.SqlServer/Nethereum.BlockchainStore.EF.SqlServer.csproj @@ -2,7 +2,7 @@ $(OtherAuthors), $(DefaultAuthors) - netstandard2.0 + net6.0 Store Ethereum blockchain data in Sql Server using Entity Framework (not core). diff --git a/src/Nethereum.BlockchainStore.EF.Sqlite.Tests/Nethereum.BlockchainStore.EF.Sqlite.Tests.csproj b/src/Nethereum.BlockchainStore.EF.Sqlite.Tests/Nethereum.BlockchainStore.EF.Sqlite.Tests.csproj index 893b6fd..7a55a7c 100644 --- a/src/Nethereum.BlockchainStore.EF.Sqlite.Tests/Nethereum.BlockchainStore.EF.Sqlite.Tests.csproj +++ b/src/Nethereum.BlockchainStore.EF.Sqlite.Tests/Nethereum.BlockchainStore.EF.Sqlite.Tests.csproj @@ -2,7 +2,7 @@ $(OtherAuthors) - net461 + net6.0 Store Ethereum blockchain data in Sqlite using Entity Framework. false false diff --git a/src/Nethereum.BlockchainStore.EF.Sqlite/Nethereum.BlockchainStore.EF.Sqlite.csproj b/src/Nethereum.BlockchainStore.EF.Sqlite/Nethereum.BlockchainStore.EF.Sqlite.csproj index 7243c7d..657d0eb 100644 --- a/src/Nethereum.BlockchainStore.EF.Sqlite/Nethereum.BlockchainStore.EF.Sqlite.csproj +++ b/src/Nethereum.BlockchainStore.EF.Sqlite/Nethereum.BlockchainStore.EF.Sqlite.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 $(OtherAuthors), $(DefaultAuthors) Store Ethereum blockchain data in Sqlite using Entity Framework (not core). false diff --git a/src/Nethereum.BlockchainStore.EF/EntityBuilders/BlockEntityBuilder.cs b/src/Nethereum.BlockchainStore.EF/EntityBuilders/BlockEntityBuilder.cs index 74eb9af..be962f0 100644 --- a/src/Nethereum.BlockchainStore.EF/EntityBuilders/BlockEntityBuilder.cs +++ b/src/Nethereum.BlockchainStore.EF/EntityBuilders/BlockEntityBuilder.cs @@ -23,6 +23,7 @@ public BlockEntityBuilder() Property(b => b.GasUsed).IsBigInteger(); Property(b => b.Timestamp).IsBigInteger(); Property(b => b.Nonce).IsBigInteger(); + Property(b => b.BaseFeePerGas).IsBigInteger(); } } } \ No newline at end of file diff --git a/src/Nethereum.BlockchainStore.EF/EntityBuilders/TransactionEntityBuilder.cs b/src/Nethereum.BlockchainStore.EF/EntityBuilders/TransactionEntityBuilder.cs index 737baf2..af63373 100644 --- a/src/Nethereum.BlockchainStore.EF/EntityBuilders/TransactionEntityBuilder.cs +++ b/src/Nethereum.BlockchainStore.EF/EntityBuilders/TransactionEntityBuilder.cs @@ -36,6 +36,10 @@ public TransactionEntityBuilder() Property(b => b.GasUsed).IsBigInteger(); Property(b => b.Nonce).IsBigInteger(); Property(b => b.CumulativeGasUsed).IsBigInteger(); + + Property(b => b.EffectiveGasPrice).IsBigInteger(); + Property(b => b.MaxFeePerGas).IsBigInteger(); + Property(b => b.MaxPriorityFeePerGas).IsBigInteger(); } } } \ No newline at end of file diff --git a/src/Nethereum.BlockchainStore.EF/Nethereum.BlockchainStore.EF.csproj b/src/Nethereum.BlockchainStore.EF/Nethereum.BlockchainStore.EF.csproj index 7316706..59d84c3 100644 --- a/src/Nethereum.BlockchainStore.EF/Nethereum.BlockchainStore.EF.csproj +++ b/src/Nethereum.BlockchainStore.EF/Nethereum.BlockchainStore.EF.csproj @@ -2,17 +2,17 @@ $(OtherAuthors), $(DefaultAuthors) - netstandard2.0 + net6.0 Store Ethereum blockchain data using Entity Framework (not EF core). This package only contains the base components. Use the other DB specific packages available for Sqlite, SqlServer etc. - - - - + + + + diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer.Console/Nethereum.BlockchainStore.EFCore.SqlServer.Console.csproj b/src/Nethereum.BlockchainStore.EFCore.SqlServer.Console/Nethereum.BlockchainStore.EFCore.SqlServer.Console.csproj index 4c2f5a4..01c646b 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer.Console/Nethereum.BlockchainStore.EFCore.SqlServer.Console.csproj +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer.Console/Nethereum.BlockchainStore.EFCore.SqlServer.Console.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 false diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer.Tests/Nethereum.BlockchainStore.EFCore.SqlServer.Tests.csproj b/src/Nethereum.BlockchainStore.EFCore.SqlServer.Tests/Nethereum.BlockchainStore.EFCore.SqlServer.Tests.csproj index 78a5348..f9d8319 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer.Tests/Nethereum.BlockchainStore.EFCore.SqlServer.Tests.csproj +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer.Tests/Nethereum.BlockchainStore.EFCore.SqlServer.Tests.csproj @@ -1,15 +1,13 @@  - netcoreapp3.1 + net6.0 false - - all diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/BlockchainDbContextDesignTimeFactory.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/BlockchainDbContextDesignTimeFactory.cs index 80d15c9..cc29d6f 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/BlockchainDbContextDesignTimeFactory.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/BlockchainDbContextDesignTimeFactory.cs @@ -21,6 +21,8 @@ public class BlockchainDbContextDesignTimeFactory_rinkeby: BlockchainDbContextDe public class BlockchainDbContextDesignTimeFactory_kovan: BlockchainDbContextDesignTimeFactory{} public class BlockchainDbContextDesignTimeFactory_ropsten: BlockchainDbContextDesignTimeFactory{} public class BlockchainDbContextDesignTimeFactory_main: BlockchainDbContextDesignTimeFactory{} + public class BlockchainDbContextDesignTimeFactory_goerli: BlockchainDbContextDesignTimeFactory{} + public class BlockchainDbContextDesignTimeFactory_sepolia: BlockchainDbContextDesignTimeFactory{} public abstract class BlockchainDbContextDesignTimeFactory : IDesignTimeDbContextFactory where T : SqlServerBlockchainDbContext diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/DbInitialCreate.bat b/src/Nethereum.BlockchainStore.EFCore.SqlServer/DbInitialCreate.bat index b440dad..e9b6820 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/DbInitialCreate.bat +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/DbInitialCreate.bat @@ -4,15 +4,21 @@ dotnet ef migrations remove -f -c SqlServerBlockchainDbContext_ropsten dotnet ef migrations remove -f -c SqlServerBlockchainDbContext_rinkeby dotnet ef migrations remove -f -c SqlServerBlockchainDbContext_kovan dotnet ef migrations remove -f -c SqlServerBlockchainDbContext_main +dotnet ef migrations remove -f -c SqlServerBlockchainDbContext_goerli +dotnet ef migrations remove -f -c SqlServerBlockchainDbContext_sepolia dotnet ef migrations add -c SqlServerBlockchainDbContext_dbo InitialCreate dotnet ef migrations add -c SqlServerBlockchainDbContext_localhost InitialCreate dotnet ef migrations add -c SqlServerBlockchainDbContext_ropsten InitialCreate dotnet ef migrations add -c SqlServerBlockchainDbContext_rinkeby InitialCreate dotnet ef migrations add -c SqlServerBlockchainDbContext_kovan InitialCreate dotnet ef migrations add -c SqlServerBlockchainDbContext_main InitialCreate +dotnet ef migrations add -c SqlServerBlockchainDbContext_goerli InitialCreate +dotnet ef migrations add -c SqlServerBlockchainDbContext_sepolia InitialCreate dotnet ef database update -c SqlServerBlockchainDbContext_dbo dotnet ef database update -c SqlServerBlockchainDbContext_localhost dotnet ef database update -c SqlServerBlockchainDbContext_ropsten dotnet ef database update -c SqlServerBlockchainDbContext_rinkeby dotnet ef database update -c SqlServerBlockchainDbContext_kovan -dotnet ef database update -c SqlServerBlockchainDbContext_main \ No newline at end of file +dotnet ef database update -c SqlServerBlockchainDbContext_main +dotnet ef database update -c SqlServerBlockchainDbContext_goerli +dotnet ef database update -c SqlServerBlockchainDbContext_sepolia \ No newline at end of file diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/GenerateDbCreationScripts.bat b/src/Nethereum.BlockchainStore.EFCore.SqlServer/GenerateDbCreationScripts.bat index 80cf452..5e7c34e 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/GenerateDbCreationScripts.bat +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/GenerateDbCreationScripts.bat @@ -3,4 +3,6 @@ dotnet ef migrations script --context SqlServerBlockchainDbContext_localhost --o dotnet ef migrations script --context SqlServerBlockchainDbContext_kovan --output ./Sql/SqlServerBlockchainDbContext_kovan.sql dotnet ef migrations script --context SqlServerBlockchainDbContext_rinkeby --output ./Sql/SqlServerBlockchainDbContext_rinkeby.sql dotnet ef migrations script --context SqlServerBlockchainDbContext_ropsten --output ./Sql/SqlServerBlockchainDbContext_ropsten.sql -dotnet ef migrations script --context SqlServerBlockchainDbContext_main --output ./Sql/SqlServerBlockchainDbContext_main.sql \ No newline at end of file +dotnet ef migrations script --context SqlServerBlockchainDbContext_main --output ./Sql/SqlServerBlockchainDbContext_main.sql +dotnet ef migrations script --context SqlServerBlockchainDbContext_goerli --output ./Sql/SqlServerBlockchainDbContext_goerli.sql +dotnet ef migrations script --context SqlServerBlockchainDbContext_sepolia --output ./Sql/SqlServerBlockchainDbContext_sepolia.sql \ No newline at end of file diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_dboModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_dboModelSnapshot.cs deleted file mode 100644 index f3c6c89..0000000 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_dboModelSnapshot.cs +++ /dev/null @@ -1,346 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Nethereum.BlockchainStore.EFCore.SqlServer; - -namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations -{ - [DbContext(typeof(SqlServerBlockchainDbContext_dbo))] - partial class SqlServerBlockchainDbContext_dboModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("dbo") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(43); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Hash"); - - b.HasIndex("BlockNumber", "Hash", "Address") - .IsUnique(); - - b.ToTable("AddressTransactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Difficulty") - .HasMaxLength(100); - - b.Property("ExtraData"); - - b.Property("GasLimit") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Miner") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ParentHash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("Size") - .HasMaxLength(100); - - b.Property("Timestamp") - .HasMaxLength(100); - - b.Property("TotalDifficulty") - .HasMaxLength(100); - - b.Property("TransactionCount"); - - b.HasKey("RowIndex"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LastBlockProcessed") - .IsRequired() - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("LastBlockProcessed"); - - b.ToTable("BlockProgress"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ABI") - .HasColumnType("nvarchar(max)"); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Code") - .HasColumnType("nvarchar(max)"); - - b.Property("Creator") - .HasMaxLength(43); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Name") - .IsUnique() - .HasFilter("[Name] IS NOT NULL"); - - b.ToTable("Contracts"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AddressFrom") - .HasMaxLength(43); - - b.Property("AddressTo") - .HasMaxLength(43); - - b.Property("BlockHash") - .HasMaxLength(67); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("CumulativeGasUsed") - .HasMaxLength(100); - - b.Property("Error") - .HasColumnType("nvarchar(max)"); - - b.Property("Failed"); - - b.Property("FailedCreateContract"); - - b.Property("Gas") - .HasMaxLength(100); - - b.Property("GasPrice") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("HasLog"); - - b.Property("HasVmStack"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Input") - .HasColumnType("nvarchar(max)"); - - b.Property("NewContractAddress") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ReceiptHash") - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TimeStamp") - .HasMaxLength(100); - - b.Property("TransactionIndex") - .HasMaxLength(100); - - b.Property("Value") - .HasMaxLength(100); - - b.HasKey("RowIndex"); - - b.HasIndex("AddressFrom"); - - b.HasIndex("AddressTo"); - - b.HasIndex("Hash"); - - b.HasIndex("NewContractAddress"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Transactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Data") - .HasColumnType("nvarchar(max)"); - - b.Property("EventHash") - .HasMaxLength(67); - - b.Property("IndexVal1") - .HasMaxLength(67); - - b.Property("IndexVal2") - .HasMaxLength(67); - - b.Property("IndexVal3") - .HasMaxLength(67); - - b.Property("LogIndex") - .HasMaxLength(100); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .IsRequired() - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("EventHash"); - - b.HasIndex("IndexVal1"); - - b.HasIndex("IndexVal2"); - - b.HasIndex("IndexVal3"); - - b.HasIndex("TransactionHash", "LogIndex") - .IsUnique() - .HasFilter("[LogIndex] IS NOT NULL"); - - b.ToTable("TransactionLogs"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("StructLogs") - .HasColumnType("nvarchar(max)"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("TransactionHash"); - - b.ToTable("TransactionLogVmStacks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/20221014164544_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/20221014164544_InitialCreate.Designer.cs new file mode 100644 index 0000000..2845d88 --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/20221014164544_InitialCreate.Designer.cs @@ -0,0 +1,444 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_goerliMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_goerli))] + [Migration("20221014164544_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("goerli") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "goerli"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/20221014164544_InitialCreate.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/20221014164544_InitialCreate.cs new file mode 100644 index 0000000..a161638 --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/20221014164544_InitialCreate.cs @@ -0,0 +1,338 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_goerliMigrations +{ + public partial class InitialCreate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "goerli"); + + migrationBuilder.CreateTable( + name: "AddressTransactions", + schema: "goerli", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AddressTransactions", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "BlockProgress", + schema: "goerli", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastBlockProcessed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BlockProgress", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "Blocks", + schema: "goerli", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + ParentHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExtraData = table.Column(type: "nvarchar(max)", nullable: true), + Difficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TotalDifficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Size = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Miner = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + GasLimit = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Timestamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionCount = table.Column(type: "bigint", nullable: false), + BaseFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Blocks", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "Contracts", + schema: "goerli", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), + ABI = table.Column(type: "nvarchar(max)", nullable: true), + Code = table.Column(type: "nvarchar(max)", nullable: true), + Creator = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Contracts", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "TransactionLogs", + schema: "goerli", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + LogIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + EventHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal1 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal2 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal3 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + Data = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TransactionLogs", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "TransactionLogVmStacks", + schema: "goerli", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + StructLogs = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TransactionLogVmStacks", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "Transactions", + schema: "goerli", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true), + BlockHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + AddressFrom = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TimeStamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Value = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AddressTo = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Gas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Input = table.Column(type: "nvarchar(max)", nullable: true), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Failed = table.Column(type: "bit", nullable: false), + ReceiptHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + CumulativeGasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + EffectiveGasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + HasLog = table.Column(type: "bit", nullable: false), + Error = table.Column(type: "nvarchar(max)", nullable: true), + HasVmStack = table.Column(type: "bit", nullable: false), + NewContractAddress = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + FailedCreateContract = table.Column(type: "bit", nullable: false), + MaxFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + MaxPriorityFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Transactions", x => x.RowIndex); + }); + + migrationBuilder.CreateIndex( + name: "IX_AddressTransactions_Address", + schema: "goerli", + table: "AddressTransactions", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_AddressTransactions_BlockNumber_Hash_Address", + schema: "goerli", + table: "AddressTransactions", + columns: new[] { "BlockNumber", "Hash", "Address" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AddressTransactions_Hash", + schema: "goerli", + table: "AddressTransactions", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_BlockProgress_LastBlockProcessed", + schema: "goerli", + table: "BlockProgress", + column: "LastBlockProcessed"); + + migrationBuilder.CreateIndex( + name: "IX_Blocks_BlockNumber_Hash", + schema: "goerli", + table: "Blocks", + columns: new[] { "BlockNumber", "Hash" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Contracts_Address", + schema: "goerli", + table: "Contracts", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_Contracts_Name", + schema: "goerli", + table: "Contracts", + column: "Name", + unique: true, + filter: "[Name] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_Address", + schema: "goerli", + table: "TransactionLogs", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_EventHash", + schema: "goerli", + table: "TransactionLogs", + column: "EventHash"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_IndexVal1", + schema: "goerli", + table: "TransactionLogs", + column: "IndexVal1"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_IndexVal2", + schema: "goerli", + table: "TransactionLogs", + column: "IndexVal2"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_IndexVal3", + schema: "goerli", + table: "TransactionLogs", + column: "IndexVal3"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_TransactionHash_LogIndex", + schema: "goerli", + table: "TransactionLogs", + columns: new[] { "TransactionHash", "LogIndex" }, + unique: true, + filter: "[LogIndex] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogVmStacks_Address", + schema: "goerli", + table: "TransactionLogVmStacks", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogVmStacks_TransactionHash", + schema: "goerli", + table: "TransactionLogVmStacks", + column: "TransactionHash"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_AddressFrom", + schema: "goerli", + table: "Transactions", + column: "AddressFrom"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_AddressTo", + schema: "goerli", + table: "Transactions", + column: "AddressTo"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_BlockNumber_Hash", + schema: "goerli", + table: "Transactions", + columns: new[] { "BlockNumber", "Hash" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_Hash", + schema: "goerli", + table: "Transactions", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_NewContractAddress", + schema: "goerli", + table: "Transactions", + column: "NewContractAddress"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AddressTransactions", + schema: "goerli"); + + migrationBuilder.DropTable( + name: "BlockProgress", + schema: "goerli"); + + migrationBuilder.DropTable( + name: "Blocks", + schema: "goerli"); + + migrationBuilder.DropTable( + name: "Contracts", + schema: "goerli"); + + migrationBuilder.DropTable( + name: "TransactionLogs", + schema: "goerli"); + + migrationBuilder.DropTable( + name: "TransactionLogVmStacks", + schema: "goerli"); + + migrationBuilder.DropTable( + name: "Transactions", + schema: "goerli"); + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/SqlServerBlockchainDbContext_goerliModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/SqlServerBlockchainDbContext_goerliModelSnapshot.cs new file mode 100644 index 0000000..4422d30 --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_goerliMigrations/SqlServerBlockchainDbContext_goerliModelSnapshot.cs @@ -0,0 +1,442 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_goerliMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_goerli))] + partial class SqlServerBlockchainDbContext_goerliModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("goerli") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "goerli"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "goerli"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20190712143012_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20190712143012_InitialCreate.Designer.cs deleted file mode 100644 index 621e8c6..0000000 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20190712143012_InitialCreate.Designer.cs +++ /dev/null @@ -1,348 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Nethereum.BlockchainStore.EFCore.SqlServer; - -namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_kovanMigrations -{ - [DbContext(typeof(SqlServerBlockchainDbContext_kovan))] - [Migration("20190712143012_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("kovan") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(43); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Hash"); - - b.HasIndex("BlockNumber", "Hash", "Address") - .IsUnique(); - - b.ToTable("AddressTransactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Difficulty") - .HasMaxLength(100); - - b.Property("ExtraData"); - - b.Property("GasLimit") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Miner") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ParentHash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("Size") - .HasMaxLength(100); - - b.Property("Timestamp") - .HasMaxLength(100); - - b.Property("TotalDifficulty") - .HasMaxLength(100); - - b.Property("TransactionCount"); - - b.HasKey("RowIndex"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LastBlockProcessed") - .IsRequired() - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("LastBlockProcessed"); - - b.ToTable("BlockProgress"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ABI") - .HasColumnType("nvarchar(max)"); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Code") - .HasColumnType("nvarchar(max)"); - - b.Property("Creator") - .HasMaxLength(43); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Name") - .IsUnique() - .HasFilter("[Name] IS NOT NULL"); - - b.ToTable("Contracts"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AddressFrom") - .HasMaxLength(43); - - b.Property("AddressTo") - .HasMaxLength(43); - - b.Property("BlockHash") - .HasMaxLength(67); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("CumulativeGasUsed") - .HasMaxLength(100); - - b.Property("Error") - .HasColumnType("nvarchar(max)"); - - b.Property("Failed"); - - b.Property("FailedCreateContract"); - - b.Property("Gas") - .HasMaxLength(100); - - b.Property("GasPrice") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("HasLog"); - - b.Property("HasVmStack"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Input") - .HasColumnType("nvarchar(max)"); - - b.Property("NewContractAddress") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ReceiptHash") - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TimeStamp") - .HasMaxLength(100); - - b.Property("TransactionIndex") - .HasMaxLength(100); - - b.Property("Value") - .HasMaxLength(100); - - b.HasKey("RowIndex"); - - b.HasIndex("AddressFrom"); - - b.HasIndex("AddressTo"); - - b.HasIndex("Hash"); - - b.HasIndex("NewContractAddress"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Transactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Data") - .HasColumnType("nvarchar(max)"); - - b.Property("EventHash") - .HasMaxLength(67); - - b.Property("IndexVal1") - .HasMaxLength(67); - - b.Property("IndexVal2") - .HasMaxLength(67); - - b.Property("IndexVal3") - .HasMaxLength(67); - - b.Property("LogIndex") - .HasMaxLength(100); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .IsRequired() - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("EventHash"); - - b.HasIndex("IndexVal1"); - - b.HasIndex("IndexVal2"); - - b.HasIndex("IndexVal3"); - - b.HasIndex("TransactionHash", "LogIndex") - .IsUnique() - .HasFilter("[LogIndex] IS NOT NULL"); - - b.ToTable("TransactionLogs"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("StructLogs") - .HasColumnType("nvarchar(max)"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("TransactionHash"); - - b.ToTable("TransactionLogVmStacks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20221014164534_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20221014164534_InitialCreate.Designer.cs new file mode 100644 index 0000000..121dd7c --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20221014164534_InitialCreate.Designer.cs @@ -0,0 +1,444 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_kovanMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_kovan))] + [Migration("20221014164534_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("kovan") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "kovan"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "kovan"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "kovan"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "kovan"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "kovan"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "kovan"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "kovan"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20190712143012_InitialCreate.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20221014164534_InitialCreate.cs similarity index 52% rename from src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20190712143012_InitialCreate.cs rename to src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20221014164534_InitialCreate.cs index e1b8f9e..d59753f 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20190712143012_InitialCreate.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/20221014164534_InitialCreate.cs @@ -1,7 +1,8 @@ using System; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_kovanMigrations { public partial class InitialCreate : Migration @@ -16,13 +17,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "kovan", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - Address = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -34,11 +35,11 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "kovan", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - LastBlockProcessed = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastBlockProcessed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -50,23 +51,24 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "kovan", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - ParentHash = table.Column(maxLength: 67, nullable: false), - Nonce = table.Column(maxLength: 100, nullable: true), - ExtraData = table.Column(nullable: true), - Difficulty = table.Column(maxLength: 100, nullable: true), - TotalDifficulty = table.Column(maxLength: 100, nullable: true), - Size = table.Column(maxLength: 100, nullable: true), - Miner = table.Column(maxLength: 43, nullable: true), - GasLimit = table.Column(maxLength: 100, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - Timestamp = table.Column(maxLength: 100, nullable: true), - TransactionCount = table.Column(nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + ParentHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExtraData = table.Column(type: "nvarchar(max)", nullable: true), + Difficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TotalDifficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Size = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Miner = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + GasLimit = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Timestamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionCount = table.Column(type: "bigint", nullable: false), + BaseFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -78,16 +80,16 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "kovan", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - Name = table.Column(maxLength: 255, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), ABI = table.Column(type: "nvarchar(max)", nullable: true), Code = table.Column(type: "nvarchar(max)", nullable: true), - Creator = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true) + Creator = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -99,18 +101,18 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "kovan", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: false), - LogIndex = table.Column(maxLength: 100, nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - EventHash = table.Column(maxLength: 67, nullable: true), - IndexVal1 = table.Column(maxLength: 67, nullable: true), - IndexVal2 = table.Column(maxLength: 67, nullable: true), - IndexVal3 = table.Column(maxLength: 67, nullable: true), - Data = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + LogIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + EventHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal1 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal2 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal3 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + Data = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -122,13 +124,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "kovan", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true), - StructLogs = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + StructLogs = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -140,31 +142,34 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "kovan", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockHash = table.Column(maxLength: 67, nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - AddressFrom = table.Column(maxLength: 43, nullable: true), - TimeStamp = table.Column(maxLength: 100, nullable: true), - TransactionIndex = table.Column(maxLength: 100, nullable: true), - Value = table.Column(maxLength: 100, nullable: true), - AddressTo = table.Column(maxLength: 43, nullable: true), - Gas = table.Column(maxLength: 100, nullable: true), - GasPrice = table.Column(maxLength: 100, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true), + BlockHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + AddressFrom = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TimeStamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Value = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AddressTo = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Gas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), Input = table.Column(type: "nvarchar(max)", nullable: true), - Nonce = table.Column(maxLength: 100, nullable: true), - Failed = table.Column(nullable: false), - ReceiptHash = table.Column(maxLength: 67, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - CumulativeGasUsed = table.Column(maxLength: 100, nullable: true), - HasLog = table.Column(nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Failed = table.Column(type: "bit", nullable: false), + ReceiptHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + CumulativeGasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + EffectiveGasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + HasLog = table.Column(type: "bit", nullable: false), Error = table.Column(type: "nvarchar(max)", nullable: true), - HasVmStack = table.Column(nullable: false), - NewContractAddress = table.Column(maxLength: 43, nullable: true), - FailedCreateContract = table.Column(nullable: false) + HasVmStack = table.Column(type: "bit", nullable: false), + NewContractAddress = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + FailedCreateContract = table.Column(type: "bit", nullable: false), + MaxFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + MaxPriorityFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) }, constraints: table => { @@ -178,17 +183,17 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Address"); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_Hash", + name: "IX_AddressTransactions_BlockNumber_Hash_Address", schema: "kovan", table: "AddressTransactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash", "Address" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_BlockNumber_Hash_Address", + name: "IX_AddressTransactions_Hash", schema: "kovan", table: "AddressTransactions", - columns: new[] { "BlockNumber", "Hash", "Address" }, - unique: true); + column: "Hash"); migrationBuilder.CreateIndex( name: "IX_BlockProgress_LastBlockProcessed", @@ -280,23 +285,23 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "AddressTo"); migrationBuilder.CreateIndex( - name: "IX_Transactions_Hash", + name: "IX_Transactions_BlockNumber_Hash", schema: "kovan", table: "Transactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_Transactions_NewContractAddress", + name: "IX_Transactions_Hash", schema: "kovan", table: "Transactions", - column: "NewContractAddress"); + column: "Hash"); migrationBuilder.CreateIndex( - name: "IX_Transactions_BlockNumber_Hash", + name: "IX_Transactions_NewContractAddress", schema: "kovan", table: "Transactions", - columns: new[] { "BlockNumber", "Hash" }, - unique: true); + column: "NewContractAddress"); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/SqlServerBlockchainDbContext_kovanModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/SqlServerBlockchainDbContext_kovanModelSnapshot.cs index 30d5117..f6cfe34 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/SqlServerBlockchainDbContext_kovanModelSnapshot.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_kovanMigrations/SqlServerBlockchainDbContext_kovanModelSnapshot.cs @@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Nethereum.BlockchainStore.EFCore.SqlServer; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_kovanMigrations { [DbContext(typeof(SqlServerBlockchainDbContext_kovan))] @@ -16,31 +18,39 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("kovan") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); @@ -51,115 +61,149 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash", "Address") .IsUnique(); - b.ToTable("AddressTransactions"); + b.ToTable("AddressTransactions", "kovan"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Difficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("ExtraData"); + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); b.Property("GasLimit") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Miner") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ParentHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("Size") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Timestamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TotalDifficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("TransactionCount"); + b.Property("TransactionCount") + .HasColumnType("bigint"); b.HasKey("RowIndex"); b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Blocks"); + b.ToTable("Blocks", "kovan"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("LastBlockProcessed") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); b.HasIndex("LastBlockProcessed"); - b.ToTable("BlockProgress"); + b.ToTable("BlockProgress", "kovan"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("ABI") .HasColumnType("nvarchar(max)"); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Code") .HasColumnType("nvarchar(max)"); b.Property("Creator") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Name") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -169,79 +213,114 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[Name] IS NOT NULL"); - b.ToTable("Contracts"); + b.ToTable("Contracts", "kovan"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("AddressFrom") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("AddressTo") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("CumulativeGasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Error") .HasColumnType("nvarchar(max)"); - b.Property("Failed"); + b.Property("Failed") + .HasColumnType("bit"); - b.Property("FailedCreateContract"); + b.Property("FailedCreateContract") + .HasColumnType("bit"); b.Property("Gas") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasPrice") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("HasLog"); + b.Property("HasLog") + .HasColumnType("bit"); - b.Property("HasVmStack"); + b.Property("HasVmStack") + .HasColumnType("bit"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Input") .HasColumnType("nvarchar(max)"); + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("NewContractAddress") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ReceiptHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TimeStamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TransactionIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Value") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("RowIndex"); @@ -256,43 +335,54 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Transactions"); + b.ToTable("Transactions", "kovan"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Data") .HasColumnType("nvarchar(max)"); b.Property("EventHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal1") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal2") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal3") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("LogIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -310,27 +400,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[LogIndex] IS NOT NULL"); - b.ToTable("TransactionLogs"); + b.ToTable("TransactionLogs", "kovan"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("StructLogs") .HasColumnType("nvarchar(max)"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -338,7 +434,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TransactionHash"); - b.ToTable("TransactionLogVmStacks"); + b.ToTable("TransactionLogVmStacks", "kovan"); }); #pragma warning restore 612, 618 } diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20190712142920_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20190712142920_InitialCreate.Designer.cs deleted file mode 100644 index 416f2eb..0000000 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20190712142920_InitialCreate.Designer.cs +++ /dev/null @@ -1,348 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Nethereum.BlockchainStore.EFCore.SqlServer; - -namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_localhostMigrations -{ - [DbContext(typeof(SqlServerBlockchainDbContext_localhost))] - [Migration("20190712142920_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("localhost") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(43); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Hash"); - - b.HasIndex("BlockNumber", "Hash", "Address") - .IsUnique(); - - b.ToTable("AddressTransactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Difficulty") - .HasMaxLength(100); - - b.Property("ExtraData"); - - b.Property("GasLimit") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Miner") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ParentHash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("Size") - .HasMaxLength(100); - - b.Property("Timestamp") - .HasMaxLength(100); - - b.Property("TotalDifficulty") - .HasMaxLength(100); - - b.Property("TransactionCount"); - - b.HasKey("RowIndex"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LastBlockProcessed") - .IsRequired() - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("LastBlockProcessed"); - - b.ToTable("BlockProgress"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ABI") - .HasColumnType("nvarchar(max)"); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Code") - .HasColumnType("nvarchar(max)"); - - b.Property("Creator") - .HasMaxLength(43); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Name") - .IsUnique() - .HasFilter("[Name] IS NOT NULL"); - - b.ToTable("Contracts"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AddressFrom") - .HasMaxLength(43); - - b.Property("AddressTo") - .HasMaxLength(43); - - b.Property("BlockHash") - .HasMaxLength(67); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("CumulativeGasUsed") - .HasMaxLength(100); - - b.Property("Error") - .HasColumnType("nvarchar(max)"); - - b.Property("Failed"); - - b.Property("FailedCreateContract"); - - b.Property("Gas") - .HasMaxLength(100); - - b.Property("GasPrice") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("HasLog"); - - b.Property("HasVmStack"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Input") - .HasColumnType("nvarchar(max)"); - - b.Property("NewContractAddress") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ReceiptHash") - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TimeStamp") - .HasMaxLength(100); - - b.Property("TransactionIndex") - .HasMaxLength(100); - - b.Property("Value") - .HasMaxLength(100); - - b.HasKey("RowIndex"); - - b.HasIndex("AddressFrom"); - - b.HasIndex("AddressTo"); - - b.HasIndex("Hash"); - - b.HasIndex("NewContractAddress"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Transactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Data") - .HasColumnType("nvarchar(max)"); - - b.Property("EventHash") - .HasMaxLength(67); - - b.Property("IndexVal1") - .HasMaxLength(67); - - b.Property("IndexVal2") - .HasMaxLength(67); - - b.Property("IndexVal3") - .HasMaxLength(67); - - b.Property("LogIndex") - .HasMaxLength(100); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .IsRequired() - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("EventHash"); - - b.HasIndex("IndexVal1"); - - b.HasIndex("IndexVal2"); - - b.HasIndex("IndexVal3"); - - b.HasIndex("TransactionHash", "LogIndex") - .IsUnique() - .HasFilter("[LogIndex] IS NOT NULL"); - - b.ToTable("TransactionLogs"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("StructLogs") - .HasColumnType("nvarchar(max)"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("TransactionHash"); - - b.ToTable("TransactionLogVmStacks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20221014164518_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20221014164518_InitialCreate.Designer.cs new file mode 100644 index 0000000..ca30364 --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20221014164518_InitialCreate.Designer.cs @@ -0,0 +1,444 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_localhostMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_localhost))] + [Migration("20221014164518_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("localhost") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "localhost"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "localhost"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "localhost"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "localhost"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "localhost"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "localhost"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "localhost"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20190712142920_InitialCreate.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20221014164518_InitialCreate.cs similarity index 52% rename from src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20190712142920_InitialCreate.cs rename to src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20221014164518_InitialCreate.cs index 4f783cd..499abb2 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20190712142920_InitialCreate.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/20221014164518_InitialCreate.cs @@ -1,7 +1,8 @@ using System; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_localhostMigrations { public partial class InitialCreate : Migration @@ -16,13 +17,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "localhost", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - Address = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -34,11 +35,11 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "localhost", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - LastBlockProcessed = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastBlockProcessed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -50,23 +51,24 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "localhost", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - ParentHash = table.Column(maxLength: 67, nullable: false), - Nonce = table.Column(maxLength: 100, nullable: true), - ExtraData = table.Column(nullable: true), - Difficulty = table.Column(maxLength: 100, nullable: true), - TotalDifficulty = table.Column(maxLength: 100, nullable: true), - Size = table.Column(maxLength: 100, nullable: true), - Miner = table.Column(maxLength: 43, nullable: true), - GasLimit = table.Column(maxLength: 100, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - Timestamp = table.Column(maxLength: 100, nullable: true), - TransactionCount = table.Column(nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + ParentHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExtraData = table.Column(type: "nvarchar(max)", nullable: true), + Difficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TotalDifficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Size = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Miner = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + GasLimit = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Timestamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionCount = table.Column(type: "bigint", nullable: false), + BaseFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -78,16 +80,16 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "localhost", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - Name = table.Column(maxLength: 255, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), ABI = table.Column(type: "nvarchar(max)", nullable: true), Code = table.Column(type: "nvarchar(max)", nullable: true), - Creator = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true) + Creator = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -99,18 +101,18 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "localhost", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: false), - LogIndex = table.Column(maxLength: 100, nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - EventHash = table.Column(maxLength: 67, nullable: true), - IndexVal1 = table.Column(maxLength: 67, nullable: true), - IndexVal2 = table.Column(maxLength: 67, nullable: true), - IndexVal3 = table.Column(maxLength: 67, nullable: true), - Data = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + LogIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + EventHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal1 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal2 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal3 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + Data = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -122,13 +124,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "localhost", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true), - StructLogs = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + StructLogs = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -140,31 +142,34 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "localhost", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockHash = table.Column(maxLength: 67, nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - AddressFrom = table.Column(maxLength: 43, nullable: true), - TimeStamp = table.Column(maxLength: 100, nullable: true), - TransactionIndex = table.Column(maxLength: 100, nullable: true), - Value = table.Column(maxLength: 100, nullable: true), - AddressTo = table.Column(maxLength: 43, nullable: true), - Gas = table.Column(maxLength: 100, nullable: true), - GasPrice = table.Column(maxLength: 100, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true), + BlockHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + AddressFrom = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TimeStamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Value = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AddressTo = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Gas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), Input = table.Column(type: "nvarchar(max)", nullable: true), - Nonce = table.Column(maxLength: 100, nullable: true), - Failed = table.Column(nullable: false), - ReceiptHash = table.Column(maxLength: 67, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - CumulativeGasUsed = table.Column(maxLength: 100, nullable: true), - HasLog = table.Column(nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Failed = table.Column(type: "bit", nullable: false), + ReceiptHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + CumulativeGasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + EffectiveGasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + HasLog = table.Column(type: "bit", nullable: false), Error = table.Column(type: "nvarchar(max)", nullable: true), - HasVmStack = table.Column(nullable: false), - NewContractAddress = table.Column(maxLength: 43, nullable: true), - FailedCreateContract = table.Column(nullable: false) + HasVmStack = table.Column(type: "bit", nullable: false), + NewContractAddress = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + FailedCreateContract = table.Column(type: "bit", nullable: false), + MaxFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + MaxPriorityFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) }, constraints: table => { @@ -178,17 +183,17 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Address"); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_Hash", + name: "IX_AddressTransactions_BlockNumber_Hash_Address", schema: "localhost", table: "AddressTransactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash", "Address" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_BlockNumber_Hash_Address", + name: "IX_AddressTransactions_Hash", schema: "localhost", table: "AddressTransactions", - columns: new[] { "BlockNumber", "Hash", "Address" }, - unique: true); + column: "Hash"); migrationBuilder.CreateIndex( name: "IX_BlockProgress_LastBlockProcessed", @@ -280,23 +285,23 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "AddressTo"); migrationBuilder.CreateIndex( - name: "IX_Transactions_Hash", + name: "IX_Transactions_BlockNumber_Hash", schema: "localhost", table: "Transactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_Transactions_NewContractAddress", + name: "IX_Transactions_Hash", schema: "localhost", table: "Transactions", - column: "NewContractAddress"); + column: "Hash"); migrationBuilder.CreateIndex( - name: "IX_Transactions_BlockNumber_Hash", + name: "IX_Transactions_NewContractAddress", schema: "localhost", table: "Transactions", - columns: new[] { "BlockNumber", "Hash" }, - unique: true); + column: "NewContractAddress"); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/SqlServerBlockchainDbContext_localhostModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/SqlServerBlockchainDbContext_localhostModelSnapshot.cs index 8b6a132..228bff2 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/SqlServerBlockchainDbContext_localhostModelSnapshot.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_localhostMigrations/SqlServerBlockchainDbContext_localhostModelSnapshot.cs @@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Nethereum.BlockchainStore.EFCore.SqlServer; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_localhostMigrations { [DbContext(typeof(SqlServerBlockchainDbContext_localhost))] @@ -16,31 +18,39 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("localhost") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); @@ -51,115 +61,149 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash", "Address") .IsUnique(); - b.ToTable("AddressTransactions"); + b.ToTable("AddressTransactions", "localhost"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Difficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("ExtraData"); + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); b.Property("GasLimit") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Miner") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ParentHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("Size") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Timestamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TotalDifficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("TransactionCount"); + b.Property("TransactionCount") + .HasColumnType("bigint"); b.HasKey("RowIndex"); b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Blocks"); + b.ToTable("Blocks", "localhost"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("LastBlockProcessed") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); b.HasIndex("LastBlockProcessed"); - b.ToTable("BlockProgress"); + b.ToTable("BlockProgress", "localhost"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("ABI") .HasColumnType("nvarchar(max)"); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Code") .HasColumnType("nvarchar(max)"); b.Property("Creator") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Name") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -169,79 +213,114 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[Name] IS NOT NULL"); - b.ToTable("Contracts"); + b.ToTable("Contracts", "localhost"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("AddressFrom") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("AddressTo") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("CumulativeGasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Error") .HasColumnType("nvarchar(max)"); - b.Property("Failed"); + b.Property("Failed") + .HasColumnType("bit"); - b.Property("FailedCreateContract"); + b.Property("FailedCreateContract") + .HasColumnType("bit"); b.Property("Gas") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasPrice") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("HasLog"); + b.Property("HasLog") + .HasColumnType("bit"); - b.Property("HasVmStack"); + b.Property("HasVmStack") + .HasColumnType("bit"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Input") .HasColumnType("nvarchar(max)"); + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("NewContractAddress") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ReceiptHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TimeStamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TransactionIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Value") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("RowIndex"); @@ -256,43 +335,54 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Transactions"); + b.ToTable("Transactions", "localhost"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Data") .HasColumnType("nvarchar(max)"); b.Property("EventHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal1") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal2") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal3") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("LogIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -310,27 +400,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[LogIndex] IS NOT NULL"); - b.ToTable("TransactionLogs"); + b.ToTable("TransactionLogs", "localhost"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("StructLogs") .HasColumnType("nvarchar(max)"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -338,7 +434,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TransactionHash"); - b.ToTable("TransactionLogVmStacks"); + b.ToTable("TransactionLogVmStacks", "localhost"); }); #pragma warning restore 612, 618 } diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20190712143029_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20190712143029_InitialCreate.Designer.cs deleted file mode 100644 index 573bcab..0000000 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20190712143029_InitialCreate.Designer.cs +++ /dev/null @@ -1,348 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Nethereum.BlockchainStore.EFCore.SqlServer; - -namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_mainMigrations -{ - [DbContext(typeof(SqlServerBlockchainDbContext_main))] - [Migration("20190712143029_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("main") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(43); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Hash"); - - b.HasIndex("BlockNumber", "Hash", "Address") - .IsUnique(); - - b.ToTable("AddressTransactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Difficulty") - .HasMaxLength(100); - - b.Property("ExtraData"); - - b.Property("GasLimit") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Miner") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ParentHash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("Size") - .HasMaxLength(100); - - b.Property("Timestamp") - .HasMaxLength(100); - - b.Property("TotalDifficulty") - .HasMaxLength(100); - - b.Property("TransactionCount"); - - b.HasKey("RowIndex"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LastBlockProcessed") - .IsRequired() - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("LastBlockProcessed"); - - b.ToTable("BlockProgress"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ABI") - .HasColumnType("nvarchar(max)"); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Code") - .HasColumnType("nvarchar(max)"); - - b.Property("Creator") - .HasMaxLength(43); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Name") - .IsUnique() - .HasFilter("[Name] IS NOT NULL"); - - b.ToTable("Contracts"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AddressFrom") - .HasMaxLength(43); - - b.Property("AddressTo") - .HasMaxLength(43); - - b.Property("BlockHash") - .HasMaxLength(67); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("CumulativeGasUsed") - .HasMaxLength(100); - - b.Property("Error") - .HasColumnType("nvarchar(max)"); - - b.Property("Failed"); - - b.Property("FailedCreateContract"); - - b.Property("Gas") - .HasMaxLength(100); - - b.Property("GasPrice") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("HasLog"); - - b.Property("HasVmStack"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Input") - .HasColumnType("nvarchar(max)"); - - b.Property("NewContractAddress") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ReceiptHash") - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TimeStamp") - .HasMaxLength(100); - - b.Property("TransactionIndex") - .HasMaxLength(100); - - b.Property("Value") - .HasMaxLength(100); - - b.HasKey("RowIndex"); - - b.HasIndex("AddressFrom"); - - b.HasIndex("AddressTo"); - - b.HasIndex("Hash"); - - b.HasIndex("NewContractAddress"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Transactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Data") - .HasColumnType("nvarchar(max)"); - - b.Property("EventHash") - .HasMaxLength(67); - - b.Property("IndexVal1") - .HasMaxLength(67); - - b.Property("IndexVal2") - .HasMaxLength(67); - - b.Property("IndexVal3") - .HasMaxLength(67); - - b.Property("LogIndex") - .HasMaxLength(100); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .IsRequired() - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("EventHash"); - - b.HasIndex("IndexVal1"); - - b.HasIndex("IndexVal2"); - - b.HasIndex("IndexVal3"); - - b.HasIndex("TransactionHash", "LogIndex") - .IsUnique() - .HasFilter("[LogIndex] IS NOT NULL"); - - b.ToTable("TransactionLogs"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("StructLogs") - .HasColumnType("nvarchar(max)"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("TransactionHash"); - - b.ToTable("TransactionLogVmStacks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20221014164539_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20221014164539_InitialCreate.Designer.cs new file mode 100644 index 0000000..2053c84 --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20221014164539_InitialCreate.Designer.cs @@ -0,0 +1,444 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_mainMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_main))] + [Migration("20221014164539_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("main") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "main"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "main"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "main"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "main"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "main"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "main"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "main"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20190712143029_InitialCreate.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20221014164539_InitialCreate.cs similarity index 52% rename from src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20190712143029_InitialCreate.cs rename to src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20221014164539_InitialCreate.cs index 3c29216..abcffff 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20190712143029_InitialCreate.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/20221014164539_InitialCreate.cs @@ -1,7 +1,8 @@ using System; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_mainMigrations { public partial class InitialCreate : Migration @@ -16,13 +17,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "main", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - Address = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -34,11 +35,11 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "main", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - LastBlockProcessed = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastBlockProcessed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -50,23 +51,24 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "main", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - ParentHash = table.Column(maxLength: 67, nullable: false), - Nonce = table.Column(maxLength: 100, nullable: true), - ExtraData = table.Column(nullable: true), - Difficulty = table.Column(maxLength: 100, nullable: true), - TotalDifficulty = table.Column(maxLength: 100, nullable: true), - Size = table.Column(maxLength: 100, nullable: true), - Miner = table.Column(maxLength: 43, nullable: true), - GasLimit = table.Column(maxLength: 100, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - Timestamp = table.Column(maxLength: 100, nullable: true), - TransactionCount = table.Column(nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + ParentHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExtraData = table.Column(type: "nvarchar(max)", nullable: true), + Difficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TotalDifficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Size = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Miner = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + GasLimit = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Timestamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionCount = table.Column(type: "bigint", nullable: false), + BaseFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -78,16 +80,16 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "main", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - Name = table.Column(maxLength: 255, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), ABI = table.Column(type: "nvarchar(max)", nullable: true), Code = table.Column(type: "nvarchar(max)", nullable: true), - Creator = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true) + Creator = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -99,18 +101,18 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "main", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: false), - LogIndex = table.Column(maxLength: 100, nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - EventHash = table.Column(maxLength: 67, nullable: true), - IndexVal1 = table.Column(maxLength: 67, nullable: true), - IndexVal2 = table.Column(maxLength: 67, nullable: true), - IndexVal3 = table.Column(maxLength: 67, nullable: true), - Data = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + LogIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + EventHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal1 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal2 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal3 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + Data = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -122,13 +124,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "main", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true), - StructLogs = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + StructLogs = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -140,31 +142,34 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "main", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockHash = table.Column(maxLength: 67, nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - AddressFrom = table.Column(maxLength: 43, nullable: true), - TimeStamp = table.Column(maxLength: 100, nullable: true), - TransactionIndex = table.Column(maxLength: 100, nullable: true), - Value = table.Column(maxLength: 100, nullable: true), - AddressTo = table.Column(maxLength: 43, nullable: true), - Gas = table.Column(maxLength: 100, nullable: true), - GasPrice = table.Column(maxLength: 100, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true), + BlockHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + AddressFrom = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TimeStamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Value = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AddressTo = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Gas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), Input = table.Column(type: "nvarchar(max)", nullable: true), - Nonce = table.Column(maxLength: 100, nullable: true), - Failed = table.Column(nullable: false), - ReceiptHash = table.Column(maxLength: 67, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - CumulativeGasUsed = table.Column(maxLength: 100, nullable: true), - HasLog = table.Column(nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Failed = table.Column(type: "bit", nullable: false), + ReceiptHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + CumulativeGasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + EffectiveGasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + HasLog = table.Column(type: "bit", nullable: false), Error = table.Column(type: "nvarchar(max)", nullable: true), - HasVmStack = table.Column(nullable: false), - NewContractAddress = table.Column(maxLength: 43, nullable: true), - FailedCreateContract = table.Column(nullable: false) + HasVmStack = table.Column(type: "bit", nullable: false), + NewContractAddress = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + FailedCreateContract = table.Column(type: "bit", nullable: false), + MaxFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + MaxPriorityFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) }, constraints: table => { @@ -178,17 +183,17 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Address"); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_Hash", + name: "IX_AddressTransactions_BlockNumber_Hash_Address", schema: "main", table: "AddressTransactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash", "Address" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_BlockNumber_Hash_Address", + name: "IX_AddressTransactions_Hash", schema: "main", table: "AddressTransactions", - columns: new[] { "BlockNumber", "Hash", "Address" }, - unique: true); + column: "Hash"); migrationBuilder.CreateIndex( name: "IX_BlockProgress_LastBlockProcessed", @@ -280,23 +285,23 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "AddressTo"); migrationBuilder.CreateIndex( - name: "IX_Transactions_Hash", + name: "IX_Transactions_BlockNumber_Hash", schema: "main", table: "Transactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_Transactions_NewContractAddress", + name: "IX_Transactions_Hash", schema: "main", table: "Transactions", - column: "NewContractAddress"); + column: "Hash"); migrationBuilder.CreateIndex( - name: "IX_Transactions_BlockNumber_Hash", + name: "IX_Transactions_NewContractAddress", schema: "main", table: "Transactions", - columns: new[] { "BlockNumber", "Hash" }, - unique: true); + column: "NewContractAddress"); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/SqlServerBlockchainDbContext_mainModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/SqlServerBlockchainDbContext_mainModelSnapshot.cs index 08ce250..feb76b8 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/SqlServerBlockchainDbContext_mainModelSnapshot.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_mainMigrations/SqlServerBlockchainDbContext_mainModelSnapshot.cs @@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Nethereum.BlockchainStore.EFCore.SqlServer; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_mainMigrations { [DbContext(typeof(SqlServerBlockchainDbContext_main))] @@ -16,31 +18,39 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("main") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); @@ -51,115 +61,149 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash", "Address") .IsUnique(); - b.ToTable("AddressTransactions"); + b.ToTable("AddressTransactions", "main"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Difficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("ExtraData"); + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); b.Property("GasLimit") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Miner") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ParentHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("Size") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Timestamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TotalDifficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("TransactionCount"); + b.Property("TransactionCount") + .HasColumnType("bigint"); b.HasKey("RowIndex"); b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Blocks"); + b.ToTable("Blocks", "main"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("LastBlockProcessed") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); b.HasIndex("LastBlockProcessed"); - b.ToTable("BlockProgress"); + b.ToTable("BlockProgress", "main"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("ABI") .HasColumnType("nvarchar(max)"); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Code") .HasColumnType("nvarchar(max)"); b.Property("Creator") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Name") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -169,79 +213,114 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[Name] IS NOT NULL"); - b.ToTable("Contracts"); + b.ToTable("Contracts", "main"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("AddressFrom") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("AddressTo") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("CumulativeGasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Error") .HasColumnType("nvarchar(max)"); - b.Property("Failed"); + b.Property("Failed") + .HasColumnType("bit"); - b.Property("FailedCreateContract"); + b.Property("FailedCreateContract") + .HasColumnType("bit"); b.Property("Gas") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasPrice") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("HasLog"); + b.Property("HasLog") + .HasColumnType("bit"); - b.Property("HasVmStack"); + b.Property("HasVmStack") + .HasColumnType("bit"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Input") .HasColumnType("nvarchar(max)"); + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("NewContractAddress") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ReceiptHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TimeStamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TransactionIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Value") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("RowIndex"); @@ -256,43 +335,54 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Transactions"); + b.ToTable("Transactions", "main"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Data") .HasColumnType("nvarchar(max)"); b.Property("EventHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal1") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal2") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal3") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("LogIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -310,27 +400,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[LogIndex] IS NOT NULL"); - b.ToTable("TransactionLogs"); + b.ToTable("TransactionLogs", "main"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("StructLogs") .HasColumnType("nvarchar(max)"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -338,7 +434,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TransactionHash"); - b.ToTable("TransactionLogVmStacks"); + b.ToTable("TransactionLogVmStacks", "main"); }); #pragma warning restore 612, 618 } diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20190712142955_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20190712142955_InitialCreate.Designer.cs deleted file mode 100644 index c4500e1..0000000 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20190712142955_InitialCreate.Designer.cs +++ /dev/null @@ -1,348 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Nethereum.BlockchainStore.EFCore.SqlServer; - -namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_rinkebyMigrations -{ - [DbContext(typeof(SqlServerBlockchainDbContext_rinkeby))] - [Migration("20190712142955_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("rinkeby") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(43); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Hash"); - - b.HasIndex("BlockNumber", "Hash", "Address") - .IsUnique(); - - b.ToTable("AddressTransactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Difficulty") - .HasMaxLength(100); - - b.Property("ExtraData"); - - b.Property("GasLimit") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Miner") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ParentHash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("Size") - .HasMaxLength(100); - - b.Property("Timestamp") - .HasMaxLength(100); - - b.Property("TotalDifficulty") - .HasMaxLength(100); - - b.Property("TransactionCount"); - - b.HasKey("RowIndex"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LastBlockProcessed") - .IsRequired() - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("LastBlockProcessed"); - - b.ToTable("BlockProgress"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ABI") - .HasColumnType("nvarchar(max)"); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Code") - .HasColumnType("nvarchar(max)"); - - b.Property("Creator") - .HasMaxLength(43); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Name") - .IsUnique() - .HasFilter("[Name] IS NOT NULL"); - - b.ToTable("Contracts"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AddressFrom") - .HasMaxLength(43); - - b.Property("AddressTo") - .HasMaxLength(43); - - b.Property("BlockHash") - .HasMaxLength(67); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("CumulativeGasUsed") - .HasMaxLength(100); - - b.Property("Error") - .HasColumnType("nvarchar(max)"); - - b.Property("Failed"); - - b.Property("FailedCreateContract"); - - b.Property("Gas") - .HasMaxLength(100); - - b.Property("GasPrice") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("HasLog"); - - b.Property("HasVmStack"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Input") - .HasColumnType("nvarchar(max)"); - - b.Property("NewContractAddress") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ReceiptHash") - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TimeStamp") - .HasMaxLength(100); - - b.Property("TransactionIndex") - .HasMaxLength(100); - - b.Property("Value") - .HasMaxLength(100); - - b.HasKey("RowIndex"); - - b.HasIndex("AddressFrom"); - - b.HasIndex("AddressTo"); - - b.HasIndex("Hash"); - - b.HasIndex("NewContractAddress"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Transactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Data") - .HasColumnType("nvarchar(max)"); - - b.Property("EventHash") - .HasMaxLength(67); - - b.Property("IndexVal1") - .HasMaxLength(67); - - b.Property("IndexVal2") - .HasMaxLength(67); - - b.Property("IndexVal3") - .HasMaxLength(67); - - b.Property("LogIndex") - .HasMaxLength(100); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .IsRequired() - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("EventHash"); - - b.HasIndex("IndexVal1"); - - b.HasIndex("IndexVal2"); - - b.HasIndex("IndexVal3"); - - b.HasIndex("TransactionHash", "LogIndex") - .IsUnique() - .HasFilter("[LogIndex] IS NOT NULL"); - - b.ToTable("TransactionLogs"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("StructLogs") - .HasColumnType("nvarchar(max)"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("TransactionHash"); - - b.ToTable("TransactionLogVmStacks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20221014164529_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20221014164529_InitialCreate.Designer.cs new file mode 100644 index 0000000..d0db67a --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20221014164529_InitialCreate.Designer.cs @@ -0,0 +1,444 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_rinkebyMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_rinkeby))] + [Migration("20221014164529_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("rinkeby") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "rinkeby"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "rinkeby"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "rinkeby"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "rinkeby"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "rinkeby"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "rinkeby"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "rinkeby"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20190712142955_InitialCreate.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20221014164529_InitialCreate.cs similarity index 52% rename from src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20190712142955_InitialCreate.cs rename to src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20221014164529_InitialCreate.cs index cb5c53d..1063e72 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20190712142955_InitialCreate.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/20221014164529_InitialCreate.cs @@ -1,7 +1,8 @@ using System; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_rinkebyMigrations { public partial class InitialCreate : Migration @@ -16,13 +17,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "rinkeby", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - Address = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -34,11 +35,11 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "rinkeby", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - LastBlockProcessed = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastBlockProcessed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -50,23 +51,24 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "rinkeby", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - ParentHash = table.Column(maxLength: 67, nullable: false), - Nonce = table.Column(maxLength: 100, nullable: true), - ExtraData = table.Column(nullable: true), - Difficulty = table.Column(maxLength: 100, nullable: true), - TotalDifficulty = table.Column(maxLength: 100, nullable: true), - Size = table.Column(maxLength: 100, nullable: true), - Miner = table.Column(maxLength: 43, nullable: true), - GasLimit = table.Column(maxLength: 100, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - Timestamp = table.Column(maxLength: 100, nullable: true), - TransactionCount = table.Column(nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + ParentHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExtraData = table.Column(type: "nvarchar(max)", nullable: true), + Difficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TotalDifficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Size = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Miner = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + GasLimit = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Timestamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionCount = table.Column(type: "bigint", nullable: false), + BaseFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -78,16 +80,16 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "rinkeby", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - Name = table.Column(maxLength: 255, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), ABI = table.Column(type: "nvarchar(max)", nullable: true), Code = table.Column(type: "nvarchar(max)", nullable: true), - Creator = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true) + Creator = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -99,18 +101,18 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "rinkeby", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: false), - LogIndex = table.Column(maxLength: 100, nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - EventHash = table.Column(maxLength: 67, nullable: true), - IndexVal1 = table.Column(maxLength: 67, nullable: true), - IndexVal2 = table.Column(maxLength: 67, nullable: true), - IndexVal3 = table.Column(maxLength: 67, nullable: true), - Data = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + LogIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + EventHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal1 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal2 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal3 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + Data = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -122,13 +124,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "rinkeby", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true), - StructLogs = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + StructLogs = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -140,31 +142,34 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "rinkeby", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockHash = table.Column(maxLength: 67, nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - AddressFrom = table.Column(maxLength: 43, nullable: true), - TimeStamp = table.Column(maxLength: 100, nullable: true), - TransactionIndex = table.Column(maxLength: 100, nullable: true), - Value = table.Column(maxLength: 100, nullable: true), - AddressTo = table.Column(maxLength: 43, nullable: true), - Gas = table.Column(maxLength: 100, nullable: true), - GasPrice = table.Column(maxLength: 100, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true), + BlockHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + AddressFrom = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TimeStamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Value = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AddressTo = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Gas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), Input = table.Column(type: "nvarchar(max)", nullable: true), - Nonce = table.Column(maxLength: 100, nullable: true), - Failed = table.Column(nullable: false), - ReceiptHash = table.Column(maxLength: 67, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - CumulativeGasUsed = table.Column(maxLength: 100, nullable: true), - HasLog = table.Column(nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Failed = table.Column(type: "bit", nullable: false), + ReceiptHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + CumulativeGasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + EffectiveGasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + HasLog = table.Column(type: "bit", nullable: false), Error = table.Column(type: "nvarchar(max)", nullable: true), - HasVmStack = table.Column(nullable: false), - NewContractAddress = table.Column(maxLength: 43, nullable: true), - FailedCreateContract = table.Column(nullable: false) + HasVmStack = table.Column(type: "bit", nullable: false), + NewContractAddress = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + FailedCreateContract = table.Column(type: "bit", nullable: false), + MaxFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + MaxPriorityFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) }, constraints: table => { @@ -178,17 +183,17 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Address"); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_Hash", + name: "IX_AddressTransactions_BlockNumber_Hash_Address", schema: "rinkeby", table: "AddressTransactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash", "Address" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_BlockNumber_Hash_Address", + name: "IX_AddressTransactions_Hash", schema: "rinkeby", table: "AddressTransactions", - columns: new[] { "BlockNumber", "Hash", "Address" }, - unique: true); + column: "Hash"); migrationBuilder.CreateIndex( name: "IX_BlockProgress_LastBlockProcessed", @@ -280,23 +285,23 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "AddressTo"); migrationBuilder.CreateIndex( - name: "IX_Transactions_Hash", + name: "IX_Transactions_BlockNumber_Hash", schema: "rinkeby", table: "Transactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_Transactions_NewContractAddress", + name: "IX_Transactions_Hash", schema: "rinkeby", table: "Transactions", - column: "NewContractAddress"); + column: "Hash"); migrationBuilder.CreateIndex( - name: "IX_Transactions_BlockNumber_Hash", + name: "IX_Transactions_NewContractAddress", schema: "rinkeby", table: "Transactions", - columns: new[] { "BlockNumber", "Hash" }, - unique: true); + column: "NewContractAddress"); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/SqlServerBlockchainDbContext_rinkebyModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/SqlServerBlockchainDbContext_rinkebyModelSnapshot.cs index c33d6fb..dc95e16 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/SqlServerBlockchainDbContext_rinkebyModelSnapshot.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_rinkebyMigrations/SqlServerBlockchainDbContext_rinkebyModelSnapshot.cs @@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Nethereum.BlockchainStore.EFCore.SqlServer; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_rinkebyMigrations { [DbContext(typeof(SqlServerBlockchainDbContext_rinkeby))] @@ -16,31 +18,39 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("rinkeby") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); @@ -51,115 +61,149 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash", "Address") .IsUnique(); - b.ToTable("AddressTransactions"); + b.ToTable("AddressTransactions", "rinkeby"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Difficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("ExtraData"); + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); b.Property("GasLimit") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Miner") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ParentHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("Size") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Timestamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TotalDifficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("TransactionCount"); + b.Property("TransactionCount") + .HasColumnType("bigint"); b.HasKey("RowIndex"); b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Blocks"); + b.ToTable("Blocks", "rinkeby"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("LastBlockProcessed") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); b.HasIndex("LastBlockProcessed"); - b.ToTable("BlockProgress"); + b.ToTable("BlockProgress", "rinkeby"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("ABI") .HasColumnType("nvarchar(max)"); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Code") .HasColumnType("nvarchar(max)"); b.Property("Creator") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Name") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -169,79 +213,114 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[Name] IS NOT NULL"); - b.ToTable("Contracts"); + b.ToTable("Contracts", "rinkeby"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("AddressFrom") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("AddressTo") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("CumulativeGasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Error") .HasColumnType("nvarchar(max)"); - b.Property("Failed"); + b.Property("Failed") + .HasColumnType("bit"); - b.Property("FailedCreateContract"); + b.Property("FailedCreateContract") + .HasColumnType("bit"); b.Property("Gas") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasPrice") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("HasLog"); + b.Property("HasLog") + .HasColumnType("bit"); - b.Property("HasVmStack"); + b.Property("HasVmStack") + .HasColumnType("bit"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Input") .HasColumnType("nvarchar(max)"); + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("NewContractAddress") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ReceiptHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TimeStamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TransactionIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Value") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("RowIndex"); @@ -256,43 +335,54 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Transactions"); + b.ToTable("Transactions", "rinkeby"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Data") .HasColumnType("nvarchar(max)"); b.Property("EventHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal1") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal2") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal3") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("LogIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -310,27 +400,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[LogIndex] IS NOT NULL"); - b.ToTable("TransactionLogs"); + b.ToTable("TransactionLogs", "rinkeby"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("StructLogs") .HasColumnType("nvarchar(max)"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -338,7 +434,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TransactionHash"); - b.ToTable("TransactionLogVmStacks"); + b.ToTable("TransactionLogVmStacks", "rinkeby"); }); #pragma warning restore 612, 618 } diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20190712142939_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20190712142939_InitialCreate.Designer.cs deleted file mode 100644 index 72ad21b..0000000 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20190712142939_InitialCreate.Designer.cs +++ /dev/null @@ -1,348 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Nethereum.BlockchainStore.EFCore.SqlServer; - -namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_ropstenMigrations -{ - [DbContext(typeof(SqlServerBlockchainDbContext_ropsten))] - [Migration("20190712142939_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("ropsten") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .IsRequired() - .HasMaxLength(43); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Hash"); - - b.HasIndex("BlockNumber", "Hash", "Address") - .IsUnique(); - - b.ToTable("AddressTransactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("Difficulty") - .HasMaxLength(100); - - b.Property("ExtraData"); - - b.Property("GasLimit") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Miner") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ParentHash") - .IsRequired() - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("Size") - .HasMaxLength(100); - - b.Property("Timestamp") - .HasMaxLength(100); - - b.Property("TotalDifficulty") - .HasMaxLength(100); - - b.Property("TransactionCount"); - - b.HasKey("RowIndex"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Blocks"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("LastBlockProcessed") - .IsRequired() - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.HasKey("RowIndex"); - - b.HasIndex("LastBlockProcessed"); - - b.ToTable("BlockProgress"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("ABI") - .HasColumnType("nvarchar(max)"); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Code") - .HasColumnType("nvarchar(max)"); - - b.Property("Creator") - .HasMaxLength(43); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("Name") - .IsUnique() - .HasFilter("[Name] IS NOT NULL"); - - b.ToTable("Contracts"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("AddressFrom") - .HasMaxLength(43); - - b.Property("AddressTo") - .HasMaxLength(43); - - b.Property("BlockHash") - .HasMaxLength(67); - - b.Property("BlockNumber") - .IsRequired() - .HasMaxLength(100); - - b.Property("CumulativeGasUsed") - .HasMaxLength(100); - - b.Property("Error") - .HasColumnType("nvarchar(max)"); - - b.Property("Failed"); - - b.Property("FailedCreateContract"); - - b.Property("Gas") - .HasMaxLength(100); - - b.Property("GasPrice") - .HasMaxLength(100); - - b.Property("GasUsed") - .HasMaxLength(100); - - b.Property("HasLog"); - - b.Property("HasVmStack"); - - b.Property("Hash") - .IsRequired() - .HasMaxLength(67); - - b.Property("Input") - .HasColumnType("nvarchar(max)"); - - b.Property("NewContractAddress") - .HasMaxLength(43); - - b.Property("Nonce") - .HasMaxLength(100); - - b.Property("ReceiptHash") - .HasMaxLength(67); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TimeStamp") - .HasMaxLength(100); - - b.Property("TransactionIndex") - .HasMaxLength(100); - - b.Property("Value") - .HasMaxLength(100); - - b.HasKey("RowIndex"); - - b.HasIndex("AddressFrom"); - - b.HasIndex("AddressTo"); - - b.HasIndex("Hash"); - - b.HasIndex("NewContractAddress"); - - b.HasIndex("BlockNumber", "Hash") - .IsUnique(); - - b.ToTable("Transactions"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("Data") - .HasColumnType("nvarchar(max)"); - - b.Property("EventHash") - .HasMaxLength(67); - - b.Property("IndexVal1") - .HasMaxLength(67); - - b.Property("IndexVal2") - .HasMaxLength(67); - - b.Property("IndexVal3") - .HasMaxLength(67); - - b.Property("LogIndex") - .HasMaxLength(100); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("TransactionHash") - .IsRequired() - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("EventHash"); - - b.HasIndex("IndexVal1"); - - b.HasIndex("IndexVal2"); - - b.HasIndex("IndexVal3"); - - b.HasIndex("TransactionHash", "LogIndex") - .IsUnique() - .HasFilter("[LogIndex] IS NOT NULL"); - - b.ToTable("TransactionLogs"); - }); - - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => - { - b.Property("RowIndex") - .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - b.Property("Address") - .HasMaxLength(43); - - b.Property("RowCreated"); - - b.Property("RowUpdated"); - - b.Property("StructLogs") - .HasColumnType("nvarchar(max)"); - - b.Property("TransactionHash") - .HasMaxLength(67); - - b.HasKey("RowIndex"); - - b.HasIndex("Address"); - - b.HasIndex("TransactionHash"); - - b.ToTable("TransactionLogVmStacks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20221014164523_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20221014164523_InitialCreate.Designer.cs new file mode 100644 index 0000000..1c017ce --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20221014164523_InitialCreate.Designer.cs @@ -0,0 +1,444 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_ropstenMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_ropsten))] + [Migration("20221014164523_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("ropsten") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "ropsten"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "ropsten"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "ropsten"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "ropsten"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "ropsten"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "ropsten"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "ropsten"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20190712142939_InitialCreate.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20221014164523_InitialCreate.cs similarity index 52% rename from src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20190712142939_InitialCreate.cs rename to src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20221014164523_InitialCreate.cs index f71a062..d7363be 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20190712142939_InitialCreate.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/20221014164523_InitialCreate.cs @@ -1,7 +1,8 @@ using System; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_ropstenMigrations { public partial class InitialCreate : Migration @@ -16,13 +17,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "ropsten", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - Address = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -34,11 +35,11 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "ropsten", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - LastBlockProcessed = table.Column(maxLength: 43, nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastBlockProcessed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -50,23 +51,24 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "ropsten", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - ParentHash = table.Column(maxLength: 67, nullable: false), - Nonce = table.Column(maxLength: 100, nullable: true), - ExtraData = table.Column(nullable: true), - Difficulty = table.Column(maxLength: 100, nullable: true), - TotalDifficulty = table.Column(maxLength: 100, nullable: true), - Size = table.Column(maxLength: 100, nullable: true), - Miner = table.Column(maxLength: 43, nullable: true), - GasLimit = table.Column(maxLength: 100, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - Timestamp = table.Column(maxLength: 100, nullable: true), - TransactionCount = table.Column(nullable: false) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + ParentHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExtraData = table.Column(type: "nvarchar(max)", nullable: true), + Difficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TotalDifficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Size = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Miner = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + GasLimit = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Timestamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionCount = table.Column(type: "bigint", nullable: false), + BaseFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -78,16 +80,16 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "ropsten", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - Name = table.Column(maxLength: 255, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), ABI = table.Column(type: "nvarchar(max)", nullable: true), Code = table.Column(type: "nvarchar(max)", nullable: true), - Creator = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true) + Creator = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -99,18 +101,18 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "ropsten", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: false), - LogIndex = table.Column(maxLength: 100, nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - EventHash = table.Column(maxLength: 67, nullable: true), - IndexVal1 = table.Column(maxLength: 67, nullable: true), - IndexVal2 = table.Column(maxLength: 67, nullable: true), - IndexVal3 = table.Column(maxLength: 67, nullable: true), - Data = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + LogIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + EventHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal1 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal2 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal3 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + Data = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -122,13 +124,13 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "ropsten", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - Address = table.Column(maxLength: 43, nullable: true), - TransactionHash = table.Column(maxLength: 67, nullable: true), - StructLogs = table.Column(type: "nvarchar(max)", nullable: true) + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + StructLogs = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) }, constraints: table => { @@ -140,31 +142,34 @@ protected override void Up(MigrationBuilder migrationBuilder) schema: "ropsten", columns: table => new { - RowIndex = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - RowCreated = table.Column(nullable: true), - RowUpdated = table.Column(nullable: true), - BlockHash = table.Column(maxLength: 67, nullable: true), - BlockNumber = table.Column(maxLength: 100, nullable: false), - Hash = table.Column(maxLength: 67, nullable: false), - AddressFrom = table.Column(maxLength: 43, nullable: true), - TimeStamp = table.Column(maxLength: 100, nullable: true), - TransactionIndex = table.Column(maxLength: 100, nullable: true), - Value = table.Column(maxLength: 100, nullable: true), - AddressTo = table.Column(maxLength: 43, nullable: true), - Gas = table.Column(maxLength: 100, nullable: true), - GasPrice = table.Column(maxLength: 100, nullable: true), + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true), + BlockHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + AddressFrom = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TimeStamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Value = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AddressTo = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Gas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), Input = table.Column(type: "nvarchar(max)", nullable: true), - Nonce = table.Column(maxLength: 100, nullable: true), - Failed = table.Column(nullable: false), - ReceiptHash = table.Column(maxLength: 67, nullable: true), - GasUsed = table.Column(maxLength: 100, nullable: true), - CumulativeGasUsed = table.Column(maxLength: 100, nullable: true), - HasLog = table.Column(nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Failed = table.Column(type: "bit", nullable: false), + ReceiptHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + CumulativeGasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + EffectiveGasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + HasLog = table.Column(type: "bit", nullable: false), Error = table.Column(type: "nvarchar(max)", nullable: true), - HasVmStack = table.Column(nullable: false), - NewContractAddress = table.Column(maxLength: 43, nullable: true), - FailedCreateContract = table.Column(nullable: false) + HasVmStack = table.Column(type: "bit", nullable: false), + NewContractAddress = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + FailedCreateContract = table.Column(type: "bit", nullable: false), + MaxFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + MaxPriorityFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) }, constraints: table => { @@ -178,17 +183,17 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "Address"); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_Hash", + name: "IX_AddressTransactions_BlockNumber_Hash_Address", schema: "ropsten", table: "AddressTransactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash", "Address" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_AddressTransactions_BlockNumber_Hash_Address", + name: "IX_AddressTransactions_Hash", schema: "ropsten", table: "AddressTransactions", - columns: new[] { "BlockNumber", "Hash", "Address" }, - unique: true); + column: "Hash"); migrationBuilder.CreateIndex( name: "IX_BlockProgress_LastBlockProcessed", @@ -280,23 +285,23 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "AddressTo"); migrationBuilder.CreateIndex( - name: "IX_Transactions_Hash", + name: "IX_Transactions_BlockNumber_Hash", schema: "ropsten", table: "Transactions", - column: "Hash"); + columns: new[] { "BlockNumber", "Hash" }, + unique: true); migrationBuilder.CreateIndex( - name: "IX_Transactions_NewContractAddress", + name: "IX_Transactions_Hash", schema: "ropsten", table: "Transactions", - column: "NewContractAddress"); + column: "Hash"); migrationBuilder.CreateIndex( - name: "IX_Transactions_BlockNumber_Hash", + name: "IX_Transactions_NewContractAddress", schema: "ropsten", table: "Transactions", - columns: new[] { "BlockNumber", "Hash" }, - unique: true); + column: "NewContractAddress"); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/SqlServerBlockchainDbContext_ropstenModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/SqlServerBlockchainDbContext_ropstenModelSnapshot.cs index 1e36251..0eaf78c 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/SqlServerBlockchainDbContext_ropstenModelSnapshot.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_ropstenMigrations/SqlServerBlockchainDbContext_ropstenModelSnapshot.cs @@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Nethereum.BlockchainStore.EFCore.SqlServer; +#nullable disable + namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_ropstenMigrations { [DbContext(typeof(SqlServerBlockchainDbContext_ropsten))] @@ -16,31 +18,39 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("ropsten") - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.AddressTransaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); @@ -51,115 +61,149 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash", "Address") .IsUnique(); - b.ToTable("AddressTransactions"); + b.ToTable("AddressTransactions", "ropsten"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Block", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Difficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("ExtraData"); + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); b.Property("GasLimit") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Miner") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ParentHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("Size") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Timestamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TotalDifficulty") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("TransactionCount"); + b.Property("TransactionCount") + .HasColumnType("bigint"); b.HasKey("RowIndex"); b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Blocks"); + b.ToTable("Blocks", "ropsten"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.BlockProgress", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("LastBlockProcessed") .IsRequired() - .HasMaxLength(43); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.HasKey("RowIndex"); b.HasIndex("LastBlockProcessed"); - b.ToTable("BlockProgress"); + b.ToTable("BlockProgress", "ropsten"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Contract", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("ABI") .HasColumnType("nvarchar(max)"); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Code") .HasColumnType("nvarchar(max)"); b.Property("Creator") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Name") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -169,79 +213,114 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[Name] IS NOT NULL"); - b.ToTable("Contracts"); + b.ToTable("Contracts", "ropsten"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.Transaction", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("AddressFrom") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("AddressTo") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("BlockHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("BlockNumber") .IsRequired() - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("CumulativeGasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Error") .HasColumnType("nvarchar(max)"); - b.Property("Failed"); + b.Property("Failed") + .HasColumnType("bit"); - b.Property("FailedCreateContract"); + b.Property("FailedCreateContract") + .HasColumnType("bit"); b.Property("Gas") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasPrice") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("GasUsed") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("HasLog"); + b.Property("HasLog") + .HasColumnType("bit"); - b.Property("HasVmStack"); + b.Property("HasVmStack") + .HasColumnType("bit"); b.Property("Hash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("Input") .HasColumnType("nvarchar(max)"); + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + b.Property("NewContractAddress") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Nonce") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("ReceiptHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TimeStamp") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("TransactionIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Value") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("RowIndex"); @@ -256,43 +335,54 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("BlockNumber", "Hash") .IsUnique(); - b.ToTable("Transactions"); + b.ToTable("Transactions", "ropsten"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionLog", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); b.Property("Data") .HasColumnType("nvarchar(max)"); b.Property("EventHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal1") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal2") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("IndexVal3") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.Property("LogIndex") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("TransactionHash") .IsRequired() - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -310,27 +400,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsUnique() .HasFilter("[LogIndex] IS NOT NULL"); - b.ToTable("TransactionLogs"); + b.ToTable("TransactionLogs", "ropsten"); }); - modelBuilder.Entity("Nethereum.BlockchainProcessing.Storage.Entities.TransactionVmStack", b => + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => { b.Property("RowIndex") .ValueGeneratedOnAdd() - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); b.Property("Address") - .HasMaxLength(43); + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); - b.Property("RowCreated"); + b.Property("RowCreated") + .HasColumnType("datetime2"); - b.Property("RowUpdated"); + b.Property("RowUpdated") + .HasColumnType("datetime2"); b.Property("StructLogs") .HasColumnType("nvarchar(max)"); b.Property("TransactionHash") - .HasMaxLength(67); + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); b.HasKey("RowIndex"); @@ -338,7 +434,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("TransactionHash"); - b.ToTable("TransactionLogVmStacks"); + b.ToTable("TransactionLogVmStacks", "ropsten"); }); #pragma warning restore 612, 618 } diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/20221014164550_InitialCreate.Designer.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/20221014164550_InitialCreate.Designer.cs new file mode 100644 index 0000000..fdd6655 --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/20221014164550_InitialCreate.Designer.cs @@ -0,0 +1,444 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_sepoliaMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_sepolia))] + [Migration("20221014164550_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("sepolia") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "sepolia"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/20221014164550_InitialCreate.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/20221014164550_InitialCreate.cs new file mode 100644 index 0000000..ac0fb3d --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/20221014164550_InitialCreate.cs @@ -0,0 +1,338 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_sepoliaMigrations +{ + public partial class InitialCreate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "sepolia"); + + migrationBuilder.CreateTable( + name: "AddressTransactions", + schema: "sepolia", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AddressTransactions", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "BlockProgress", + schema: "sepolia", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastBlockProcessed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BlockProgress", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "Blocks", + schema: "sepolia", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + ParentHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ExtraData = table.Column(type: "nvarchar(max)", nullable: true), + Difficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TotalDifficulty = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Size = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Miner = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + GasLimit = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Timestamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionCount = table.Column(type: "bigint", nullable: false), + BaseFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Blocks", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "Contracts", + schema: "sepolia", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Name = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), + ABI = table.Column(type: "nvarchar(max)", nullable: true), + Code = table.Column(type: "nvarchar(max)", nullable: true), + Creator = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Contracts", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "TransactionLogs", + schema: "sepolia", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + LogIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + EventHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal1 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal2 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + IndexVal3 = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + Data = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TransactionLogs", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "TransactionLogVmStacks", + schema: "sepolia", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Address = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TransactionHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + StructLogs = table.Column(type: "nvarchar(max)", nullable: true), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TransactionLogVmStacks", x => x.RowIndex); + }); + + migrationBuilder.CreateTable( + name: "Transactions", + schema: "sepolia", + columns: table => new + { + RowIndex = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RowCreated = table.Column(type: "datetime2", nullable: true), + RowUpdated = table.Column(type: "datetime2", nullable: true), + BlockHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + BlockNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Hash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: false), + AddressFrom = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + TimeStamp = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + TransactionIndex = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Value = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + AddressTo = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + Gas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + GasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Input = table.Column(type: "nvarchar(max)", nullable: true), + Nonce = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Failed = table.Column(type: "bit", nullable: false), + ReceiptHash = table.Column(type: "nvarchar(67)", maxLength: 67, nullable: true), + GasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + CumulativeGasUsed = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + EffectiveGasPrice = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + HasLog = table.Column(type: "bit", nullable: false), + Error = table.Column(type: "nvarchar(max)", nullable: true), + HasVmStack = table.Column(type: "bit", nullable: false), + NewContractAddress = table.Column(type: "nvarchar(43)", maxLength: 43, nullable: true), + FailedCreateContract = table.Column(type: "bit", nullable: false), + MaxFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + MaxPriorityFeePerGas = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Transactions", x => x.RowIndex); + }); + + migrationBuilder.CreateIndex( + name: "IX_AddressTransactions_Address", + schema: "sepolia", + table: "AddressTransactions", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_AddressTransactions_BlockNumber_Hash_Address", + schema: "sepolia", + table: "AddressTransactions", + columns: new[] { "BlockNumber", "Hash", "Address" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AddressTransactions_Hash", + schema: "sepolia", + table: "AddressTransactions", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_BlockProgress_LastBlockProcessed", + schema: "sepolia", + table: "BlockProgress", + column: "LastBlockProcessed"); + + migrationBuilder.CreateIndex( + name: "IX_Blocks_BlockNumber_Hash", + schema: "sepolia", + table: "Blocks", + columns: new[] { "BlockNumber", "Hash" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Contracts_Address", + schema: "sepolia", + table: "Contracts", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_Contracts_Name", + schema: "sepolia", + table: "Contracts", + column: "Name", + unique: true, + filter: "[Name] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_Address", + schema: "sepolia", + table: "TransactionLogs", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_EventHash", + schema: "sepolia", + table: "TransactionLogs", + column: "EventHash"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_IndexVal1", + schema: "sepolia", + table: "TransactionLogs", + column: "IndexVal1"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_IndexVal2", + schema: "sepolia", + table: "TransactionLogs", + column: "IndexVal2"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_IndexVal3", + schema: "sepolia", + table: "TransactionLogs", + column: "IndexVal3"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogs_TransactionHash_LogIndex", + schema: "sepolia", + table: "TransactionLogs", + columns: new[] { "TransactionHash", "LogIndex" }, + unique: true, + filter: "[LogIndex] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogVmStacks_Address", + schema: "sepolia", + table: "TransactionLogVmStacks", + column: "Address"); + + migrationBuilder.CreateIndex( + name: "IX_TransactionLogVmStacks_TransactionHash", + schema: "sepolia", + table: "TransactionLogVmStacks", + column: "TransactionHash"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_AddressFrom", + schema: "sepolia", + table: "Transactions", + column: "AddressFrom"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_AddressTo", + schema: "sepolia", + table: "Transactions", + column: "AddressTo"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_BlockNumber_Hash", + schema: "sepolia", + table: "Transactions", + columns: new[] { "BlockNumber", "Hash" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_Hash", + schema: "sepolia", + table: "Transactions", + column: "Hash"); + + migrationBuilder.CreateIndex( + name: "IX_Transactions_NewContractAddress", + schema: "sepolia", + table: "Transactions", + column: "NewContractAddress"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AddressTransactions", + schema: "sepolia"); + + migrationBuilder.DropTable( + name: "BlockProgress", + schema: "sepolia"); + + migrationBuilder.DropTable( + name: "Blocks", + schema: "sepolia"); + + migrationBuilder.DropTable( + name: "Contracts", + schema: "sepolia"); + + migrationBuilder.DropTable( + name: "TransactionLogs", + schema: "sepolia"); + + migrationBuilder.DropTable( + name: "TransactionLogVmStacks", + schema: "sepolia"); + + migrationBuilder.DropTable( + name: "Transactions", + schema: "sepolia"); + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/SqlServerBlockchainDbContext_sepoliaModelSnapshot.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/SqlServerBlockchainDbContext_sepoliaModelSnapshot.cs new file mode 100644 index 0000000..fef5b2b --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Migrations/SqlServerBlockchainDbContext_sepoliaMigrations/SqlServerBlockchainDbContext_sepoliaModelSnapshot.cs @@ -0,0 +1,442 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Nethereum.BlockchainStore.EFCore.SqlServer; + +#nullable disable + +namespace Nethereum.BlockchainStore.EFCore.SqlServer.Migrations.SqlServerBlockchainDbContext_sepoliaMigrations +{ + [DbContext(typeof(SqlServerBlockchainDbContext_sepolia))] + partial class SqlServerBlockchainDbContext_sepoliaModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("sepolia") + .HasAnnotation("ProductVersion", "6.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.AddressTransaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .IsRequired() + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Hash"); + + b.HasIndex("BlockNumber", "Hash", "Address") + .IsUnique(); + + b.ToTable("AddressTransactions", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Block", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("BaseFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Difficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ExtraData") + .HasColumnType("nvarchar(max)"); + + b.Property("GasLimit") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Miner") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ParentHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("Size") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Timestamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalDifficulty") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionCount") + .HasColumnType("bigint"); + + b.HasKey("RowIndex"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Blocks", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.BlockProgress", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("LastBlockProcessed") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.HasKey("RowIndex"); + + b.HasIndex("LastBlockProcessed"); + + b.ToTable("BlockProgress", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Contract", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("ABI") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Creator") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("Contracts", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.Transaction", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("AddressFrom") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("AddressTo") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("BlockHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("BlockNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CumulativeGasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EffectiveGasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("Failed") + .HasColumnType("bit"); + + b.Property("FailedCreateContract") + .HasColumnType("bit"); + + b.Property("Gas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasPrice") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GasUsed") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("HasLog") + .HasColumnType("bit"); + + b.Property("HasVmStack") + .HasColumnType("bit"); + + b.Property("Hash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("Input") + .HasColumnType("nvarchar(max)"); + + b.Property("MaxFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaxPriorityFeePerGas") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NewContractAddress") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Nonce") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ReceiptHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TimeStamp") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransactionIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("RowIndex"); + + b.HasIndex("AddressFrom"); + + b.HasIndex("AddressTo"); + + b.HasIndex("Hash"); + + b.HasIndex("NewContractAddress"); + + b.HasIndex("BlockNumber", "Hash") + .IsUnique(); + + b.ToTable("Transactions", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionLog", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("Data") + .HasColumnType("nvarchar(max)"); + + b.Property("EventHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal1") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal2") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("IndexVal3") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.Property("LogIndex") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("TransactionHash") + .IsRequired() + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("EventHash"); + + b.HasIndex("IndexVal1"); + + b.HasIndex("IndexVal2"); + + b.HasIndex("IndexVal3"); + + b.HasIndex("TransactionHash", "LogIndex") + .IsUnique() + .HasFilter("[LogIndex] IS NOT NULL"); + + b.ToTable("TransactionLogs", "sepolia"); + }); + + modelBuilder.Entity("Nethereum.BlockchainProcessing.BlockStorage.Entities.TransactionVmStack", b => + { + b.Property("RowIndex") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RowIndex"), 1L, 1); + + b.Property("Address") + .HasMaxLength(43) + .HasColumnType("nvarchar(43)"); + + b.Property("RowCreated") + .HasColumnType("datetime2"); + + b.Property("RowUpdated") + .HasColumnType("datetime2"); + + b.Property("StructLogs") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionHash") + .HasMaxLength(67) + .HasColumnType("nvarchar(67)"); + + b.HasKey("RowIndex"); + + b.HasIndex("Address"); + + b.HasIndex("TransactionHash"); + + b.ToTable("TransactionLogVmStacks", "sepolia"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Nethereum.BlockchainStore.EFCore.SqlServer.csproj b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Nethereum.BlockchainStore.EFCore.SqlServer.csproj index e618232..39028fb 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Nethereum.BlockchainStore.EFCore.SqlServer.csproj +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Nethereum.BlockchainStore.EFCore.SqlServer.csproj @@ -2,25 +2,20 @@ $(OtherAuthors) - netstandard2.0 + net6.0 Store Ethereum blockchain data in Sql Server using Entity Framework core. - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_dbo.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_dbo.sql index a9db1b1..e025480 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_dbo.sql +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_dbo.sql @@ -6,209 +6,5 @@ BEGIN CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) ); END; - -GO - -CREATE TABLE [dbo].[AddressTransactions] ( - [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, - [BlockNumber] nvarchar(100) NOT NULL, - [Hash] nvarchar(67) NOT NULL, - [Address] nvarchar(43) NOT NULL, - CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) -); - -GO - -CREATE TABLE [dbo].[BlockProgress] ( - [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, - [LastBlockProcessed] nvarchar(100) NOT NULL, - CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) -); - -GO - -CREATE TABLE [dbo].[Blocks] ( - [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, - [BlockNumber] nvarchar(100) NOT NULL, - [Hash] nvarchar(67) NOT NULL, - [ParentHash] nvarchar(67) NOT NULL, - [Nonce] nvarchar(100) NULL, - [ExtraData] nvarchar(max) NULL, - [Difficulty] nvarchar(100) NULL, - [TotalDifficulty] nvarchar(100) NULL, - [Size] nvarchar(100) NULL, - [Miner] nvarchar(43) NULL, - [GasLimit] nvarchar(100) NULL, - [GasUsed] nvarchar(100) NULL, - [Timestamp] nvarchar(100) NULL, - [TransactionCount] bigint NOT NULL, - CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) -); - -GO - -CREATE TABLE [dbo].[Contracts] ( - [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, - [Address] nvarchar(43) NULL, - [Name] nvarchar(255) NULL, - [ABI] nvarchar(max) NULL, - [Code] nvarchar(max) NULL, - [Creator] nvarchar(43) NULL, - [TransactionHash] nvarchar(67) NULL, - CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) -); - -GO - -CREATE TABLE [dbo].[TransactionLogs] ( - [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, - [TransactionHash] nvarchar(67) NOT NULL, - [LogIndex] nvarchar(100) NULL, - [Address] nvarchar(43) NULL, - [EventHash] nvarchar(67) NULL, - [IndexVal1] nvarchar(67) NULL, - [IndexVal2] nvarchar(67) NULL, - [IndexVal3] nvarchar(67) NULL, - [Data] nvarchar(max) NULL, - CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) -); - -GO - -CREATE TABLE [dbo].[TransactionLogVmStacks] ( - [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, - [Address] nvarchar(43) NULL, - [TransactionHash] nvarchar(67) NULL, - [StructLogs] nvarchar(max) NULL, - CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) -); - -GO - -CREATE TABLE [dbo].[Transactions] ( - [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, - [BlockHash] nvarchar(67) NULL, - [BlockNumber] nvarchar(100) NOT NULL, - [Hash] nvarchar(67) NOT NULL, - [AddressFrom] nvarchar(43) NULL, - [TimeStamp] nvarchar(100) NULL, - [TransactionIndex] nvarchar(100) NULL, - [Value] nvarchar(100) NULL, - [AddressTo] nvarchar(43) NULL, - [Gas] nvarchar(100) NULL, - [GasPrice] nvarchar(100) NULL, - [Input] nvarchar(max) NULL, - [Nonce] nvarchar(100) NULL, - [Failed] bit NOT NULL, - [ReceiptHash] nvarchar(67) NULL, - [GasUsed] nvarchar(100) NULL, - [CumulativeGasUsed] nvarchar(100) NULL, - [HasLog] bit NOT NULL, - [Error] nvarchar(max) NULL, - [HasVmStack] bit NOT NULL, - [NewContractAddress] nvarchar(43) NULL, - [FailedCreateContract] bit NOT NULL, - CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) -); - -GO - -CREATE INDEX [IX_AddressTransactions_Address] ON [dbo].[AddressTransactions] ([Address]); - -GO - -CREATE INDEX [IX_AddressTransactions_Hash] ON [dbo].[AddressTransactions] ([Hash]); - -GO - -CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [dbo].[AddressTransactions] ([BlockNumber], [Hash], [Address]); - -GO - -CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [dbo].[BlockProgress] ([LastBlockProcessed]); - -GO - -CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [dbo].[Blocks] ([BlockNumber], [Hash]); - -GO - -CREATE INDEX [IX_Contracts_Address] ON [dbo].[Contracts] ([Address]); - -GO - -CREATE UNIQUE INDEX [IX_Contracts_Name] ON [dbo].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; - -GO - -CREATE INDEX [IX_TransactionLogs_Address] ON [dbo].[TransactionLogs] ([Address]); - -GO - -CREATE INDEX [IX_TransactionLogs_EventHash] ON [dbo].[TransactionLogs] ([EventHash]); - -GO - -CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [dbo].[TransactionLogs] ([IndexVal1]); - -GO - -CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [dbo].[TransactionLogs] ([IndexVal2]); - -GO - -CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [dbo].[TransactionLogs] ([IndexVal3]); - -GO - -CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [dbo].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; - -GO - -CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [dbo].[TransactionLogVmStacks] ([Address]); - -GO - -CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [dbo].[TransactionLogVmStacks] ([TransactionHash]); - -GO - -CREATE INDEX [IX_Transactions_AddressFrom] ON [dbo].[Transactions] ([AddressFrom]); - -GO - -CREATE INDEX [IX_Transactions_AddressTo] ON [dbo].[Transactions] ([AddressTo]); - -GO - -CREATE INDEX [IX_Transactions_Hash] ON [dbo].[Transactions] ([Hash]); - -GO - -CREATE INDEX [IX_Transactions_NewContractAddress] ON [dbo].[Transactions] ([NewContractAddress]); - -GO - -CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [dbo].[Transactions] ([BlockNumber], [Hash]); - -GO - -INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'20190712142901_InitialCreate', N'2.1.1-rtm-30846'); - GO diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_goerli.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_goerli.sql new file mode 100644 index 0000000..cc0385e --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_goerli.sql @@ -0,0 +1,198 @@ +IF OBJECT_ID(N'[__EFMigrationsHistory]') IS NULL +BEGIN + CREATE TABLE [__EFMigrationsHistory] ( + [MigrationId] nvarchar(150) NOT NULL, + [ProductVersion] nvarchar(32) NOT NULL, + CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) + ); +END; +GO + +BEGIN TRANSACTION; +GO + +IF SCHEMA_ID(N'goerli') IS NULL EXEC(N'CREATE SCHEMA [goerli];'); +GO + +CREATE TABLE [goerli].[AddressTransactions] ( + [RowIndex] int NOT NULL IDENTITY, + [BlockNumber] nvarchar(100) NOT NULL, + [Hash] nvarchar(67) NOT NULL, + [Address] nvarchar(43) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [goerli].[BlockProgress] ( + [RowIndex] int NOT NULL IDENTITY, + [LastBlockProcessed] nvarchar(100) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [goerli].[Blocks] ( + [RowIndex] int NOT NULL IDENTITY, + [BlockNumber] nvarchar(100) NOT NULL, + [Hash] nvarchar(67) NOT NULL, + [ParentHash] nvarchar(67) NOT NULL, + [Nonce] nvarchar(100) NULL, + [ExtraData] nvarchar(max) NULL, + [Difficulty] nvarchar(100) NULL, + [TotalDifficulty] nvarchar(100) NULL, + [Size] nvarchar(100) NULL, + [Miner] nvarchar(43) NULL, + [GasLimit] nvarchar(100) NULL, + [GasUsed] nvarchar(100) NULL, + [Timestamp] nvarchar(100) NULL, + [TransactionCount] bigint NOT NULL, + [BaseFeePerGas] nvarchar(100) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [goerli].[Contracts] ( + [RowIndex] int NOT NULL IDENTITY, + [Address] nvarchar(43) NULL, + [Name] nvarchar(255) NULL, + [ABI] nvarchar(max) NULL, + [Code] nvarchar(max) NULL, + [Creator] nvarchar(43) NULL, + [TransactionHash] nvarchar(67) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [goerli].[TransactionLogs] ( + [RowIndex] int NOT NULL IDENTITY, + [TransactionHash] nvarchar(67) NOT NULL, + [LogIndex] nvarchar(100) NULL, + [Address] nvarchar(43) NULL, + [EventHash] nvarchar(67) NULL, + [IndexVal1] nvarchar(67) NULL, + [IndexVal2] nvarchar(67) NULL, + [IndexVal3] nvarchar(67) NULL, + [Data] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [goerli].[TransactionLogVmStacks] ( + [RowIndex] int NOT NULL IDENTITY, + [Address] nvarchar(43) NULL, + [TransactionHash] nvarchar(67) NULL, + [StructLogs] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [goerli].[Transactions] ( + [RowIndex] int NOT NULL IDENTITY, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + [BlockHash] nvarchar(67) NULL, + [BlockNumber] nvarchar(100) NOT NULL, + [Hash] nvarchar(67) NOT NULL, + [AddressFrom] nvarchar(43) NULL, + [TimeStamp] nvarchar(100) NULL, + [TransactionIndex] nvarchar(100) NULL, + [Value] nvarchar(100) NULL, + [AddressTo] nvarchar(43) NULL, + [Gas] nvarchar(100) NULL, + [GasPrice] nvarchar(100) NULL, + [Input] nvarchar(max) NULL, + [Nonce] nvarchar(100) NULL, + [Failed] bit NOT NULL, + [ReceiptHash] nvarchar(67) NULL, + [GasUsed] nvarchar(100) NULL, + [CumulativeGasUsed] nvarchar(100) NULL, + [EffectiveGasPrice] nvarchar(100) NULL, + [HasLog] bit NOT NULL, + [Error] nvarchar(max) NULL, + [HasVmStack] bit NOT NULL, + [NewContractAddress] nvarchar(43) NULL, + [FailedCreateContract] bit NOT NULL, + [MaxFeePerGas] nvarchar(100) NULL, + [MaxPriorityFeePerGas] nvarchar(100) NULL, + CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE INDEX [IX_AddressTransactions_Address] ON [goerli].[AddressTransactions] ([Address]); +GO + +CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [goerli].[AddressTransactions] ([BlockNumber], [Hash], [Address]); +GO + +CREATE INDEX [IX_AddressTransactions_Hash] ON [goerli].[AddressTransactions] ([Hash]); +GO + +CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [goerli].[BlockProgress] ([LastBlockProcessed]); +GO + +CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [goerli].[Blocks] ([BlockNumber], [Hash]); +GO + +CREATE INDEX [IX_Contracts_Address] ON [goerli].[Contracts] ([Address]); +GO + +CREATE UNIQUE INDEX [IX_Contracts_Name] ON [goerli].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; +GO + +CREATE INDEX [IX_TransactionLogs_Address] ON [goerli].[TransactionLogs] ([Address]); +GO + +CREATE INDEX [IX_TransactionLogs_EventHash] ON [goerli].[TransactionLogs] ([EventHash]); +GO + +CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [goerli].[TransactionLogs] ([IndexVal1]); +GO + +CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [goerli].[TransactionLogs] ([IndexVal2]); +GO + +CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [goerli].[TransactionLogs] ([IndexVal3]); +GO + +CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [goerli].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; +GO + +CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [goerli].[TransactionLogVmStacks] ([Address]); +GO + +CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [goerli].[TransactionLogVmStacks] ([TransactionHash]); +GO + +CREATE INDEX [IX_Transactions_AddressFrom] ON [goerli].[Transactions] ([AddressFrom]); +GO + +CREATE INDEX [IX_Transactions_AddressTo] ON [goerli].[Transactions] ([AddressTo]); +GO + +CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [goerli].[Transactions] ([BlockNumber], [Hash]); +GO + +CREATE INDEX [IX_Transactions_Hash] ON [goerli].[Transactions] ([Hash]); +GO + +CREATE INDEX [IX_Transactions_NewContractAddress] ON [goerli].[Transactions] ([NewContractAddress]); +GO + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'20221014164544_InitialCreate', N'6.0.10'); +GO + +COMMIT; +GO + diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_kovan.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_kovan.sql index 6e54bd9..fd44f44 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_kovan.sql +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_kovan.sql @@ -6,39 +6,36 @@ BEGIN CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) ); END; +GO +BEGIN TRANSACTION; GO IF SCHEMA_ID(N'kovan') IS NULL EXEC(N'CREATE SCHEMA [kovan];'); - GO CREATE TABLE [kovan].[AddressTransactions] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [Address] nvarchar(43) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [kovan].[BlockProgress] ( [RowIndex] int NOT NULL IDENTITY, + [LastBlockProcessed] nvarchar(100) NOT NULL, [RowCreated] datetime2 NULL, [RowUpdated] datetime2 NULL, - [LastBlockProcessed] nvarchar(100) NOT NULL, CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [kovan].[Blocks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [ParentHash] nvarchar(67) NOT NULL, @@ -52,30 +49,29 @@ CREATE TABLE [kovan].[Blocks] ( [GasUsed] nvarchar(100) NULL, [Timestamp] nvarchar(100) NULL, [TransactionCount] bigint NOT NULL, + [BaseFeePerGas] nvarchar(100) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [kovan].[Contracts] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [Name] nvarchar(255) NULL, [ABI] nvarchar(max) NULL, [Code] nvarchar(max) NULL, [Creator] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [kovan].[TransactionLogs] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [TransactionHash] nvarchar(67) NOT NULL, [LogIndex] nvarchar(100) NULL, [Address] nvarchar(43) NULL, @@ -84,21 +80,21 @@ CREATE TABLE [kovan].[TransactionLogs] ( [IndexVal2] nvarchar(67) NULL, [IndexVal3] nvarchar(67) NULL, [Data] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [kovan].[TransactionLogVmStacks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, [StructLogs] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [kovan].[Transactions] ( @@ -121,98 +117,82 @@ CREATE TABLE [kovan].[Transactions] ( [ReceiptHash] nvarchar(67) NULL, [GasUsed] nvarchar(100) NULL, [CumulativeGasUsed] nvarchar(100) NULL, + [EffectiveGasPrice] nvarchar(100) NULL, [HasLog] bit NOT NULL, [Error] nvarchar(max) NULL, [HasVmStack] bit NOT NULL, [NewContractAddress] nvarchar(43) NULL, [FailedCreateContract] bit NOT NULL, + [MaxFeePerGas] nvarchar(100) NULL, + [MaxPriorityFeePerGas] nvarchar(100) NULL, CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE INDEX [IX_AddressTransactions_Address] ON [kovan].[AddressTransactions] ([Address]); - -GO - -CREATE INDEX [IX_AddressTransactions_Hash] ON [kovan].[AddressTransactions] ([Hash]); - GO CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [kovan].[AddressTransactions] ([BlockNumber], [Hash], [Address]); +GO +CREATE INDEX [IX_AddressTransactions_Hash] ON [kovan].[AddressTransactions] ([Hash]); GO CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [kovan].[BlockProgress] ([LastBlockProcessed]); - GO CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [kovan].[Blocks] ([BlockNumber], [Hash]); - GO CREATE INDEX [IX_Contracts_Address] ON [kovan].[Contracts] ([Address]); - GO CREATE UNIQUE INDEX [IX_Contracts_Name] ON [kovan].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogs_Address] ON [kovan].[TransactionLogs] ([Address]); - GO CREATE INDEX [IX_TransactionLogs_EventHash] ON [kovan].[TransactionLogs] ([EventHash]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [kovan].[TransactionLogs] ([IndexVal1]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [kovan].[TransactionLogs] ([IndexVal2]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [kovan].[TransactionLogs] ([IndexVal3]); - GO CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [kovan].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [kovan].[TransactionLogVmStacks] ([Address]); - GO CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [kovan].[TransactionLogVmStacks] ([TransactionHash]); - GO CREATE INDEX [IX_Transactions_AddressFrom] ON [kovan].[Transactions] ([AddressFrom]); - GO CREATE INDEX [IX_Transactions_AddressTo] ON [kovan].[Transactions] ([AddressTo]); +GO +CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [kovan].[Transactions] ([BlockNumber], [Hash]); GO CREATE INDEX [IX_Transactions_Hash] ON [kovan].[Transactions] ([Hash]); - GO CREATE INDEX [IX_Transactions_NewContractAddress] ON [kovan].[Transactions] ([NewContractAddress]); - -GO - -CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [kovan].[Transactions] ([BlockNumber], [Hash]); - GO INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'20190712143012_InitialCreate', N'2.1.1-rtm-30846'); +VALUES (N'20221014164534_InitialCreate', N'6.0.10'); +GO +COMMIT; GO diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_localhost.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_localhost.sql index e84c7f6..4183495 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_localhost.sql +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_localhost.sql @@ -6,39 +6,36 @@ BEGIN CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) ); END; +GO +BEGIN TRANSACTION; GO IF SCHEMA_ID(N'localhost') IS NULL EXEC(N'CREATE SCHEMA [localhost];'); - GO CREATE TABLE [localhost].[AddressTransactions] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [Address] nvarchar(43) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [localhost].[BlockProgress] ( [RowIndex] int NOT NULL IDENTITY, + [LastBlockProcessed] nvarchar(100) NOT NULL, [RowCreated] datetime2 NULL, [RowUpdated] datetime2 NULL, - [LastBlockProcessed] nvarchar(100) NOT NULL, CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [localhost].[Blocks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [ParentHash] nvarchar(67) NOT NULL, @@ -52,30 +49,29 @@ CREATE TABLE [localhost].[Blocks] ( [GasUsed] nvarchar(100) NULL, [Timestamp] nvarchar(100) NULL, [TransactionCount] bigint NOT NULL, + [BaseFeePerGas] nvarchar(100) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [localhost].[Contracts] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [Name] nvarchar(255) NULL, [ABI] nvarchar(max) NULL, [Code] nvarchar(max) NULL, [Creator] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [localhost].[TransactionLogs] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [TransactionHash] nvarchar(67) NOT NULL, [LogIndex] nvarchar(100) NULL, [Address] nvarchar(43) NULL, @@ -84,21 +80,21 @@ CREATE TABLE [localhost].[TransactionLogs] ( [IndexVal2] nvarchar(67) NULL, [IndexVal3] nvarchar(67) NULL, [Data] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [localhost].[TransactionLogVmStacks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, [StructLogs] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [localhost].[Transactions] ( @@ -121,98 +117,82 @@ CREATE TABLE [localhost].[Transactions] ( [ReceiptHash] nvarchar(67) NULL, [GasUsed] nvarchar(100) NULL, [CumulativeGasUsed] nvarchar(100) NULL, + [EffectiveGasPrice] nvarchar(100) NULL, [HasLog] bit NOT NULL, [Error] nvarchar(max) NULL, [HasVmStack] bit NOT NULL, [NewContractAddress] nvarchar(43) NULL, [FailedCreateContract] bit NOT NULL, + [MaxFeePerGas] nvarchar(100) NULL, + [MaxPriorityFeePerGas] nvarchar(100) NULL, CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE INDEX [IX_AddressTransactions_Address] ON [localhost].[AddressTransactions] ([Address]); - -GO - -CREATE INDEX [IX_AddressTransactions_Hash] ON [localhost].[AddressTransactions] ([Hash]); - GO CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [localhost].[AddressTransactions] ([BlockNumber], [Hash], [Address]); +GO +CREATE INDEX [IX_AddressTransactions_Hash] ON [localhost].[AddressTransactions] ([Hash]); GO CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [localhost].[BlockProgress] ([LastBlockProcessed]); - GO CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [localhost].[Blocks] ([BlockNumber], [Hash]); - GO CREATE INDEX [IX_Contracts_Address] ON [localhost].[Contracts] ([Address]); - GO CREATE UNIQUE INDEX [IX_Contracts_Name] ON [localhost].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogs_Address] ON [localhost].[TransactionLogs] ([Address]); - GO CREATE INDEX [IX_TransactionLogs_EventHash] ON [localhost].[TransactionLogs] ([EventHash]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [localhost].[TransactionLogs] ([IndexVal1]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [localhost].[TransactionLogs] ([IndexVal2]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [localhost].[TransactionLogs] ([IndexVal3]); - GO CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [localhost].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [localhost].[TransactionLogVmStacks] ([Address]); - GO CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [localhost].[TransactionLogVmStacks] ([TransactionHash]); - GO CREATE INDEX [IX_Transactions_AddressFrom] ON [localhost].[Transactions] ([AddressFrom]); - GO CREATE INDEX [IX_Transactions_AddressTo] ON [localhost].[Transactions] ([AddressTo]); +GO +CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [localhost].[Transactions] ([BlockNumber], [Hash]); GO CREATE INDEX [IX_Transactions_Hash] ON [localhost].[Transactions] ([Hash]); - GO CREATE INDEX [IX_Transactions_NewContractAddress] ON [localhost].[Transactions] ([NewContractAddress]); - -GO - -CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [localhost].[Transactions] ([BlockNumber], [Hash]); - GO INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'20190712142920_InitialCreate', N'2.1.1-rtm-30846'); +VALUES (N'20221014164518_InitialCreate', N'6.0.10'); +GO +COMMIT; GO diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_main.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_main.sql index 96f924d..20e0087 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_main.sql +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_main.sql @@ -6,39 +6,36 @@ BEGIN CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) ); END; +GO +BEGIN TRANSACTION; GO IF SCHEMA_ID(N'main') IS NULL EXEC(N'CREATE SCHEMA [main];'); - GO CREATE TABLE [main].[AddressTransactions] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [Address] nvarchar(43) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [main].[BlockProgress] ( [RowIndex] int NOT NULL IDENTITY, + [LastBlockProcessed] nvarchar(100) NOT NULL, [RowCreated] datetime2 NULL, [RowUpdated] datetime2 NULL, - [LastBlockProcessed] nvarchar(100) NOT NULL, CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [main].[Blocks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [ParentHash] nvarchar(67) NOT NULL, @@ -52,30 +49,29 @@ CREATE TABLE [main].[Blocks] ( [GasUsed] nvarchar(100) NULL, [Timestamp] nvarchar(100) NULL, [TransactionCount] bigint NOT NULL, + [BaseFeePerGas] nvarchar(100) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [main].[Contracts] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [Name] nvarchar(255) NULL, [ABI] nvarchar(max) NULL, [Code] nvarchar(max) NULL, [Creator] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [main].[TransactionLogs] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [TransactionHash] nvarchar(67) NOT NULL, [LogIndex] nvarchar(100) NULL, [Address] nvarchar(43) NULL, @@ -84,21 +80,21 @@ CREATE TABLE [main].[TransactionLogs] ( [IndexVal2] nvarchar(67) NULL, [IndexVal3] nvarchar(67) NULL, [Data] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [main].[TransactionLogVmStacks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, [StructLogs] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [main].[Transactions] ( @@ -121,98 +117,82 @@ CREATE TABLE [main].[Transactions] ( [ReceiptHash] nvarchar(67) NULL, [GasUsed] nvarchar(100) NULL, [CumulativeGasUsed] nvarchar(100) NULL, + [EffectiveGasPrice] nvarchar(100) NULL, [HasLog] bit NOT NULL, [Error] nvarchar(max) NULL, [HasVmStack] bit NOT NULL, [NewContractAddress] nvarchar(43) NULL, [FailedCreateContract] bit NOT NULL, + [MaxFeePerGas] nvarchar(100) NULL, + [MaxPriorityFeePerGas] nvarchar(100) NULL, CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE INDEX [IX_AddressTransactions_Address] ON [main].[AddressTransactions] ([Address]); - -GO - -CREATE INDEX [IX_AddressTransactions_Hash] ON [main].[AddressTransactions] ([Hash]); - GO CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [main].[AddressTransactions] ([BlockNumber], [Hash], [Address]); +GO +CREATE INDEX [IX_AddressTransactions_Hash] ON [main].[AddressTransactions] ([Hash]); GO CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [main].[BlockProgress] ([LastBlockProcessed]); - GO CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [main].[Blocks] ([BlockNumber], [Hash]); - GO CREATE INDEX [IX_Contracts_Address] ON [main].[Contracts] ([Address]); - GO CREATE UNIQUE INDEX [IX_Contracts_Name] ON [main].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogs_Address] ON [main].[TransactionLogs] ([Address]); - GO CREATE INDEX [IX_TransactionLogs_EventHash] ON [main].[TransactionLogs] ([EventHash]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [main].[TransactionLogs] ([IndexVal1]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [main].[TransactionLogs] ([IndexVal2]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [main].[TransactionLogs] ([IndexVal3]); - GO CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [main].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [main].[TransactionLogVmStacks] ([Address]); - GO CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [main].[TransactionLogVmStacks] ([TransactionHash]); - GO CREATE INDEX [IX_Transactions_AddressFrom] ON [main].[Transactions] ([AddressFrom]); - GO CREATE INDEX [IX_Transactions_AddressTo] ON [main].[Transactions] ([AddressTo]); +GO +CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [main].[Transactions] ([BlockNumber], [Hash]); GO CREATE INDEX [IX_Transactions_Hash] ON [main].[Transactions] ([Hash]); - GO CREATE INDEX [IX_Transactions_NewContractAddress] ON [main].[Transactions] ([NewContractAddress]); - -GO - -CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [main].[Transactions] ([BlockNumber], [Hash]); - GO INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'20190712143029_InitialCreate', N'2.1.1-rtm-30846'); +VALUES (N'20221014164539_InitialCreate', N'6.0.10'); +GO +COMMIT; GO diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_rinkeby.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_rinkeby.sql index 297ae71..ea1a064 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_rinkeby.sql +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_rinkeby.sql @@ -6,39 +6,36 @@ BEGIN CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) ); END; +GO +BEGIN TRANSACTION; GO IF SCHEMA_ID(N'rinkeby') IS NULL EXEC(N'CREATE SCHEMA [rinkeby];'); - GO CREATE TABLE [rinkeby].[AddressTransactions] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [Address] nvarchar(43) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [rinkeby].[BlockProgress] ( [RowIndex] int NOT NULL IDENTITY, + [LastBlockProcessed] nvarchar(100) NOT NULL, [RowCreated] datetime2 NULL, [RowUpdated] datetime2 NULL, - [LastBlockProcessed] nvarchar(100) NOT NULL, CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [rinkeby].[Blocks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [ParentHash] nvarchar(67) NOT NULL, @@ -52,30 +49,29 @@ CREATE TABLE [rinkeby].[Blocks] ( [GasUsed] nvarchar(100) NULL, [Timestamp] nvarchar(100) NULL, [TransactionCount] bigint NOT NULL, + [BaseFeePerGas] nvarchar(100) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [rinkeby].[Contracts] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [Name] nvarchar(255) NULL, [ABI] nvarchar(max) NULL, [Code] nvarchar(max) NULL, [Creator] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [rinkeby].[TransactionLogs] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [TransactionHash] nvarchar(67) NOT NULL, [LogIndex] nvarchar(100) NULL, [Address] nvarchar(43) NULL, @@ -84,21 +80,21 @@ CREATE TABLE [rinkeby].[TransactionLogs] ( [IndexVal2] nvarchar(67) NULL, [IndexVal3] nvarchar(67) NULL, [Data] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [rinkeby].[TransactionLogVmStacks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, [StructLogs] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [rinkeby].[Transactions] ( @@ -121,98 +117,82 @@ CREATE TABLE [rinkeby].[Transactions] ( [ReceiptHash] nvarchar(67) NULL, [GasUsed] nvarchar(100) NULL, [CumulativeGasUsed] nvarchar(100) NULL, + [EffectiveGasPrice] nvarchar(100) NULL, [HasLog] bit NOT NULL, [Error] nvarchar(max) NULL, [HasVmStack] bit NOT NULL, [NewContractAddress] nvarchar(43) NULL, [FailedCreateContract] bit NOT NULL, + [MaxFeePerGas] nvarchar(100) NULL, + [MaxPriorityFeePerGas] nvarchar(100) NULL, CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE INDEX [IX_AddressTransactions_Address] ON [rinkeby].[AddressTransactions] ([Address]); - -GO - -CREATE INDEX [IX_AddressTransactions_Hash] ON [rinkeby].[AddressTransactions] ([Hash]); - GO CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [rinkeby].[AddressTransactions] ([BlockNumber], [Hash], [Address]); +GO +CREATE INDEX [IX_AddressTransactions_Hash] ON [rinkeby].[AddressTransactions] ([Hash]); GO CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [rinkeby].[BlockProgress] ([LastBlockProcessed]); - GO CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [rinkeby].[Blocks] ([BlockNumber], [Hash]); - GO CREATE INDEX [IX_Contracts_Address] ON [rinkeby].[Contracts] ([Address]); - GO CREATE UNIQUE INDEX [IX_Contracts_Name] ON [rinkeby].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogs_Address] ON [rinkeby].[TransactionLogs] ([Address]); - GO CREATE INDEX [IX_TransactionLogs_EventHash] ON [rinkeby].[TransactionLogs] ([EventHash]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [rinkeby].[TransactionLogs] ([IndexVal1]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [rinkeby].[TransactionLogs] ([IndexVal2]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [rinkeby].[TransactionLogs] ([IndexVal3]); - GO CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [rinkeby].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [rinkeby].[TransactionLogVmStacks] ([Address]); - GO CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [rinkeby].[TransactionLogVmStacks] ([TransactionHash]); - GO CREATE INDEX [IX_Transactions_AddressFrom] ON [rinkeby].[Transactions] ([AddressFrom]); - GO CREATE INDEX [IX_Transactions_AddressTo] ON [rinkeby].[Transactions] ([AddressTo]); +GO +CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [rinkeby].[Transactions] ([BlockNumber], [Hash]); GO CREATE INDEX [IX_Transactions_Hash] ON [rinkeby].[Transactions] ([Hash]); - GO CREATE INDEX [IX_Transactions_NewContractAddress] ON [rinkeby].[Transactions] ([NewContractAddress]); - -GO - -CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [rinkeby].[Transactions] ([BlockNumber], [Hash]); - GO INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'20190712142955_InitialCreate', N'2.1.1-rtm-30846'); +VALUES (N'20221014164529_InitialCreate', N'6.0.10'); +GO +COMMIT; GO diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_ropsten.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_ropsten.sql index 0341131..08c32c1 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_ropsten.sql +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_ropsten.sql @@ -6,39 +6,36 @@ BEGIN CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) ); END; +GO +BEGIN TRANSACTION; GO IF SCHEMA_ID(N'ropsten') IS NULL EXEC(N'CREATE SCHEMA [ropsten];'); - GO CREATE TABLE [ropsten].[AddressTransactions] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [Address] nvarchar(43) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [ropsten].[BlockProgress] ( [RowIndex] int NOT NULL IDENTITY, + [LastBlockProcessed] nvarchar(100) NOT NULL, [RowCreated] datetime2 NULL, [RowUpdated] datetime2 NULL, - [LastBlockProcessed] nvarchar(100) NOT NULL, CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [ropsten].[Blocks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [BlockNumber] nvarchar(100) NOT NULL, [Hash] nvarchar(67) NOT NULL, [ParentHash] nvarchar(67) NOT NULL, @@ -52,30 +49,29 @@ CREATE TABLE [ropsten].[Blocks] ( [GasUsed] nvarchar(100) NULL, [Timestamp] nvarchar(100) NULL, [TransactionCount] bigint NOT NULL, + [BaseFeePerGas] nvarchar(100) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [ropsten].[Contracts] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [Name] nvarchar(255) NULL, [ABI] nvarchar(max) NULL, [Code] nvarchar(max) NULL, [Creator] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [ropsten].[TransactionLogs] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [TransactionHash] nvarchar(67) NOT NULL, [LogIndex] nvarchar(100) NULL, [Address] nvarchar(43) NULL, @@ -84,21 +80,21 @@ CREATE TABLE [ropsten].[TransactionLogs] ( [IndexVal2] nvarchar(67) NULL, [IndexVal3] nvarchar(67) NULL, [Data] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [ropsten].[TransactionLogVmStacks] ( [RowIndex] int NOT NULL IDENTITY, - [RowCreated] datetime2 NULL, - [RowUpdated] datetime2 NULL, [Address] nvarchar(43) NULL, [TransactionHash] nvarchar(67) NULL, [StructLogs] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) ); - GO CREATE TABLE [ropsten].[Transactions] ( @@ -121,98 +117,82 @@ CREATE TABLE [ropsten].[Transactions] ( [ReceiptHash] nvarchar(67) NULL, [GasUsed] nvarchar(100) NULL, [CumulativeGasUsed] nvarchar(100) NULL, + [EffectiveGasPrice] nvarchar(100) NULL, [HasLog] bit NOT NULL, [Error] nvarchar(max) NULL, [HasVmStack] bit NOT NULL, [NewContractAddress] nvarchar(43) NULL, [FailedCreateContract] bit NOT NULL, + [MaxFeePerGas] nvarchar(100) NULL, + [MaxPriorityFeePerGas] nvarchar(100) NULL, CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) ); - GO CREATE INDEX [IX_AddressTransactions_Address] ON [ropsten].[AddressTransactions] ([Address]); - -GO - -CREATE INDEX [IX_AddressTransactions_Hash] ON [ropsten].[AddressTransactions] ([Hash]); - GO CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [ropsten].[AddressTransactions] ([BlockNumber], [Hash], [Address]); +GO +CREATE INDEX [IX_AddressTransactions_Hash] ON [ropsten].[AddressTransactions] ([Hash]); GO CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [ropsten].[BlockProgress] ([LastBlockProcessed]); - GO CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [ropsten].[Blocks] ([BlockNumber], [Hash]); - GO CREATE INDEX [IX_Contracts_Address] ON [ropsten].[Contracts] ([Address]); - GO CREATE UNIQUE INDEX [IX_Contracts_Name] ON [ropsten].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogs_Address] ON [ropsten].[TransactionLogs] ([Address]); - GO CREATE INDEX [IX_TransactionLogs_EventHash] ON [ropsten].[TransactionLogs] ([EventHash]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [ropsten].[TransactionLogs] ([IndexVal1]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [ropsten].[TransactionLogs] ([IndexVal2]); - GO CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [ropsten].[TransactionLogs] ([IndexVal3]); - GO CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [ropsten].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; - GO CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [ropsten].[TransactionLogVmStacks] ([Address]); - GO CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [ropsten].[TransactionLogVmStacks] ([TransactionHash]); - GO CREATE INDEX [IX_Transactions_AddressFrom] ON [ropsten].[Transactions] ([AddressFrom]); - GO CREATE INDEX [IX_Transactions_AddressTo] ON [ropsten].[Transactions] ([AddressTo]); +GO +CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [ropsten].[Transactions] ([BlockNumber], [Hash]); GO CREATE INDEX [IX_Transactions_Hash] ON [ropsten].[Transactions] ([Hash]); - GO CREATE INDEX [IX_Transactions_NewContractAddress] ON [ropsten].[Transactions] ([NewContractAddress]); - -GO - -CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [ropsten].[Transactions] ([BlockNumber], [Hash]); - GO INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) -VALUES (N'20190712142939_InitialCreate', N'2.1.1-rtm-30846'); +VALUES (N'20221014164523_InitialCreate', N'6.0.10'); +GO +COMMIT; GO diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_sepolia.sql b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_sepolia.sql new file mode 100644 index 0000000..6186741 --- /dev/null +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/Sql/SqlServerBlockchainDbContext_sepolia.sql @@ -0,0 +1,198 @@ +IF OBJECT_ID(N'[__EFMigrationsHistory]') IS NULL +BEGIN + CREATE TABLE [__EFMigrationsHistory] ( + [MigrationId] nvarchar(150) NOT NULL, + [ProductVersion] nvarchar(32) NOT NULL, + CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY ([MigrationId]) + ); +END; +GO + +BEGIN TRANSACTION; +GO + +IF SCHEMA_ID(N'sepolia') IS NULL EXEC(N'CREATE SCHEMA [sepolia];'); +GO + +CREATE TABLE [sepolia].[AddressTransactions] ( + [RowIndex] int NOT NULL IDENTITY, + [BlockNumber] nvarchar(100) NOT NULL, + [Hash] nvarchar(67) NOT NULL, + [Address] nvarchar(43) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_AddressTransactions] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [sepolia].[BlockProgress] ( + [RowIndex] int NOT NULL IDENTITY, + [LastBlockProcessed] nvarchar(100) NOT NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_BlockProgress] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [sepolia].[Blocks] ( + [RowIndex] int NOT NULL IDENTITY, + [BlockNumber] nvarchar(100) NOT NULL, + [Hash] nvarchar(67) NOT NULL, + [ParentHash] nvarchar(67) NOT NULL, + [Nonce] nvarchar(100) NULL, + [ExtraData] nvarchar(max) NULL, + [Difficulty] nvarchar(100) NULL, + [TotalDifficulty] nvarchar(100) NULL, + [Size] nvarchar(100) NULL, + [Miner] nvarchar(43) NULL, + [GasLimit] nvarchar(100) NULL, + [GasUsed] nvarchar(100) NULL, + [Timestamp] nvarchar(100) NULL, + [TransactionCount] bigint NOT NULL, + [BaseFeePerGas] nvarchar(100) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_Blocks] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [sepolia].[Contracts] ( + [RowIndex] int NOT NULL IDENTITY, + [Address] nvarchar(43) NULL, + [Name] nvarchar(255) NULL, + [ABI] nvarchar(max) NULL, + [Code] nvarchar(max) NULL, + [Creator] nvarchar(43) NULL, + [TransactionHash] nvarchar(67) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_Contracts] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [sepolia].[TransactionLogs] ( + [RowIndex] int NOT NULL IDENTITY, + [TransactionHash] nvarchar(67) NOT NULL, + [LogIndex] nvarchar(100) NULL, + [Address] nvarchar(43) NULL, + [EventHash] nvarchar(67) NULL, + [IndexVal1] nvarchar(67) NULL, + [IndexVal2] nvarchar(67) NULL, + [IndexVal3] nvarchar(67) NULL, + [Data] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_TransactionLogs] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [sepolia].[TransactionLogVmStacks] ( + [RowIndex] int NOT NULL IDENTITY, + [Address] nvarchar(43) NULL, + [TransactionHash] nvarchar(67) NULL, + [StructLogs] nvarchar(max) NULL, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + CONSTRAINT [PK_TransactionLogVmStacks] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE TABLE [sepolia].[Transactions] ( + [RowIndex] int NOT NULL IDENTITY, + [RowCreated] datetime2 NULL, + [RowUpdated] datetime2 NULL, + [BlockHash] nvarchar(67) NULL, + [BlockNumber] nvarchar(100) NOT NULL, + [Hash] nvarchar(67) NOT NULL, + [AddressFrom] nvarchar(43) NULL, + [TimeStamp] nvarchar(100) NULL, + [TransactionIndex] nvarchar(100) NULL, + [Value] nvarchar(100) NULL, + [AddressTo] nvarchar(43) NULL, + [Gas] nvarchar(100) NULL, + [GasPrice] nvarchar(100) NULL, + [Input] nvarchar(max) NULL, + [Nonce] nvarchar(100) NULL, + [Failed] bit NOT NULL, + [ReceiptHash] nvarchar(67) NULL, + [GasUsed] nvarchar(100) NULL, + [CumulativeGasUsed] nvarchar(100) NULL, + [EffectiveGasPrice] nvarchar(100) NULL, + [HasLog] bit NOT NULL, + [Error] nvarchar(max) NULL, + [HasVmStack] bit NOT NULL, + [NewContractAddress] nvarchar(43) NULL, + [FailedCreateContract] bit NOT NULL, + [MaxFeePerGas] nvarchar(100) NULL, + [MaxPriorityFeePerGas] nvarchar(100) NULL, + CONSTRAINT [PK_Transactions] PRIMARY KEY ([RowIndex]) +); +GO + +CREATE INDEX [IX_AddressTransactions_Address] ON [sepolia].[AddressTransactions] ([Address]); +GO + +CREATE UNIQUE INDEX [IX_AddressTransactions_BlockNumber_Hash_Address] ON [sepolia].[AddressTransactions] ([BlockNumber], [Hash], [Address]); +GO + +CREATE INDEX [IX_AddressTransactions_Hash] ON [sepolia].[AddressTransactions] ([Hash]); +GO + +CREATE INDEX [IX_BlockProgress_LastBlockProcessed] ON [sepolia].[BlockProgress] ([LastBlockProcessed]); +GO + +CREATE UNIQUE INDEX [IX_Blocks_BlockNumber_Hash] ON [sepolia].[Blocks] ([BlockNumber], [Hash]); +GO + +CREATE INDEX [IX_Contracts_Address] ON [sepolia].[Contracts] ([Address]); +GO + +CREATE UNIQUE INDEX [IX_Contracts_Name] ON [sepolia].[Contracts] ([Name]) WHERE [Name] IS NOT NULL; +GO + +CREATE INDEX [IX_TransactionLogs_Address] ON [sepolia].[TransactionLogs] ([Address]); +GO + +CREATE INDEX [IX_TransactionLogs_EventHash] ON [sepolia].[TransactionLogs] ([EventHash]); +GO + +CREATE INDEX [IX_TransactionLogs_IndexVal1] ON [sepolia].[TransactionLogs] ([IndexVal1]); +GO + +CREATE INDEX [IX_TransactionLogs_IndexVal2] ON [sepolia].[TransactionLogs] ([IndexVal2]); +GO + +CREATE INDEX [IX_TransactionLogs_IndexVal3] ON [sepolia].[TransactionLogs] ([IndexVal3]); +GO + +CREATE UNIQUE INDEX [IX_TransactionLogs_TransactionHash_LogIndex] ON [sepolia].[TransactionLogs] ([TransactionHash], [LogIndex]) WHERE [LogIndex] IS NOT NULL; +GO + +CREATE INDEX [IX_TransactionLogVmStacks_Address] ON [sepolia].[TransactionLogVmStacks] ([Address]); +GO + +CREATE INDEX [IX_TransactionLogVmStacks_TransactionHash] ON [sepolia].[TransactionLogVmStacks] ([TransactionHash]); +GO + +CREATE INDEX [IX_Transactions_AddressFrom] ON [sepolia].[Transactions] ([AddressFrom]); +GO + +CREATE INDEX [IX_Transactions_AddressTo] ON [sepolia].[Transactions] ([AddressTo]); +GO + +CREATE UNIQUE INDEX [IX_Transactions_BlockNumber_Hash] ON [sepolia].[Transactions] ([BlockNumber], [Hash]); +GO + +CREATE INDEX [IX_Transactions_Hash] ON [sepolia].[Transactions] ([Hash]); +GO + +CREATE INDEX [IX_Transactions_NewContractAddress] ON [sepolia].[Transactions] ([NewContractAddress]); +GO + +INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) +VALUES (N'20221014164550_InitialCreate', N'6.0.10'); +GO + +COMMIT; +GO + diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerBlockchainDbContext.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerBlockchainDbContext.cs index ca77674..b26f1de 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerBlockchainDbContext.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerBlockchainDbContext.cs @@ -41,6 +41,18 @@ public class SqlServerBlockchainDbContext_ropsten : SqlServerBlockchainDbContext public SqlServerBlockchainDbContext_ropsten(string connectionString) : base(connectionString){} } + [DbSchema(DbSchemaNames.goerli)] + public class SqlServerBlockchainDbContext_goerli : SqlServerBlockchainDbContext + { + public SqlServerBlockchainDbContext_goerli(string connectionString) : base(connectionString) { } + } + + [DbSchema(DbSchemaNames.sepolia)] + public class SqlServerBlockchainDbContext_sepolia : SqlServerBlockchainDbContext + { + public SqlServerBlockchainDbContext_sepolia(string connectionString) : base(connectionString) { } + } + public abstract class SqlServerBlockchainDbContext: BlockchainDbContextBase { private readonly string _connectionString; diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerCoreBlockchainDbContextFactory.cs b/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerCoreBlockchainDbContextFactory.cs index 2b374b9..06b2dc7 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerCoreBlockchainDbContextFactory.cs +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/SqlServerCoreBlockchainDbContextFactory.cs @@ -11,7 +11,7 @@ public class SqlServerCoreBlockchainDbContextFactory : IBlockchainDbContextFacto { public const string DbName = "BlockchainDbStorage"; - static readonly Dictionary SchemaToDbContextTypes; + static readonly Dictionary SchemaToDbContextTypes; static SqlServerCoreBlockchainDbContextFactory() { @@ -32,19 +32,21 @@ public static SqlServerCoreBlockchainDbContextFactory Create(IConfigurationRoot private readonly string _connectionString; private readonly Type _typeOfContext; - public SqlServerCoreBlockchainDbContextFactory(string connectionString, string schema): - this(connectionString, (DbSchemaNames)Enum.Parse(typeof(DbSchemaNames), schema)){} - - public SqlServerCoreBlockchainDbContextFactory(string connectionString, DbSchemaNames dbSchemaName) + public SqlServerCoreBlockchainDbContextFactory(string connectionString, string dbSchemaName) { _connectionString = connectionString; - if(!SchemaToDbContextTypes.ContainsKey(dbSchemaName)) + if (!SchemaToDbContextTypes.ContainsKey(dbSchemaName)) throw new Exception($"Unsupported or unknown schema '{dbSchemaName}'. Could not locate a BlockchainDbContext type based on the schema"); _typeOfContext = SchemaToDbContextTypes[dbSchemaName]; } + public SqlServerCoreBlockchainDbContextFactory(string connectionString, DbSchemaNames dbSchemaName):this(connectionString, dbSchemaName.ToString()) + { + + } + public BlockchainDbContextBase CreateContext() { return (BlockchainDbContextBase) Activator.CreateInstance(_typeOfContext, new object[] {_connectionString}); diff --git a/src/Nethereum.BlockchainStore.EFCore.SqlServer/appsettings.json b/src/Nethereum.BlockchainStore.EFCore.SqlServer/appsettings.json index 2269b69..c2bdda4 100644 --- a/src/Nethereum.BlockchainStore.EFCore.SqlServer/appsettings.json +++ b/src/Nethereum.BlockchainStore.EFCore.SqlServer/appsettings.json @@ -1,5 +1,5 @@ { "ConnectionStrings" : { - "BlockchainDbStorageDesignTime" : "Data Source=localhost\\SQLEXPRESS01;Database=BlockchainStorage;Integrated Security=False;User ID=blockchain_storage_admin;Password=eV5YMcv5aoDOsyEtJeCf;Connect Timeout=60;" + "BlockchainDbStorageDesignTime" : "Data Source=localhost\\SQLEXPRESS;Database=BlockchainStorage;Integrated Security=False;User ID=blockchain_storage_admin;Password=eV5YMcv5aoDOsyEtJeCf;Connect Timeout=60;" } } diff --git a/src/Nethereum.BlockchainStore.EFCore.Sqlite.Console/Nethereum.BlockchainStore.EFCore.Sqlite.Console.csproj b/src/Nethereum.BlockchainStore.EFCore.Sqlite.Console/Nethereum.BlockchainStore.EFCore.Sqlite.Console.csproj index 66248f4..61cbf38 100644 --- a/src/Nethereum.BlockchainStore.EFCore.Sqlite.Console/Nethereum.BlockchainStore.EFCore.Sqlite.Console.csproj +++ b/src/Nethereum.BlockchainStore.EFCore.Sqlite.Console/Nethereum.BlockchainStore.EFCore.Sqlite.Console.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/src/Nethereum.BlockchainStore.EFCore.Sqlite.Tests/Nethereum.BlockchainStore.EFCore.Sqlite.Tests.csproj b/src/Nethereum.BlockchainStore.EFCore.Sqlite.Tests/Nethereum.BlockchainStore.EFCore.Sqlite.Tests.csproj index 5c12a0d..91f7ddd 100644 --- a/src/Nethereum.BlockchainStore.EFCore.Sqlite.Tests/Nethereum.BlockchainStore.EFCore.Sqlite.Tests.csproj +++ b/src/Nethereum.BlockchainStore.EFCore.Sqlite.Tests/Nethereum.BlockchainStore.EFCore.Sqlite.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false diff --git a/src/Nethereum.BlockchainStore.EFCore.Sqlite/Nethereum.BlockchainStore.EFCore.Sqlite.csproj b/src/Nethereum.BlockchainStore.EFCore.Sqlite/Nethereum.BlockchainStore.EFCore.Sqlite.csproj index 7ac9134..c53f44f 100644 --- a/src/Nethereum.BlockchainStore.EFCore.Sqlite/Nethereum.BlockchainStore.EFCore.Sqlite.csproj +++ b/src/Nethereum.BlockchainStore.EFCore.Sqlite/Nethereum.BlockchainStore.EFCore.Sqlite.csproj @@ -2,21 +2,13 @@ $(OtherAuthors) - netstandard2.0 + net6.0 Store Ethereum blockchain data in Sqlite using Entity Framework core. - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + diff --git a/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/BlockEntityBuilder.cs b/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/BlockEntityBuilder.cs index dcd7b6f..c0be975 100644 --- a/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/BlockEntityBuilder.cs +++ b/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/BlockEntityBuilder.cs @@ -23,6 +23,8 @@ public void Configure(EntityTypeBuilder entityBuilder) entityBuilder.Property(b => b.GasUsed).IsBigInteger(); entityBuilder.Property(b => b.Timestamp).IsBigInteger(); entityBuilder.Property(b => b.Nonce).IsBigInteger(); + entityBuilder.Property(b => b.BaseFeePerGas).IsBigInteger(); + entityBuilder.HasIndex(b => new {b.BlockNumber, b.Hash}).IsUnique(); } diff --git a/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/TransactionEntityBuilder.cs b/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/TransactionEntityBuilder.cs index 237b153..20c7b91 100644 --- a/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/TransactionEntityBuilder.cs +++ b/src/Nethereum.BlockchainStore.EFCore/EntityBuilders/TransactionEntityBuilder.cs @@ -35,6 +35,15 @@ public void Configure(EntityTypeBuilder entityBuilder) entityBuilder.Property(b => b.GasUsed).IsBigInteger(); entityBuilder.Property(b => b.Nonce).IsBigInteger(); entityBuilder.Property(b => b.CumulativeGasUsed).IsBigInteger(); + + + entityBuilder.Property(b => b.EffectiveGasPrice).IsBigInteger(); + entityBuilder.Property(b => b.MaxFeePerGas).IsBigInteger(); + entityBuilder.Property(b => b.MaxPriorityFeePerGas).IsBigInteger(); + + + + } } } \ No newline at end of file diff --git a/src/Nethereum.BlockchainStore.EFCore/Nethereum.BlockchainStore.EFCore.csproj b/src/Nethereum.BlockchainStore.EFCore/Nethereum.BlockchainStore.EFCore.csproj index 614b9ec..f356ee8 100644 --- a/src/Nethereum.BlockchainStore.EFCore/Nethereum.BlockchainStore.EFCore.csproj +++ b/src/Nethereum.BlockchainStore.EFCore/Nethereum.BlockchainStore.EFCore.csproj @@ -2,24 +2,25 @@ $(OtherAuthors), $(DefaultAuthors) - netstandard2.0 + net6.0 Store Ethereum blockchain data using Entity Framework core. This package only contains the base components. Use the other DB specific packages available for Sqlite, SqlServer etc. - - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - - + + + + diff --git a/src/Nethereum.BlockchainStore.MongoDb.Console/Nethereum.BlockchainStore.MongoDb.Console.csproj b/src/Nethereum.BlockchainStore.MongoDb.Console/Nethereum.BlockchainStore.MongoDb.Console.csproj index 06a8cde..ecc7d1b 100644 --- a/src/Nethereum.BlockchainStore.MongoDb.Console/Nethereum.BlockchainStore.MongoDb.Console.csproj +++ b/src/Nethereum.BlockchainStore.MongoDb.Console/Nethereum.BlockchainStore.MongoDb.Console.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 Nethereum.BlockchainStore.MongoDb.UserSecrets diff --git a/src/Nethereum.BlockchainStore.MongoDb.Tests/Nethereum.BlockchainStore.MongoDb.Tests.csproj b/src/Nethereum.BlockchainStore.MongoDb.Tests/Nethereum.BlockchainStore.MongoDb.Tests.csproj index 9adef44..949c357 100644 --- a/src/Nethereum.BlockchainStore.MongoDb.Tests/Nethereum.BlockchainStore.MongoDb.Tests.csproj +++ b/src/Nethereum.BlockchainStore.MongoDb.Tests/Nethereum.BlockchainStore.MongoDb.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false Nethereum.BlockchainStore.MongoDb.UserSecrets.UnitTests diff --git a/src/Nethereum.BlockchainStore.MongoDb/Nethereum.BlockchainStore.MongoDb.csproj b/src/Nethereum.BlockchainStore.MongoDb/Nethereum.BlockchainStore.MongoDb.csproj index f72a663..587f98f 100644 --- a/src/Nethereum.BlockchainStore.MongoDb/Nethereum.BlockchainStore.MongoDb.csproj +++ b/src/Nethereum.BlockchainStore.MongoDb/Nethereum.BlockchainStore.MongoDb.csproj @@ -1,14 +1,13 @@  - netstandard2.0 + net6.0 RJ MajorDutch, $(DefaultAuthors) Nethereum.BlockchainStore.MongoDb.UserSecrets Store Ethereum block chain data in MongoDB. - @@ -20,4 +19,8 @@ + + + + diff --git a/src/Nethereum.BlockchainStore.Queue.Azure/Nethereum.BlockchainStore.Queue.Azure.csproj b/src/Nethereum.BlockchainStore.Queue.Azure/Nethereum.BlockchainStore.Queue.Azure.csproj index 2944cb9..35680a0 100644 --- a/src/Nethereum.BlockchainStore.Queue.Azure/Nethereum.BlockchainStore.Queue.Azure.csproj +++ b/src/Nethereum.BlockchainStore.Queue.Azure/Nethereum.BlockchainStore.Queue.Azure.csproj @@ -3,7 +3,7 @@ - netstandard2.0 + net6.0 $(DefaultAuthors), $(OtherAuthors) diff --git a/src/Nethereum.BlockchainStore.Queue/Nethereum.BlockchainStore.Queue.csproj b/src/Nethereum.BlockchainStore.Queue/Nethereum.BlockchainStore.Queue.csproj index 9eac49f..84bd810 100644 --- a/src/Nethereum.BlockchainStore.Queue/Nethereum.BlockchainStore.Queue.csproj +++ b/src/Nethereum.BlockchainStore.Queue/Nethereum.BlockchainStore.Queue.csproj @@ -3,12 +3,13 @@ - netstandard2.0 + net6.0 $(DefaultAuthors), $(OtherAuthors) - - - + + + + diff --git a/src/Nethereum.BlockchainStore.Samples/Nethereum.BlockchainStore.Samples.csproj b/src/Nethereum.BlockchainStore.Samples/Nethereum.BlockchainStore.Samples.csproj index 29f1f70..bd38ca4 100644 --- a/src/Nethereum.BlockchainStore.Samples/Nethereum.BlockchainStore.Samples.csproj +++ b/src/Nethereum.BlockchainStore.Samples/Nethereum.BlockchainStore.Samples.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false diff --git a/src/Nethereum.BlockchainStore.Search.Azure/Nethereum.BlockchainStore.Search.Azure.csproj b/src/Nethereum.BlockchainStore.Search.Azure/Nethereum.BlockchainStore.Search.Azure.csproj index feb4456..1505861 100644 --- a/src/Nethereum.BlockchainStore.Search.Azure/Nethereum.BlockchainStore.Search.Azure.csproj +++ b/src/Nethereum.BlockchainStore.Search.Azure/Nethereum.BlockchainStore.Search.Azure.csproj @@ -3,7 +3,7 @@ - netstandard2.0 + net6.0 $(DefaultAuthors), $(OtherAuthors) diff --git a/src/Nethereum.BlockchainStore.Search.Elastic/Nethereum.BlockchainStore.Search.Elastic.csproj b/src/Nethereum.BlockchainStore.Search.Elastic/Nethereum.BlockchainStore.Search.Elastic.csproj index 9ad9f92..45d2793 100644 --- a/src/Nethereum.BlockchainStore.Search.Elastic/Nethereum.BlockchainStore.Search.Elastic.csproj +++ b/src/Nethereum.BlockchainStore.Search.Elastic/Nethereum.BlockchainStore.Search.Elastic.csproj @@ -3,7 +3,7 @@ - netstandard2.0 + net6.0 $(DefaultAuthors), $(OtherAuthors) diff --git a/src/Nethereum.BlockchainStore.Search.Samples/Nethereum.BlockchainStore.Search.Samples.csproj b/src/Nethereum.BlockchainStore.Search.Samples/Nethereum.BlockchainStore.Search.Samples.csproj index 781cfa3..4e184a8 100644 --- a/src/Nethereum.BlockchainStore.Search.Samples/Nethereum.BlockchainStore.Search.Samples.csproj +++ b/src/Nethereum.BlockchainStore.Search.Samples/Nethereum.BlockchainStore.Search.Samples.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 false Nethereum.BlockchainStore.Search.Samples diff --git a/src/Nethereum.BlockchainStore.Search.Tests/Nethereum.BlockchainStore.Search.Tests.csproj b/src/Nethereum.BlockchainStore.Search.Tests/Nethereum.BlockchainStore.Search.Tests.csproj index cdb266b..0242ac6 100644 --- a/src/Nethereum.BlockchainStore.Search.Tests/Nethereum.BlockchainStore.Search.Tests.csproj +++ b/src/Nethereum.BlockchainStore.Search.Tests/Nethereum.BlockchainStore.Search.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 Nethereum.BlockchainStore.Search.Tests false false diff --git a/src/Nethereum.BlockchainStore.Search/Nethereum.BlockchainStore.Search.csproj b/src/Nethereum.BlockchainStore.Search/Nethereum.BlockchainStore.Search.csproj index a01ae02..bc28c81 100644 --- a/src/Nethereum.BlockchainStore.Search/Nethereum.BlockchainStore.Search.csproj +++ b/src/Nethereum.BlockchainStore.Search/Nethereum.BlockchainStore.Search.csproj @@ -2,14 +2,15 @@ $(OtherAuthors) - netstandard2.0 + net6.0 Base library for adding Blockchain data to a search index. Easily index events and transactions with minimal config. Data can be auto mapped to search documents or create your own search DTO's and mapping. Supports filtering to ensure you only index what you want. https://github.com/Nethereum/Nethereum.BlockchainStorage/tree/master/Nethereum.BlockchainStore.Search - - - + + + + diff --git a/src/Nethereum.BlockchainStore.Test.Base/Nethereum.BlockchainStore.Test.Base.csproj b/src/Nethereum.BlockchainStore.Test.Base/Nethereum.BlockchainStore.Test.Base.csproj index 0e7ab13..a56234b 100644 --- a/src/Nethereum.BlockchainStore.Test.Base/Nethereum.BlockchainStore.Test.Base.csproj +++ b/src/Nethereum.BlockchainStore.Test.Base/Nethereum.BlockchainStore.Test.Base.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 diff --git a/src/Nethereum.Configuration.Utils/Nethereum.Microsoft.Configuration.Utils.csproj b/src/Nethereum.Configuration.Utils/Nethereum.Microsoft.Configuration.Utils.csproj index 8f742c5..04b1a05 100644 --- a/src/Nethereum.Configuration.Utils/Nethereum.Microsoft.Configuration.Utils.csproj +++ b/src/Nethereum.Configuration.Utils/Nethereum.Microsoft.Configuration.Utils.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 $(OtherAuthors), $(DefaultAuthors) Nethereum Microsoft Configuration Utils diff --git a/src/Nethereum.Logging.Utils/Nethereum.Microsoft.Logging.Utils.csproj b/src/Nethereum.Logging.Utils/Nethereum.Microsoft.Logging.Utils.csproj index 1e24798..281e3d0 100644 --- a/src/Nethereum.Logging.Utils/Nethereum.Microsoft.Logging.Utils.csproj +++ b/src/Nethereum.Logging.Utils/Nethereum.Microsoft.Logging.Utils.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 $(OtherAuthors), $(DefaultAuthors) Nethereum Microsoft Logging Utils diff --git a/src/buildConf/Generic.props b/src/buildConf/Generic.props index 74f0c31..56a39d3 100644 --- a/src/buildConf/Generic.props +++ b/src/buildConf/Generic.props @@ -15,8 +15,9 @@ false false false - 4.8.0 - 4.8.0 + 4.10.0 + 4.10.0 + true