Files
Data-Coupler/CredentialManager/Migrations/20250924173231_AddScheduleExecutionHistory.cs
Alessio d042863a56 feat: Implementazione completa sistema schedulazione con intervalli personalizzati
- Aggiunto supporto schedulazione con intervalli flessibili (secondi/minuti/ore/giorni/settimane/mesi)
- Esteso modello ProfileSchedule con campi IntervalValue e IntervalUnit
- Ottimizzato ScheduledJobService per controlli ogni 30s con esecuzione parallela
- Implementata interfaccia UI completa con anteprima real-time in italiano
- Aggiunta migrazione database AddIntervalSchedulingFields
- Implementati metodi calcolo NextExecutionTime per intervalli
- Aggiunta gestione tracking anti-duplicati e cleanup automatico
- Creata documentazione completa (6 file, 2500+ righe)

Modifiche tecniche:
- ProfileSchedule.cs: Nuovi campi e metodi CalculateNextInterval/GetScheduleDescription
- ScheduledJobService.cs: Ridotto check interval a 30s, aggiunto parallel processing
- ProfileScheduleService.cs: Supporto calcolo intervalli in UpdateNextExecutionTimeAsync
- Scheduling.razor: Aggiunta sezione UI per configurazione intervalli
- Scheduling.razor.cs: Implementato GetIntervalPreview() e gestione stato campi
2025-10-02 01:12:39 +02:00

106 lines
4.7 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CredentialManager.Migrations
{
/// <inheritdoc />
public partial class AddScheduleExecutionHistory : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DestinationDatabaseOverride",
table: "ProfileSchedules",
type: "TEXT",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SourceDatabaseOverride",
table: "ProfileSchedules",
type: "TEXT",
maxLength: 100,
nullable: true);
migrationBuilder.CreateTable(
name: "ScheduleExecutionHistories",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ScheduleId = table.Column<int>(type: "INTEGER", nullable: false),
ProfileId = table.Column<int>(type: "INTEGER", nullable: false),
ProfileName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
StartTime = table.Column<DateTime>(type: "TEXT", nullable: false),
EndTime = table.Column<DateTime>(type: "TEXT", nullable: true),
Status = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
Message = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
RecordsProcessed = table.Column<int>(type: "INTEGER", nullable: false),
RecordsWithErrors = table.Column<int>(type: "INTEGER", nullable: true),
ErrorDetails = table.Column<string>(type: "TEXT", maxLength: 5000, nullable: true),
TriggerType = table.Column<string>(type: "TEXT", maxLength: 20, nullable: false),
TriggeredBy = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
SourceType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
DestinationType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
SourceInfo = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
DestinationInfo = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
AdditionalInfo = table.Column<string>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ScheduleExecutionHistories");
migrationBuilder.DropColumn(
name: "DestinationDatabaseOverride",
table: "ProfileSchedules");
migrationBuilder.DropColumn(
name: "SourceDatabaseOverride",
table: "ProfileSchedules");
}
}
}