lukeed / ley

(WIP) Driver-agnostic database migrations
MIT License
260 stars 14 forks source link

Add tip about creating timestamped migration files #4

Closed karlhorky closed 4 years ago

karlhorky commented 4 years ago

Add @lukeed's tip from #2 about creating timestamped migration files to the readme.

mainanick commented 4 years ago

@karlhorky any windows tip?

karlhorky commented 4 years ago

For Windows I generally suggest having a Bash command line installed (so that commands like this just work out of the box).

Either of the following should work well:

lukeed commented 4 years ago

Thanks :) Merging, but will be adding a new command that takes care of this.

karlhorky commented 4 years ago

Great, sounds good, thanks!

lukeed commented 4 years ago

Now available within v0.5.0 ::

# Sequential
$ ley new users  #=> migrations/00000-users.js
$ ley new teams  #=> migrations/00001-teams.js

# Timestamp
$ ley new users --timestamp #=> migrations/1584389617-users.js
$ ley new teams --timestamp #=> migrations/1584389631-teams.js

# Customize Filename / Extension
$ ley new users.ts #=> migrations/#####-users.ts
$ ley new create-teams #=> migrations/#####-create-teams.js
$ ley new "alter admin users" #=> migrations/#####-alter-admin-users.js

# Modify Prefix Length (non-timestamp only)
$ ley new users.ts --length 3 #=> migrations/###-users.ts

Works on Windows, too :)