Should I store DB migration scripts generated via alembic under version control

I use SQLAlchemy and PostgreSQL on my site. For database migration I use alembic. I have some questions regarding the best strategy for this.

  • Do I need to save DB migration scripts under version control?

  • I use Fabric for automatic deployment. Should I run migration scripts manually or can I do this automatically?

+6
source share
2 answers

If you ever want to reuse DB migration scripts - yes, keep them under version control. (Sometimes this also helps with debugging / forensics.)

+5
source

I agree with Mark on version control: there is no reason not to include your migration scripts.

As for Fabric, I prefer to keep migrating from it, or at least in a task that is not called implicitly by other tasks. Therefore, errors cannot be skipped.

+1
source

All Articles