using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql { /// public partial class AddExperimentClassroomConstraints : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "TeachingTaskAllowedExperimentClassrooms", columns: table => new { TeachingTaskScheduleConstraintId = table.Column(type: "char(36)", nullable: false), ClassroomId = table.Column(type: "char(36)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TeachingTaskAllowedExperimentClassrooms", x => new { x.TeachingTaskScheduleConstraintId, x.ClassroomId }); table.ForeignKey( name: "FK_TeachingTaskAllowedExperimentClassrooms_Classrooms_Classroom~", column: x => x.ClassroomId, principalTable: "Classrooms", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_TeachingTaskAllowedExperimentClassrooms_TeachingTaskSchedule~", column: x => x.TeachingTaskScheduleConstraintId, principalTable: "TeachingTaskScheduleConstraints", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySQL:Charset", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_TeachingTaskAllowedExperimentClassrooms_ClassroomId", table: "TeachingTaskAllowedExperimentClassrooms", column: "ClassroomId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "TeachingTaskAllowedExperimentClassrooms"); } } }