feat: Implementa gestione intelligente della chiave sorgente con rilevamento PK
- Aggiunge rilevamento automatico Primary Key per connessioni database - Rimuove completamente il fallback automatico per lato sorgente - Implementa selezione manuale obbligatoria per file e sorgenti non-DB - Migliora UI con suggerimenti intelligenti e feedback visivo - Aggiunge validazione multi-livello (UI, pre-transfer, runtime) - Introduce metodo GetPrimaryKeyFieldAsync in IDatabaseManager - Modifica GenerateSourceKey per richiedere sempre campo specifico - Implementa controllo IsTransferButtonEnabled per validazione form Breaking changes: - La generazione automatica delle chiavi sorgente è stata rimossa - Il campo chiave sorgente è ora obbligatorio quando si usa il sistema associazioni Fixes: Risolve problema di discovery schema vuoto con selezione database
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace CredentialManager.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Aggiunge la tabella RecordAssociations per tracciare le associazioni tra record sorgente e destinazione
|
||||
/// </summary>
|
||||
public partial class AddRecordAssociations : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RecordAssociations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
SourceName = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
SourceType = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
|
||||
SourceKey = table.Column<string>(type: "TEXT", maxLength: 500, nullable: false),
|
||||
DestinationEntity = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
DestinationId = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
|
||||
RestCredentialName = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "datetime('now')"),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
IsActive = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: true),
|
||||
AdditionalInfo = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RecordAssociations", x => x.Id);
|
||||
});
|
||||
|
||||
// Indici per migliorare le performance
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecordAssociations_Unique",
|
||||
table: "RecordAssociations",
|
||||
columns: new[] { "SourceName", "SourceKey", "DestinationEntity" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecordAssociations_SourceType",
|
||||
table: "RecordAssociations",
|
||||
column: "SourceType");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecordAssociations_DestinationEntity",
|
||||
table: "RecordAssociations",
|
||||
column: "DestinationEntity");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecordAssociations_RestCredentialName",
|
||||
table: "RecordAssociations",
|
||||
column: "RestCredentialName");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecordAssociations_IsActive",
|
||||
table: "RecordAssociations",
|
||||
column: "IsActive");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RecordAssociations_CreatedAt",
|
||||
table: "RecordAssociations",
|
||||
column: "CreatedAt");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RecordAssociations");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user