Skip to content

Commit

Permalink
Allow 14 digit prefixes for migration directories during `hasura scri…
Browse files Browse the repository at this point in the history
PR-URL: hasura/graphql-engine-mono#11092
GitOrigin-RevId: 4c0b0adc92cb85827eb60849b43aa86591da0819
  • Loading branch information
SandeepSamba authored and hasura-bot committed Nov 25, 2024
1 parent e3d3029 commit d72fea0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/internal/scripts/update-project-v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func getMatchingFilesAndDirs(fs afero.Fs, parentDir string, matcher func(string)

func isHasuraCLIGeneratedMigration(dirPath string) (bool, error) {
var op errors.Op = "scripts.isHasuraCLIGeneratedMigration"
const regex = `^([0-9]{13})_(.*)$`
const regex = `^([0-9]{13,14})_(.*)$`
match, err := regexp.MatchString(regex, filepath.Base(dirPath))
if err != nil {
return match, errors.E(op, err)
Expand Down
18 changes: 18 additions & 0 deletions cli/internal/scripts/update-project-v3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ func Test_checkIfDirectoryIsMigration(t *testing.T) {
false,
require.NoError,
},
{
"can check if a directory name is a valid migration, 14 chars",
args{
dirPath: "16048559649031_test",
},
true,
false,
require.NoError,
},
{
"can check if a directory name is a valid migration, 15 chars",
args{
dirPath: "160485596490312_test",
},
false,
false,
require.NoError,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit d72fea0

Please sign in to comment.