-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify create command to parse filename of assigned directory to set …
…version properly for timestamp
- Loading branch information
Showing
3 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,8 +44,18 @@ func (s Service) walker(indexPath map[uint64]*Migration) func(string, os.FileInf | |
} | ||
|
||
name := info.Name() | ||
if s.direction != direction.Get(name) { | ||
return nil | ||
d := direction.Get(name) | ||
|
||
if s.direction == direction.Unknown { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
// Collect filename of up in case of unknown direction. | ||
if d != direction.Up { | ||
return nil | ||
} | ||
} else { | ||
// Collect filename of the same direction. | ||
if s.direction != d { | ||
return nil | ||
} | ||
} | ||
|
||
fullname := filepath.Clean(filepath.Join(wd, path)) | ||
|
@@ -284,6 +294,8 @@ func (s *Service) NextMigration(name string) (up *Migration, down *Migration, er | |
v := latest.version + 1 | ||
up.version, down.version = v, v | ||
} | ||
_, file := filepath.Split(latest.name) | ||
verFormat = version.Format(file) | ||
This comment has been minimized.
Sorry, something went wrong.
kaneshin
Author
Member
|
||
} | ||
|
||
// [ver]_[name]_[direction-suffix][.ext] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
生成コマンドのときは
Unknown
パターンだったので、そのときは Up ケースのファイルネームをパースするように修正