rubenv / sql-migrate

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

Naming migrations #86

Closed ghost closed 5 years ago

ghost commented 7 years ago

Hello,

The naming of the migrations with a timestamp creates usability issues. The Django model us prefixing them with a serially incremented 4 digit number makes figuring out which migration to edit very easy. Compared to figuring out which of the 5-10 migrations I've created recently by staring at very similar dates with no easy to distinguish characteristics. Now I rename the migrations on my own but it would be a nice boon to have this built-in.

0001-initial.sql 
0002-users.sql 
0003-events.sql 
0004-posts.sql

Instead of:

20170711231210-init.sql
20170711231622-users.sql
20170711231630-events.sql
20170711231637-posts.sql

Thanks

rubenv commented 7 years ago

Not exactly sure what you're requesting / proposing?

The first case with numerical prefixes is perfectly supported, so I guess this works as expected?

thebitguru commented 7 years ago

I am new to sql-migrate and assessing it for use in a project, but based on my limited knowledge I am guessing that @ivegotasthma is requesting that the new command should use an incremental numeric prefix instead of the current time. Many other migration tools use this convention (like Django's), so it seems logical.

As you, @rubenv, pointed out there is nothing stopping the developer from renaming or creating new files with the preferred naming convention. Obviously, this is all subjective.