Skip to content

Commit 13eb460

Browse files
authored
feat: Better summary of schema changes (#21166)
#### Summary Similar to #21165
1 parent ae0d083 commit 13eb460

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

plugins/destination/clickhouse/client/migrate.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ func (c *Client) MigrateTables(ctx context.Context, messages message.WriteMigrat
5151
return allTablesChanges[table].forcedMigrationNeeded && !tablesWeCanForceMigrate[table]
5252
})
5353
if len(nonAutoMigratableTables) > 0 {
54-
changes := lo.Map(nonAutoMigratableTables, func(table string, _ int) []schema.TableColumnChange {
55-
return allTablesChanges[table].changes
56-
})
57-
return fmt.Errorf("tables %s with changes %v require migration. Migrate manually or consider using 'migrate_mode: forced'", strings.Join(nonAutoMigratableTables, ","), changes)
54+
changes := lo.FromEntries(lo.Map(nonAutoMigratableTables, func(table string, _ int) lo.Entry[string, []schema.TableColumnChange] {
55+
return lo.Entry[string, []schema.TableColumnChange]{
56+
Key: table,
57+
Value: allTablesChanges[table].changes,
58+
}
59+
}))
60+
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))
5861
}
5962

6063
const maxConcurrentMigrate = 10

0 commit comments

Comments
 (0)