using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Web.Migrations { /// public partial class AddAnalysisCacheTables : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "QuestionnaireAnalysisSnapshots", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), QuestionnaireId = table.Column(type: "int", nullable: false), TotalResponses = table.Column(type: "int", nullable: false), AnalyzedResponses = table.Column(type: "int", nullable: false), OverallPositiveSentiment = table.Column(type: "float", nullable: false), OverallNegativeSentiment = table.Column(type: "float", nullable: false), OverallNeutralSentiment = table.Column(type: "float", nullable: false), LowRiskCount = table.Column(type: "int", nullable: false), ModerateRiskCount = table.Column(type: "int", nullable: false), HighRiskCount = table.Column(type: "int", nullable: false), CriticalRiskCount = table.Column(type: "int", nullable: false), ExecutiveSummary = table.Column(type: "nvarchar(max)", nullable: false), TopWorkplaceIssuesJson = table.Column(type: "nvarchar(max)", nullable: false), MostCommonKeyPhrasesJson = table.Column(type: "nvarchar(max)", nullable: false), GeneratedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_QuestionnaireAnalysisSnapshots", x => x.Id); table.ForeignKey( name: "FK_QuestionnaireAnalysisSnapshots_Questionnaires_QuestionnaireId", column: x => x.QuestionnaireId, principalTable: "Questionnaires", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "ResponseAnalyses", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ResponseId = table.Column(type: "int", nullable: false), QuestionId = table.Column(type: "int", nullable: false), QuestionText = table.Column(type: "nvarchar(max)", nullable: false), AnonymizedText = table.Column(type: "nvarchar(max)", nullable: false), SentimentLabel = table.Column(type: "nvarchar(max)", nullable: false), SentimentConfidence = table.Column(type: "float", nullable: false), PositiveScore = table.Column(type: "float", nullable: false), NegativeScore = table.Column(type: "float", nullable: false), NeutralScore = table.Column(type: "float", nullable: false), RiskLevel = table.Column(type: "nvarchar(max)", nullable: false), RiskScore = table.Column(type: "float", nullable: false), RequiresImmediateAttention = table.Column(type: "bit", nullable: false), RecommendedAction = table.Column(type: "nvarchar(max)", nullable: false), RiskIndicatorsJson = table.Column(type: "nvarchar(max)", nullable: false), ProtectiveFactorsJson = table.Column(type: "nvarchar(max)", nullable: false), KeyPhrasesJson = table.Column(type: "nvarchar(max)", nullable: false), WorkplaceFactorsJson = table.Column(type: "nvarchar(max)", nullable: false), EmotionalIndicatorsJson = table.Column(type: "nvarchar(max)", nullable: false), InsightsJson = table.Column(type: "nvarchar(max)", nullable: false), CategoriesJson = table.Column(type: "nvarchar(max)", nullable: false), AnalyzedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ResponseAnalyses", x => x.Id); table.ForeignKey( name: "FK_ResponseAnalyses_Questions_QuestionId", column: x => x.QuestionId, principalTable: "Questions", principalColumn: "Id"); table.ForeignKey( name: "FK_ResponseAnalyses_Responses_ResponseId", column: x => x.ResponseId, principalTable: "Responses", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_QuestionnaireAnalysisSnapshots_QuestionnaireId", table: "QuestionnaireAnalysisSnapshots", column: "QuestionnaireId"); migrationBuilder.CreateIndex( name: "IX_ResponseAnalyses_QuestionId", table: "ResponseAnalyses", column: "QuestionId"); migrationBuilder.CreateIndex( name: "IX_ResponseAnalyses_ResponseId", table: "ResponseAnalyses", column: "ResponseId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "QuestionnaireAnalysisSnapshots"); migrationBuilder.DropTable( name: "ResponseAnalyses"); } } }