using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CredentialManager.Migrations { /// public partial class AddScheduleExecutionHistory : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "DestinationDatabaseOverride", table: "ProfileSchedules", type: "TEXT", maxLength: 100, nullable: true); migrationBuilder.AddColumn( name: "SourceDatabaseOverride", table: "ProfileSchedules", type: "TEXT", maxLength: 100, nullable: true); migrationBuilder.CreateTable( name: "ScheduleExecutionHistories", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), ScheduleId = table.Column(type: "INTEGER", nullable: false), ProfileId = table.Column(type: "INTEGER", nullable: false), ProfileName = table.Column(type: "TEXT", maxLength: 200, nullable: false), StartTime = table.Column(type: "TEXT", nullable: false), EndTime = table.Column(type: "TEXT", nullable: true), Status = table.Column(type: "TEXT", maxLength: 20, nullable: false), Message = table.Column(type: "TEXT", maxLength: 2000, nullable: true), RecordsProcessed = table.Column(type: "INTEGER", nullable: false), RecordsWithErrors = table.Column(type: "INTEGER", nullable: true), ErrorDetails = table.Column(type: "TEXT", maxLength: 5000, nullable: true), TriggerType = table.Column(type: "TEXT", maxLength: 20, nullable: false), TriggeredBy = table.Column(type: "TEXT", maxLength: 100, nullable: true), SourceType = table.Column(type: "TEXT", maxLength: 50, nullable: true), DestinationType = table.Column(type: "TEXT", maxLength: 50, nullable: true), SourceInfo = table.Column(type: "TEXT", maxLength: 500, nullable: true), DestinationInfo = table.Column(type: "TEXT", maxLength: 500, nullable: true), CreatedAt = table.Column(type: "TEXT", nullable: false), AdditionalInfo = table.Column(type: "TEXT", maxLength: 2000, nullable: true) }, constraints: table => { table.PrimaryKey("PK_ScheduleExecutionHistories", x => x.Id); table.ForeignKey( name: "FK_ScheduleExecutionHistories_ProfileSchedules_ScheduleId", column: x => x.ScheduleId, principalTable: "ProfileSchedules", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ScheduleExecutionHistories_ProfileId", table: "ScheduleExecutionHistories", column: "ProfileId"); migrationBuilder.CreateIndex( name: "IX_ScheduleExecutionHistories_ScheduleId", table: "ScheduleExecutionHistories", column: "ScheduleId"); migrationBuilder.CreateIndex( name: "IX_ScheduleExecutionHistories_StartTime", table: "ScheduleExecutionHistories", column: "StartTime"); migrationBuilder.CreateIndex( name: "IX_ScheduleExecutionHistories_Status", table: "ScheduleExecutionHistories", column: "Status"); migrationBuilder.CreateIndex( name: "IX_ScheduleExecutionHistories_TriggerType", table: "ScheduleExecutionHistories", column: "TriggerType"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ScheduleExecutionHistories"); migrationBuilder.DropColumn( name: "DestinationDatabaseOverride", table: "ProfileSchedules"); migrationBuilder.DropColumn( name: "SourceDatabaseOverride", table: "ProfileSchedules"); } } }