From d6a7b6f4da8911ac0a06bcf42748b6becdea8b38 Mon Sep 17 00:00:00 2001 From: Yevgeny Pats <16490766+yevgenypats@users.noreply.github.com> Date: Thu, 16 Feb 2023 15:28:36 +0200 Subject: [PATCH] fix: Better string methods for TableColumnChange --- schema/table.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/schema/table.go b/schema/table.go index 126c7c71fd..e85e3d10d9 100644 --- a/schema/table.go +++ b/schema/table.go @@ -104,7 +104,16 @@ func (t TableColumnChangeType) String() string { } func (t TableColumnChange) String() string { - return fmt.Sprintf("column: %s, type: %s, current: %s, previous: %s", t.ColumnName, t.Type, t.Current, t.Previous) + switch t.Type { + case TableColumnChangeTypeAdd: + return fmt.Sprintf("column: %s, type: %s, current: %s", t.ColumnName, t.Type, t.Current) + case TableColumnChangeTypeUpdate: + return fmt.Sprintf("column: %s, type: %s, current: %s, previous: %s", t.ColumnName, t.Type, t.Current, t.Previous) + case TableColumnChangeTypeRemove: + return fmt.Sprintf("column: %s, type: %s, previous: %s", t.ColumnName, t.Type, t.Previous) + default: + return fmt.Sprintf("column: %s, type: %s, current: %s, previous: %s", t.ColumnName, t.Type, t.Current, t.Previous) + } } func (tt Tables) FilterDfsFunc(include, exclude func(*Table) bool, skipDependentTables bool) Tables {