using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace FinlyticTechnicalAnalysis.Migrations { /// public partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "CachedAnalyses", columns: table => new { Isin = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), Ticker = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), AnalysisJson = table.Column(type: "jsonb", nullable: false), CalculatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CachedAnalyses", x => x.Isin); }); migrationBuilder.CreateTable( name: "MacroData", columns: table => new { Symbol = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), Value = table.Column(type: "numeric(18,6)", nullable: false), PreviousClose = table.Column(type: "numeric(18,6)", nullable: false), TrendState = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), LastUpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_MacroData", x => x.Symbol); }); migrationBuilder.CreateTable( name: "MarketCandles", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Symbol = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), Interval = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), Timestamp = table.Column(type: "timestamp with time zone", nullable: false), Open = table.Column(type: "numeric(18,6)", nullable: false), High = table.Column(type: "numeric(18,6)", nullable: false), Low = table.Column(type: "numeric(18,6)", nullable: false), Close = table.Column(type: "numeric(18,6)", nullable: false), Volume = table.Column(type: "bigint", nullable: false), Bid = table.Column(type: "numeric(18,6)", nullable: true), Ask = table.Column(type: "numeric(18,6)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_MarketCandles", x => x.Id); }); migrationBuilder.CreateTable( name: "Settings", columns: table => new { Id = table.Column(type: "uuid", nullable: false), EmaShortPeriod = table.Column(type: "integer", nullable: false), SmaMediumPeriod = table.Column(type: "integer", nullable: false), SmaLongPeriod = table.Column(type: "integer", nullable: false), RsiOverboughtLimit = table.Column(type: "double precision", nullable: false), RsiOversoldLimit = table.Column(type: "double precision", nullable: false), SupertrendMultiplier = table.Column(type: "double precision", nullable: false), UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Settings", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_CachedAnalyses_Isin", table: "CachedAnalyses", column: "Isin"); migrationBuilder.CreateIndex( name: "IX_MarketCandles_Symbol_Interval_Timestamp", table: "MarketCandles", columns: new[] { "Symbol", "Interval", "Timestamp" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "CachedAnalyses"); migrationBuilder.DropTable( name: "MacroData"); migrationBuilder.DropTable( name: "MarketCandles"); migrationBuilder.DropTable( name: "Settings"); } } }