migrate icon indicating copy to clipboard operation
migrate copied to clipboard

Add -only-up create command option to skip down migration creation

Open greenpart opened this issue 4 years ago • 5 comments

migrate create -only-up … would help those who use only up migrations instead of up/down pairs.

greenpart avatar Mar 18 '21 00:03 greenpart

What's the motivation for this? Empty migrations are ignored. See: https://github.com/golang-migrate/migrate/blob/master/MIGRATIONS.md

dhui avatar Mar 18 '21 04:03 dhui

New create command flag fills the gap for only up project users.

Only up projects are full-fledged citizens in migrate. They are supported because users can create and use only up migrations while never migrating down. This behaviour is also indirectly documented as deleting down files permitted in some cases.

Common workflow for only up project is to create and commit up files and skip all down files completely (there is no reason to keep many empty files in file tree or vcs). We are encouraging users to use migrate create command but at the same time we are forcing only up project users to delete down files manually or by wrapping migrate create with the side script.

With the -only-up flag migrate will be as safe as it is and more friendly to the only up projects.

greenpart avatar Mar 18 '21 09:03 greenpart

@dhui are you interested in merging? I'll fix tests to meet maligned error then.

greenpart avatar Apr 01 '21 14:04 greenpart

Another vote for this - exactly same rationale. Any chance?

jwhitaker-swiftnav avatar Nov 10 '22 20:11 jwhitaker-swiftnav

any chance to merge this PR?

danielgatis avatar Jun 01 '24 15:06 danielgatis