Files
Data-Coupler/CredentialManager/Migrations/20250924155833_AddProfileSchedules.cs
T
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

84 lines
3.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CredentialManager.Migrations
{
/// <inheritdoc />
public partial class AddProfileSchedules : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ProfileSchedules",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
ProfileId = table.Column<int>(type: "INTEGER", nullable: false),
ScheduleType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
ExecuteOnce = table.Column<DateTime>(type: "TEXT", nullable: true),
DailyTime = table.Column<TimeOnly>(type: "TEXT", nullable: true),
WeeklyDays = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
MonthlyDay = table.Column<int>(type: "INTEGER", nullable: true),
IsActive = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: true),
LastExecution = table.Column<DateTime>(type: "TEXT", nullable: true),
NextExecution = table.Column<DateTime>(type: "TEXT", nullable: true),
LastExecutionResult = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
LastExecutionSuccess = table.Column<bool>(type: "INTEGER", nullable: false),
ExecutionCount = table.Column<int>(type: "INTEGER", nullable: false, defaultValue: 0),
CreatedBy = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProfileSchedules", x => x.Id);
table.ForeignKey(
name: "FK_ProfileSchedules_DataCouplerProfiles_ProfileId",
column: x => x.ProfileId,
principalTable: "DataCouplerProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_IsActive",
table: "ProfileSchedules",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_Name",
table: "ProfileSchedules",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_NextExecution",
table: "ProfileSchedules",
column: "NextExecution");
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_ProfileId",
table: "ProfileSchedules",
column: "ProfileId");
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_ScheduleType",
table: "ProfileSchedules",
column: "ScheduleType");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProfileSchedules");
}
}
}