Skip to content

Post-migration script #531

Closed Answered by dossy
s-i-m-o-n-w asked this question in Support
Mar 18, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

If you need a single script executed after executing dbmate, you could wrap your execution of dbmate into a shell script that executes dbmate then executes your additional script. That would be the recommended approach.

If you need a script executed in between individual migration files as dbmate applies them in order, that's not something that dbmate is currently capable of. If dbmate up took a --limit argument to control the number of migrations applied per run, it would be hypothetically possible to write a shell script that invoked dbmate in a loop, applying --limit 1 migration file at a time, until there are no more migrations left to apply.

It sounds like you only need a single scri…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@s-i-m-o-n-w
Comment options

@dossy
Comment options

Answer selected by s-i-m-o-n-w
@s-i-m-o-n-w
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants