using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Jiaowu.Api.Infrastructure.Persistence.Migrations.MySql { /// public partial class AttendanceCheckInAudit : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AttendanceCheckInAttempts", columns: table => new { Id = table.Column(type: "char(36)", nullable: false), AttendanceSheetId = table.Column(type: "char(36)", nullable: false), StudentId = table.Column(type: "char(36)", nullable: false), CheckInMethod = table.Column(type: "int", nullable: false), IsSuccessful = table.Column(type: "tinyint(1)", nullable: false), FailureCode = table.Column(type: "varchar(64)", maxLength: 64, nullable: true), DeviceIdentifierHash = table.Column(type: "varchar(64)", maxLength: 64, nullable: true), DevicePlatform = table.Column(type: "varchar(32)", maxLength: 32, nullable: true), IpAddress = table.Column(type: "varchar(64)", maxLength: 64, nullable: true), UserAgent = table.Column(type: "varchar(500)", maxLength: 500, nullable: true), RiskFlags = table.Column(type: "varchar(300)", maxLength: 300, nullable: true), Latitude = table.Column(type: "decimal(10,7)", precision: 10, scale: 7, nullable: true), Longitude = table.Column(type: "decimal(10,7)", precision: 10, scale: 7, nullable: true), AccuracyMeters = table.Column(type: "double", nullable: true), DistanceMeters = table.Column(type: "double", nullable: true), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AttendanceCheckInAttempts", x => x.Id); table.ForeignKey( name: "FK_AttendanceCheckInAttempts_AttendanceSheets_AttendanceSheetId", column: x => x.AttendanceSheetId, principalTable: "AttendanceSheets", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AttendanceCheckInAttempts_Students_StudentId", column: x => x.StudentId, principalTable: "Students", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }) .Annotation("MySQL:Charset", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_AttendanceCheckInAttempts_AttendanceSheetId_StudentId_Create~", table: "AttendanceCheckInAttempts", columns: new[] { "AttendanceSheetId", "StudentId", "CreatedAt" }); migrationBuilder.CreateIndex( name: "IX_AttendanceCheckInAttempts_DeviceIdentifierHash_CreatedAt", table: "AttendanceCheckInAttempts", columns: new[] { "DeviceIdentifierHash", "CreatedAt" }); migrationBuilder.CreateIndex( name: "IX_AttendanceCheckInAttempts_IpAddress_CreatedAt", table: "AttendanceCheckInAttempts", columns: new[] { "IpAddress", "CreatedAt" }); migrationBuilder.CreateIndex( name: "IX_AttendanceCheckInAttempts_StudentId", table: "AttendanceCheckInAttempts", column: "StudentId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AttendanceCheckInAttempts"); } } }