goose
goose copied to clipboard
Creating two migrations at the same time
When creating a migration file, goose adds a prefix in timestamp format with precision to the second. If you run the goose create command twice in a second, you will get unexpected behavior:
➜ goose create test
2024/02/29 16:39:34 Created new file: 20240229133934_test.go
➜ goose create test
2024/02/29 16:39:34 goose run: failed to create migration file: %!w(<nil>)
Error in the line https://github.com/pressly/goose/blob/master/create.go#L61
To be honest with the user, I think it is necessary to return an error indicating that such a file already exists.
To be honest with the user, I think it is necessary to return an error indicating that such a file already exists.
Good catch, we should certainly expose a better error like "file already exists".