-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix issues 2972 and 3007 (#3020)
Address two issues: #2972 and #3007: - Correctly handle renamed/deleted stage - Handle data type diff suppression better for text and number in the table resource References: #2972 #3007
- Loading branch information
1 parent
c4db255
commit 1772387
Showing
12 changed files
with
656 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package util | ||
|
||
import "strings" | ||
|
||
// TrimAllPrefixes removes all prefixes from the input. Order matters. | ||
func TrimAllPrefixes(text string, prefixes ...string) string { | ||
result := text | ||
for _, prefix := range prefixes { | ||
result = strings.TrimPrefix(result, prefix) | ||
} | ||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package util | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_TrimAllPrefixes(t *testing.T) { | ||
type test struct { | ||
input string | ||
prefixes []string | ||
expected string | ||
} | ||
|
||
tests := []test{ | ||
{input: "VARCHAR(30)", prefixes: []string{"VARCHAR", "TEXT"}, expected: "(30)"}, | ||
{input: "VARCHAR (30) ", prefixes: []string{"VARCHAR", "TEXT"}, expected: " (30) "}, | ||
{input: "VARCHAR(30)", prefixes: []string{"VARCHAR"}, expected: "(30)"}, | ||
{input: "VARCHAR(30)", prefixes: []string{}, expected: "VARCHAR(30)"}, | ||
{input: "VARCHARVARCHAR(30)", prefixes: []string{"VARCHAR"}, expected: "VARCHAR(30)"}, | ||
{input: "VARCHAR(30)", prefixes: []string{"NUMBER"}, expected: "VARCHAR(30)"}, | ||
{input: "VARCHARTEXT(30)", prefixes: []string{"VARCHAR", "TEXT"}, expected: "(30)"}, | ||
{input: "TEXTVARCHAR(30)", prefixes: []string{"VARCHAR", "TEXT"}, expected: "VARCHAR(30)"}, | ||
} | ||
|
||
for _, tc := range tests { | ||
tc := tc | ||
t.Run(tc.input, func(t *testing.T) { | ||
output := TrimAllPrefixes(tc.input, tc.prefixes...) | ||
require.Equal(t, tc.expected, output) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.