using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace FinlyticSentiment.Migrations { /// public partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "article_sentiments", columns: table => new { Id = table.Column(type: "uuid", nullable: false), ArticleId = table.Column(type: "uuid", nullable: false), Isin = table.Column(type: "character varying(12)", maxLength: 12, nullable: false), Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), Sector = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), Label = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), CompoundScore = table.Column(type: "double precision", nullable: false), Confidence = table.Column(type: "double precision", nullable: false), Impact = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), PositiveProbability = table.Column(type: "double precision", nullable: false), NegativeProbability = table.Column(type: "double precision", nullable: false), NeutralProbability = table.Column(type: "double precision", nullable: false), KeyHighlight = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), PublishedAtUtc = table.Column(type: "timestamp with time zone", nullable: false), AnalyzedAtUtc = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_article_sentiments", x => x.Id); }); migrationBuilder.CreateTable( name: "company_sentiment_summaries", columns: table => new { Isin = table.Column(type: "character varying(12)", maxLength: 12, nullable: false), Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: false), Sector = table.Column(type: "character varying(128)", maxLength: 128, nullable: true), CurrentLabel = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), AverageScore = table.Column(type: "double precision", nullable: false), WeightedScore = table.Column(type: "double precision", nullable: false), AverageConfidence = table.Column(type: "double precision", nullable: false), TotalAnalysesCount = table.Column(type: "integer", nullable: false), PositiveCount = table.Column(type: "integer", nullable: false), NegativeCount = table.Column(type: "integer", nullable: false), NeutralCount = table.Column(type: "integer", nullable: false), LatestKeyHighlight = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: true), Trend = table.Column(type: "character varying(32)", maxLength: 32, nullable: true), LastUpdatedUtc = table.Column(type: "timestamp with time zone", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => { table.PrimaryKey("PK_company_sentiment_summaries", x => x.Isin); }); migrationBuilder.CreateTable( name: "DynamicSettings", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Key = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), ValueJson = table.Column(type: "text", nullable: false), ServiceIdentifier = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), LastUpdatedUtc = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_DynamicSettings", x => x.Id); }); migrationBuilder.CreateTable( name: "sector_sentiment_summaries", columns: table => new { Sector = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), CurrentLabel = table.Column(type: "character varying(32)", maxLength: 32, nullable: false), AverageScore = table.Column(type: "double precision", nullable: false), TotalArticlesCount = table.Column(type: "integer", nullable: false), TotalCompaniesCount = table.Column(type: "integer", nullable: false), LastUpdatedUtc = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("PK_sector_sentiment_summaries", x => x.Sector); }); migrationBuilder.CreateIndex( name: "IX_article_sentiments_AnalyzedAtUtc", table: "article_sentiments", column: "AnalyzedAtUtc"); migrationBuilder.CreateIndex( name: "IX_article_sentiments_ArticleId_Isin", table: "article_sentiments", columns: new[] { "ArticleId", "Isin" }, unique: true); migrationBuilder.CreateIndex( name: "IX_article_sentiments_Isin_PublishedAtUtc", table: "article_sentiments", columns: new[] { "Isin", "PublishedAtUtc" }); migrationBuilder.CreateIndex( name: "IX_article_sentiments_Sector", table: "article_sentiments", column: "Sector"); migrationBuilder.CreateIndex( name: "IX_company_sentiment_summaries_LastUpdatedUtc", table: "company_sentiment_summaries", column: "LastUpdatedUtc"); migrationBuilder.CreateIndex( name: "IX_company_sentiment_summaries_Sector", table: "company_sentiment_summaries", column: "Sector"); migrationBuilder.CreateIndex( name: "IX_company_sentiment_summaries_WeightedScore", table: "company_sentiment_summaries", column: "WeightedScore"); migrationBuilder.CreateIndex( name: "IX_DynamicSettings_Key", table: "DynamicSettings", column: "Key", unique: true); migrationBuilder.CreateIndex( name: "IX_sector_sentiment_summaries_LastUpdatedUtc", table: "sector_sentiment_summaries", column: "LastUpdatedUtc"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "article_sentiments"); migrationBuilder.DropTable( name: "company_sentiment_summaries"); migrationBuilder.DropTable( name: "DynamicSettings"); migrationBuilder.DropTable( name: "sector_sentiment_summaries"); } } }