using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Managing.Infrastructure.Databases.Migrations { /// public partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Backtests", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Identifier = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), RequestId = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), FinalPnl = table.Column(type: "numeric(18,8)", nullable: false), WinRate = table.Column(type: "integer", nullable: false), GrowthPercentage = table.Column(type: "numeric(18,8)", nullable: false), HodlPercentage = table.Column(type: "numeric(18,8)", nullable: false), ConfigJson = table.Column(type: "jsonb", nullable: false), PositionsJson = table.Column(type: "jsonb", nullable: false), SignalsJson = table.Column(type: "jsonb", nullable: false), StartDate = table.Column(type: "timestamp with time zone", nullable: false), EndDate = table.Column(type: "timestamp with time zone", nullable: false), MoneyManagementJson = table.Column(type: "jsonb", nullable: false), UserName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), StatisticsJson = table.Column(type: "jsonb", nullable: true), Fees = table.Column(type: "numeric(18,8)", nullable: false), Score = table.Column(type: "double precision", nullable: false), ScoreMessage = table.Column(type: "text", maxLength: 1000, nullable: false), Metadata = table.Column(type: "text", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Backtests", x => x.Id); }); migrationBuilder.CreateTable( name: "FundingRates", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Ticker = table.Column(type: "integer", nullable: false), Exchange = table.Column(type: "integer", nullable: false), Rate = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), OpenInterest = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), Date = table.Column(type: "timestamp with time zone", nullable: false), Direction = table.Column(type: "integer", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FundingRates", x => x.Id); }); migrationBuilder.CreateTable( name: "Indicators", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Type = table.Column(type: "text", nullable: false), Timeframe = table.Column(type: "text", nullable: false), SignalType = table.Column(type: "text", nullable: false), MinimumHistory = table.Column(type: "integer", nullable: false), Period = table.Column(type: "integer", nullable: true), FastPeriods = table.Column(type: "integer", nullable: true), SlowPeriods = table.Column(type: "integer", nullable: true), SignalPeriods = table.Column(type: "integer", nullable: true), Multiplier = table.Column(type: "double precision", nullable: true), StochPeriods = table.Column(type: "integer", nullable: true), SmoothPeriods = table.Column(type: "integer", nullable: true), CyclePeriods = table.Column(type: "integer", nullable: true), UserName = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Indicators", x => x.Id); }); migrationBuilder.CreateTable( name: "Scenarios", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), LoopbackPeriod = table.Column(type: "integer", nullable: false), UserName = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Scenarios", x => x.Id); }); migrationBuilder.CreateTable( name: "Signals", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Identifier = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Direction = table.Column(type: "text", nullable: false), Confidence = table.Column(type: "text", nullable: false), Date = table.Column(type: "timestamp with time zone", nullable: false), Ticker = table.Column(type: "text", nullable: false), Status = table.Column(type: "text", nullable: false), Timeframe = table.Column(type: "text", nullable: false), Type = table.Column(type: "text", nullable: false), SignalType = table.Column(type: "text", nullable: false), IndicatorName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), UserName = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), CandleJson = table.Column(type: "text", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Signals", x => x.Id); }); migrationBuilder.CreateTable( name: "SpotlightOverviews", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Identifier = table.Column(type: "uuid", nullable: false), DateTime = table.Column(type: "timestamp with time zone", nullable: false), ScenarioCount = table.Column(type: "integer", nullable: false), SpotlightsJson = table.Column(type: "jsonb", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SpotlightOverviews", x => x.Id); }); migrationBuilder.CreateTable( name: "SynthMinersLeaderboards", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Asset = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), TimeIncrement = table.Column(type: "integer", nullable: false), SignalDate = table.Column(type: "timestamp with time zone", nullable: true), IsBacktest = table.Column(type: "boolean", nullable: false), MinersData = table.Column(type: "jsonb", nullable: false), CacheKey = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SynthMinersLeaderboards", x => x.Id); }); migrationBuilder.CreateTable( name: "SynthPredictions", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Asset = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), MinerUid = table.Column(type: "integer", nullable: false), TimeIncrement = table.Column(type: "integer", nullable: false), TimeLength = table.Column(type: "integer", nullable: false), SignalDate = table.Column(type: "timestamp with time zone", nullable: true), IsBacktest = table.Column(type: "boolean", nullable: false), PredictionData = table.Column(type: "jsonb", nullable: false), CacheKey = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SynthPredictions", x => x.Id); }); migrationBuilder.CreateTable( name: "TopVolumeTickers", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Ticker = table.Column(type: "integer", nullable: false), Date = table.Column(type: "timestamp with time zone", nullable: false), Volume = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), Rank = table.Column(type: "integer", nullable: false), Exchange = table.Column(type: "integer", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TopVolumeTickers", x => x.Id); }); migrationBuilder.CreateTable( name: "Traders", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Address = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Winrate = table.Column(type: "integer", nullable: false), Pnl = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), TradeCount = table.Column(type: "integer", nullable: false), AverageWin = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), AverageLoss = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), Roi = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), IsBestTrader = table.Column(type: "boolean", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Traders", x => x.Id); }); migrationBuilder.CreateTable( name: "Trades", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Date = table.Column(type: "timestamp with time zone", nullable: false), Direction = table.Column(type: "text", nullable: false), Status = table.Column(type: "text", nullable: false), TradeType = table.Column(type: "text", nullable: false), Ticker = table.Column(type: "text", nullable: false), Fee = table.Column(type: "numeric(18,8)", nullable: false), Quantity = table.Column(type: "numeric(18,8)", nullable: false), Price = table.Column(type: "numeric(18,8)", nullable: false), Leverage = table.Column(type: "numeric(18,8)", nullable: false), ExchangeOrderId = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), Message = table.Column(type: "text", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Trades", x => x.Id); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), AgentName = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), AvatarUrl = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), TelegramChannel = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Users", x => x.Id); }); migrationBuilder.CreateTable( name: "Workers", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), WorkerType = table.Column(type: "text", nullable: false), StartTime = table.Column(type: "timestamp with time zone", nullable: false), LastRunTime = table.Column(type: "timestamp with time zone", nullable: true), ExecutionCount = table.Column(type: "integer", nullable: false), DelayTicks = table.Column(type: "bigint", nullable: false), IsActive = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Workers", x => x.Id); }); migrationBuilder.CreateTable( name: "ScenarioIndicators", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ScenarioId = table.Column(type: "integer", nullable: false), IndicatorId = table.Column(type: "integer", nullable: false), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ScenarioIndicators", x => x.Id); table.ForeignKey( name: "FK_ScenarioIndicators_Indicators_IndicatorId", column: x => x.IndicatorId, principalTable: "Indicators", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ScenarioIndicators_Scenarios_ScenarioId", column: x => x.ScenarioId, principalTable: "Scenarios", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Positions", columns: table => new { Identifier = table.Column(type: "uuid", nullable: false), Date = table.Column(type: "timestamp with time zone", nullable: false), ProfitAndLoss = table.Column(type: "numeric(18,8)", nullable: false), OriginDirection = table.Column(type: "text", nullable: false), Status = table.Column(type: "text", nullable: false), Ticker = table.Column(type: "text", nullable: false), Initiator = table.Column(type: "text", nullable: false), SignalIdentifier = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), AccountName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), UserName = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), OpenTradeId = table.Column(type: "integer", nullable: true), StopLossTradeId = table.Column(type: "integer", nullable: true), TakeProfit1TradeId = table.Column(type: "integer", nullable: true), TakeProfit2TradeId = table.Column(type: "integer", nullable: true), MoneyManagementJson = table.Column(type: "text", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Positions", x => x.Identifier); table.ForeignKey( name: "FK_Positions_Trades_OpenTradeId", column: x => x.OpenTradeId, principalTable: "Trades", principalColumn: "Id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_Positions_Trades_StopLossTradeId", column: x => x.StopLossTradeId, principalTable: "Trades", principalColumn: "Id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_Positions_Trades_TakeProfit1TradeId", column: x => x.TakeProfit1TradeId, principalTable: "Trades", principalColumn: "Id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_Positions_Trades_TakeProfit2TradeId", column: x => x.TakeProfit2TradeId, principalTable: "Trades", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateTable( name: "Accounts", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Exchange = table.Column(type: "text", nullable: false), Type = table.Column(type: "text", nullable: false), Key = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), Secret = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), UserId = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Accounts", x => x.Id); table.ForeignKey( name: "FK_Accounts_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateTable( name: "AgentSummaries", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(type: "integer", nullable: false), AgentName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), TotalPnL = table.Column(type: "numeric(18,8)", nullable: false), TotalROI = table.Column(type: "numeric(18,8)", nullable: false), Wins = table.Column(type: "integer", nullable: false), Losses = table.Column(type: "integer", nullable: false), Runtime = table.Column(type: "timestamp with time zone", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), ActiveStrategiesCount = table.Column(type: "integer", nullable: false), TotalVolume = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false) }, constraints: table => { table.PrimaryKey("PK_AgentSummaries", x => x.Id); table.ForeignKey( name: "FK_AgentSummaries_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Bots", columns: table => new { Identifier = table.Column(type: "uuid", maxLength: 255, nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Ticker = table.Column(type: "integer", nullable: false), UserId = table.Column(type: "integer", nullable: false), Status = table.Column(type: "text", nullable: false), CreateDate = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), StartupTime = table.Column(type: "timestamp with time zone", nullable: false), TradeWins = table.Column(type: "integer", nullable: false), TradeLosses = table.Column(type: "integer", nullable: false), Pnl = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), Roi = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), Volume = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false), Fees = table.Column(type: "numeric(18,8)", precision: 18, scale: 8, nullable: false) }, constraints: table => { table.PrimaryKey("PK_Bots", x => x.Identifier); table.ForeignKey( name: "FK_Bots_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateTable( name: "BundleBacktestRequests", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), RequestId = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), UserName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), UserId = table.Column(type: "integer", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), Status = table.Column(type: "text", nullable: false), BacktestRequestsJson = table.Column(type: "text", nullable: false), TotalBacktests = table.Column(type: "integer", nullable: false), CompletedBacktests = table.Column(type: "integer", nullable: false), FailedBacktests = table.Column(type: "integer", nullable: false), ErrorMessage = table.Column(type: "text", nullable: true), ProgressInfo = table.Column(type: "text", nullable: true), CurrentBacktest = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), EstimatedTimeRemainingSeconds = table.Column(type: "integer", nullable: true), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), ResultsJson = table.Column(type: "jsonb", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_BundleBacktestRequests", x => x.Id); table.ForeignKey( name: "FK_BundleBacktestRequests_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateTable( name: "GeneticRequests", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), RequestId = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), UserId = table.Column(type: "integer", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), CompletedAt = table.Column(type: "timestamp with time zone", nullable: true), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), Status = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), Ticker = table.Column(type: "text", nullable: false), Timeframe = table.Column(type: "text", nullable: false), StartDate = table.Column(type: "timestamp with time zone", nullable: false), EndDate = table.Column(type: "timestamp with time zone", nullable: false), Balance = table.Column(type: "numeric(18,8)", nullable: false), PopulationSize = table.Column(type: "integer", nullable: false), Generations = table.Column(type: "integer", nullable: false), MutationRate = table.Column(type: "double precision", nullable: false), SelectionMethod = table.Column(type: "text", nullable: false), CrossoverMethod = table.Column(type: "text", nullable: false), MutationMethod = table.Column(type: "text", nullable: false), ElitismPercentage = table.Column(type: "integer", nullable: false), MaxTakeProfit = table.Column(type: "double precision", nullable: false), EligibleIndicatorsJson = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), BestFitness = table.Column(type: "double precision", nullable: true), BestIndividual = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), ErrorMessage = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), ProgressInfo = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), BestChromosome = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), BestFitnessSoFar = table.Column(type: "double precision", nullable: true), CurrentGeneration = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_GeneticRequests", x => x.Id); table.ForeignKey( name: "FK_GeneticRequests_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateTable( name: "MoneyManagements", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Timeframe = table.Column(type: "text", nullable: false), StopLoss = table.Column(type: "numeric(18,8)", nullable: false), TakeProfit = table.Column(type: "numeric(18,8)", nullable: false), Leverage = table.Column(type: "numeric(18,8)", nullable: false), UserName = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), UserId = table.Column(type: "integer", nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_MoneyManagements", x => x.Id); table.ForeignKey( name: "FK_MoneyManagements_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateIndex( name: "IX_Accounts_Name", table: "Accounts", column: "Name", unique: true); migrationBuilder.CreateIndex( name: "IX_Accounts_UserId", table: "Accounts", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_AgentSummaries_AgentName", table: "AgentSummaries", column: "AgentName"); migrationBuilder.CreateIndex( name: "IX_AgentSummaries_TotalPnL", table: "AgentSummaries", column: "TotalPnL"); migrationBuilder.CreateIndex( name: "IX_AgentSummaries_UserId", table: "AgentSummaries", column: "UserId", unique: true); migrationBuilder.CreateIndex( name: "IX_Backtests_Identifier", table: "Backtests", column: "Identifier", unique: true); migrationBuilder.CreateIndex( name: "IX_Backtests_RequestId", table: "Backtests", column: "RequestId"); migrationBuilder.CreateIndex( name: "IX_Backtests_RequestId_Score", table: "Backtests", columns: new[] { "RequestId", "Score" }); migrationBuilder.CreateIndex( name: "IX_Backtests_Score", table: "Backtests", column: "Score"); migrationBuilder.CreateIndex( name: "IX_Backtests_UserName", table: "Backtests", column: "UserName"); migrationBuilder.CreateIndex( name: "IX_Backtests_UserName_Score", table: "Backtests", columns: new[] { "UserName", "Score" }); migrationBuilder.CreateIndex( name: "IX_Bots_Identifier", table: "Bots", column: "Identifier", unique: true); migrationBuilder.CreateIndex( name: "IX_Bots_Status", table: "Bots", column: "Status"); migrationBuilder.CreateIndex( name: "IX_Bots_UserId", table: "Bots", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_BundleBacktestRequests_RequestId", table: "BundleBacktestRequests", column: "RequestId", unique: true); migrationBuilder.CreateIndex( name: "IX_BundleBacktestRequests_Status", table: "BundleBacktestRequests", column: "Status"); migrationBuilder.CreateIndex( name: "IX_BundleBacktestRequests_UserId", table: "BundleBacktestRequests", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_BundleBacktestRequests_UserName", table: "BundleBacktestRequests", column: "UserName"); migrationBuilder.CreateIndex( name: "IX_BundleBacktestRequests_UserName_CreatedAt", table: "BundleBacktestRequests", columns: new[] { "UserName", "CreatedAt" }); migrationBuilder.CreateIndex( name: "IX_FundingRates_Date", table: "FundingRates", column: "Date"); migrationBuilder.CreateIndex( name: "IX_FundingRates_Exchange", table: "FundingRates", column: "Exchange"); migrationBuilder.CreateIndex( name: "IX_FundingRates_Exchange_Date", table: "FundingRates", columns: new[] { "Exchange", "Date" }); migrationBuilder.CreateIndex( name: "IX_FundingRates_Ticker", table: "FundingRates", column: "Ticker"); migrationBuilder.CreateIndex( name: "IX_FundingRates_Ticker_Exchange", table: "FundingRates", columns: new[] { "Ticker", "Exchange" }); migrationBuilder.CreateIndex( name: "IX_FundingRates_Ticker_Exchange_Date", table: "FundingRates", columns: new[] { "Ticker", "Exchange", "Date" }, unique: true); migrationBuilder.CreateIndex( name: "IX_GeneticRequests_RequestId", table: "GeneticRequests", column: "RequestId", unique: true); migrationBuilder.CreateIndex( name: "IX_GeneticRequests_Status", table: "GeneticRequests", column: "Status"); migrationBuilder.CreateIndex( name: "IX_GeneticRequests_UserId", table: "GeneticRequests", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_Indicators_UserName", table: "Indicators", column: "UserName"); migrationBuilder.CreateIndex( name: "IX_Indicators_UserName_Name", table: "Indicators", columns: new[] { "UserName", "Name" }); migrationBuilder.CreateIndex( name: "IX_MoneyManagements_UserId", table: "MoneyManagements", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_MoneyManagements_UserName", table: "MoneyManagements", column: "UserName"); migrationBuilder.CreateIndex( name: "IX_MoneyManagements_UserName_Name", table: "MoneyManagements", columns: new[] { "UserName", "Name" }); migrationBuilder.CreateIndex( name: "IX_Positions_Date", table: "Positions", column: "Date"); migrationBuilder.CreateIndex( name: "IX_Positions_Identifier", table: "Positions", column: "Identifier", unique: true); migrationBuilder.CreateIndex( name: "IX_Positions_OpenTradeId", table: "Positions", column: "OpenTradeId"); migrationBuilder.CreateIndex( name: "IX_Positions_Status", table: "Positions", column: "Status"); migrationBuilder.CreateIndex( name: "IX_Positions_StopLossTradeId", table: "Positions", column: "StopLossTradeId"); migrationBuilder.CreateIndex( name: "IX_Positions_TakeProfit1TradeId", table: "Positions", column: "TakeProfit1TradeId"); migrationBuilder.CreateIndex( name: "IX_Positions_TakeProfit2TradeId", table: "Positions", column: "TakeProfit2TradeId"); migrationBuilder.CreateIndex( name: "IX_Positions_UserName", table: "Positions", column: "UserName"); migrationBuilder.CreateIndex( name: "IX_Positions_UserName_Identifier", table: "Positions", columns: new[] { "UserName", "Identifier" }); migrationBuilder.CreateIndex( name: "IX_ScenarioIndicators_IndicatorId", table: "ScenarioIndicators", column: "IndicatorId"); migrationBuilder.CreateIndex( name: "IX_ScenarioIndicators_ScenarioId_IndicatorId", table: "ScenarioIndicators", columns: new[] { "ScenarioId", "IndicatorId" }, unique: true); migrationBuilder.CreateIndex( name: "IX_Scenarios_UserName", table: "Scenarios", column: "UserName"); migrationBuilder.CreateIndex( name: "IX_Scenarios_UserName_Name", table: "Scenarios", columns: new[] { "UserName", "Name" }); migrationBuilder.CreateIndex( name: "IX_Signals_Date", table: "Signals", column: "Date"); migrationBuilder.CreateIndex( name: "IX_Signals_Identifier", table: "Signals", column: "Identifier"); migrationBuilder.CreateIndex( name: "IX_Signals_Identifier_Date_UserName", table: "Signals", columns: new[] { "Identifier", "Date", "UserName" }, unique: true); migrationBuilder.CreateIndex( name: "IX_Signals_Status", table: "Signals", column: "Status"); migrationBuilder.CreateIndex( name: "IX_Signals_Ticker", table: "Signals", column: "Ticker"); migrationBuilder.CreateIndex( name: "IX_Signals_UserName", table: "Signals", column: "UserName"); migrationBuilder.CreateIndex( name: "IX_Signals_UserName_Date", table: "Signals", columns: new[] { "UserName", "Date" }); migrationBuilder.CreateIndex( name: "IX_SpotlightOverviews_DateTime", table: "SpotlightOverviews", column: "DateTime"); migrationBuilder.CreateIndex( name: "IX_SpotlightOverviews_DateTime_ScenarioCount", table: "SpotlightOverviews", columns: new[] { "DateTime", "ScenarioCount" }); migrationBuilder.CreateIndex( name: "IX_SpotlightOverviews_Identifier", table: "SpotlightOverviews", column: "Identifier", unique: true); migrationBuilder.CreateIndex( name: "IX_SynthMinersLeaderboards_CacheKey", table: "SynthMinersLeaderboards", column: "CacheKey", unique: true); migrationBuilder.CreateIndex( name: "IX_SynthPredictions_CacheKey", table: "SynthPredictions", column: "CacheKey", unique: true); migrationBuilder.CreateIndex( name: "IX_TopVolumeTickers_Date", table: "TopVolumeTickers", column: "Date"); migrationBuilder.CreateIndex( name: "IX_TopVolumeTickers_Date_Rank", table: "TopVolumeTickers", columns: new[] { "Date", "Rank" }); migrationBuilder.CreateIndex( name: "IX_TopVolumeTickers_Exchange", table: "TopVolumeTickers", column: "Exchange"); migrationBuilder.CreateIndex( name: "IX_TopVolumeTickers_Exchange_Date", table: "TopVolumeTickers", columns: new[] { "Exchange", "Date" }); migrationBuilder.CreateIndex( name: "IX_TopVolumeTickers_Ticker", table: "TopVolumeTickers", column: "Ticker"); migrationBuilder.CreateIndex( name: "IX_Traders_Address", table: "Traders", column: "Address"); migrationBuilder.CreateIndex( name: "IX_Traders_Address_IsBestTrader", table: "Traders", columns: new[] { "Address", "IsBestTrader" }, unique: true); migrationBuilder.CreateIndex( name: "IX_Traders_IsBestTrader", table: "Traders", column: "IsBestTrader"); migrationBuilder.CreateIndex( name: "IX_Traders_IsBestTrader_Roi", table: "Traders", columns: new[] { "IsBestTrader", "Roi" }); migrationBuilder.CreateIndex( name: "IX_Traders_IsBestTrader_Winrate", table: "Traders", columns: new[] { "IsBestTrader", "Winrate" }); migrationBuilder.CreateIndex( name: "IX_Traders_Pnl", table: "Traders", column: "Pnl"); migrationBuilder.CreateIndex( name: "IX_Traders_Roi", table: "Traders", column: "Roi"); migrationBuilder.CreateIndex( name: "IX_Traders_Winrate", table: "Traders", column: "Winrate"); migrationBuilder.CreateIndex( name: "IX_Trades_Date", table: "Trades", column: "Date"); migrationBuilder.CreateIndex( name: "IX_Trades_ExchangeOrderId", table: "Trades", column: "ExchangeOrderId"); migrationBuilder.CreateIndex( name: "IX_Trades_Status", table: "Trades", column: "Status"); migrationBuilder.CreateIndex( name: "IX_Workers_WorkerType", table: "Workers", column: "WorkerType", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Accounts"); migrationBuilder.DropTable( name: "AgentSummaries"); migrationBuilder.DropTable( name: "Backtests"); migrationBuilder.DropTable( name: "Bots"); migrationBuilder.DropTable( name: "BundleBacktestRequests"); migrationBuilder.DropTable( name: "FundingRates"); migrationBuilder.DropTable( name: "GeneticRequests"); migrationBuilder.DropTable( name: "MoneyManagements"); migrationBuilder.DropTable( name: "Positions"); migrationBuilder.DropTable( name: "ScenarioIndicators"); migrationBuilder.DropTable( name: "Signals"); migrationBuilder.DropTable( name: "SpotlightOverviews"); migrationBuilder.DropTable( name: "SynthMinersLeaderboards"); migrationBuilder.DropTable( name: "SynthPredictions"); migrationBuilder.DropTable( name: "TopVolumeTickers"); migrationBuilder.DropTable( name: "Traders"); migrationBuilder.DropTable( name: "Workers"); migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "Trades"); migrationBuilder.DropTable( name: "Indicators"); migrationBuilder.DropTable( name: "Scenarios"); } } }