From d78821ae12de41f4aff4059f0c4bb95c9160276a Mon Sep 17 00:00:00 2001 From: erezrokah Date: Tue, 29 Jul 2025 13:57:07 +0100 Subject: [PATCH] feat: Better summary of schema changes --- plugins/destination/clickhouse/client/migrate.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/destination/clickhouse/client/migrate.go b/plugins/destination/clickhouse/client/migrate.go index 717e81ee8f89ce..11bff55063ffa2 100644 --- a/plugins/destination/clickhouse/client/migrate.go +++ b/plugins/destination/clickhouse/client/migrate.go @@ -51,10 +51,13 @@ func (c *Client) MigrateTables(ctx context.Context, messages message.WriteMigrat return allTablesChanges[table].forcedMigrationNeeded && !tablesWeCanForceMigrate[table] }) if len(nonAutoMigratableTables) > 0 { - changes := lo.Map(nonAutoMigratableTables, func(table string, _ int) []schema.TableColumnChange { - return allTablesChanges[table].changes - }) - return fmt.Errorf("tables %s with changes %v require migration. Migrate manually or consider using 'migrate_mode: forced'", strings.Join(nonAutoMigratableTables, ","), changes) + changes := lo.FromEntries(lo.Map(nonAutoMigratableTables, func(table string, _ int) lo.Entry[string, []schema.TableColumnChange] { + return lo.Entry[string, []schema.TableColumnChange]{ + Key: table, + Value: allTablesChanges[table].changes, + } + })) + return fmt.Errorf("\nCan't migrate tables automatically, migrate manually or consider using 'migrate_mode: forced'. Non auto migratable tables changes:\n\n%s", schema.GetChangesSummary(changes)) } const maxConcurrentMigrate = 10