using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql { /// public partial class TeachingTaskGradeAnalytics : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "TeachingTaskGradeStatistics", columns: table => new { Id = table.Column(type: "char(36)", nullable: false), GradeSheetId = table.Column(type: "char(36)", nullable: false), TeachingTaskId = table.Column(type: "char(36)", nullable: false), CourseId = table.Column(type: "char(36)", nullable: false), AcademicTermId = table.Column(type: "char(36)", nullable: false), StudentCount = table.Column(type: "int", nullable: false), PassedCount = table.Column(type: "int", nullable: false), ExcellentCount = table.Column(type: "int", nullable: false), HighestScore = table.Column(type: "decimal(5,1)", precision: 5, scale: 1, nullable: false), AverageScore = table.Column(type: "decimal(5,1)", precision: 5, scale: 1, nullable: false), MedianScore = table.Column(type: "decimal(5,1)", precision: 5, scale: 1, nullable: false), LowestScore = table.Column(type: "decimal(5,1)", precision: 5, scale: 1, nullable: false), StandardDeviation = table.Column(type: "decimal(6,2)", precision: 6, scale: 2, nullable: false), PassRate = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false), ExcellentRate = table.Column(type: "decimal(5,2)", precision: 5, scale: 2, nullable: false), CalculatedAt = table.Column(type: "datetime(6)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TeachingTaskGradeStatistics", x => x.Id); table.ForeignKey( name: "FK_TeachingTaskGradeStatistics_AcademicTerms_AcademicTermId", column: x => x.AcademicTermId, principalTable: "AcademicTerms", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_TeachingTaskGradeStatistics_Courses_CourseId", column: x => x.CourseId, principalTable: "Courses", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_TeachingTaskGradeStatistics_GradeSheets_GradeSheetId", column: x => x.GradeSheetId, principalTable: "GradeSheets", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_TeachingTaskGradeStatistics_TeachingTasks_TeachingTaskId", column: x => x.TeachingTaskId, principalTable: "TeachingTasks", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySQL:Charset", "utf8mb4"); migrationBuilder.CreateTable( name: "TeachingTaskGradeScoreBands", columns: table => new { Id = table.Column(type: "char(36)", nullable: false), TeachingTaskGradeStatisticId = table.Column(type: "char(36)", nullable: false), Label = table.Column(type: "varchar(30)", maxLength: 30, nullable: false), LowerBound = table.Column(type: "decimal(5,1)", precision: 5, scale: 1, nullable: false), UpperBound = table.Column(type: "decimal(5,1)", precision: 5, scale: 1, nullable: true), StudentCount = table.Column(type: "int", nullable: false), SortOrder = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TeachingTaskGradeScoreBands", x => x.Id); table.ForeignKey( name: "FK_TeachingTaskGradeScoreBands_TeachingTaskGradeStatistics_Teac~", column: x => x.TeachingTaskGradeStatisticId, principalTable: "TeachingTaskGradeStatistics", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySQL:Charset", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_TeachingTaskGradeScoreBands_TeachingTaskGradeStatisticId_Sor~", table: "TeachingTaskGradeScoreBands", columns: new[] { "TeachingTaskGradeStatisticId", "SortOrder" }, unique: true); migrationBuilder.CreateIndex( name: "IX_TeachingTaskGradeStatistics_AcademicTermId", table: "TeachingTaskGradeStatistics", column: "AcademicTermId"); migrationBuilder.CreateIndex( name: "IX_TeachingTaskGradeStatistics_CourseId_AcademicTermId", table: "TeachingTaskGradeStatistics", columns: new[] { "CourseId", "AcademicTermId" }); migrationBuilder.CreateIndex( name: "IX_TeachingTaskGradeStatistics_GradeSheetId", table: "TeachingTaskGradeStatistics", column: "GradeSheetId", unique: true); migrationBuilder.CreateIndex( name: "IX_TeachingTaskGradeStatistics_TeachingTaskId", table: "TeachingTaskGradeStatistics", column: "TeachingTaskId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "TeachingTaskGradeScoreBands"); migrationBuilder.DropTable( name: "TeachingTaskGradeStatistics"); } } }