rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.23k stars 280 forks source link

`new command` used to month and day exchanged. #65

Closed lion-man44 closed 7 years ago

lion-man44 commented 7 years ago

Hi.

Please tell me whether it is a bug or a specification.

I tried.

$ sql-migrate new -config=db/dbconfig.yml create_posts

output:

-rw-r--r--  1 user  staff  34  3 15 02:48 20171503024850-create_posts.sql

expect:

-rw-r--r--  1 user  staff  34  3 15 02:48 20170315024850-create_posts.sql

Why are the month and the day exchanged?

rubenv commented 7 years ago

BUG!

Could you send a pull request?

lion-man44 commented 7 years ago

I'm sorry. Sending a pull request will take a long time. It is one hour since I started studying golang.

I understood that this code is spewing out the time of the problem, but I do not know how to fix it.

// command_new.go:79
Time.Now().Format("20060201150405")
lion-man44 commented 7 years ago

small case:

package main

import (
  "fmt"
  "time"
)

func main() {
  fmt.Printf(time.Now().Format("20060201150405"))
}

run:

$ go run github.com/lion-man44/test.go
20171503034857%
rubenv commented 7 years ago

You're wrong, it's trivial nowadays.

Go here: https://github.com/rubenv/sql-migrate/blob/master/sql-migrate/command_new.go And press the little pencil button:

sql-migrate_command_new_go_at_master_ _rubenv_sql-migrate

Takes about 30 seconds to get the job done!

lion-man44 commented 7 years ago

It closes because it was merged.