mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-12 14:05:16 +03:00
Allow 14 digit prefixes for migration directories during `hasura scri… (#11107)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/11092 GitOrigin-RevId: 8d3ab13aa1be37e569822a961119e48e6ce65d01
This commit is contained in:
parent
bfb38caee8
commit
111459bb3b
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user