Closed anton7r closed 2 years ago
Yes, I fell for this, too. Frankly, I'm not sure if we should introduce some magic to prevent this 🤔 The implementation would be easy (naively thought). But should we do it?
https://github.com/jackc/tern/blob/master/main.go#L358
name := args[0]
if strings.HasSuffix(name, ".sql") {
name = name[:len(name)-4]
}
What do you think, @jackc?
🤷
It is a simple change. But the current behavior informs the user that they don't need to type the extra four characters. With the auto fix someone could use tern indefinitely and not realize they are typing too much. (I'm big on saving keystrokes.)
I don't feel strongly either way. Definitely a bike shed to debate it very much. If anyone feels strongly enough about it to make a PR I guess I'll merge it.
On second thought, I think you're right 👍 😇
This probably is not considered a bug but it is a small inconvinience nevertheless and it is at the end the user's fault anyway.
when creating a new migration with the
tern new
command if you accidentally write the .sql suffix yourself then the file name will have the .sql suffix twiceExample
when running the following command:
the file it would create would be named:
001_create_user.sql.sql