karenc / db-migrator

GNU Affero General Public License v3.0
4 stars 5 forks source link

init command default not good for upgrade #18

Closed reedstrm closed 8 years ago

reedstrm commented 8 years ago

The default behavior for the init command (set applied to current timestamp) only fits the use case of a fresh install/database, not the probably more common case of "I'm starting to use db-migrator, and have an existing db that needs migrations"

I'd suggest init just add an empty table, and assume none of the specified migrations are yet applied, perhaps with an option to set the timestamp to current, rather than a default.

karenc commented 8 years ago

This can be done by doing dbmigrator init --version=0.

reedstrm commented 8 years ago

o,k, I'm suggesting it be the default.

mmulich commented 8 years ago

With 0 as the default is used for newly created databases. Because the schema is always up to date, the migrations will have already been applied. It's a bit of a tricky scenario for deploying the first time, but every time after that, you end up with just what you expect from dumbly running the command. That is, "I don't remember what options I'm suppose to use." In interface land, that equates to "don't make me think."