Hacker News new | ask | show | jobs
by PhilipTrauner 1831 days ago
> This all runs as a pre-commit hook as well.

Keep in mind that this might become problematic for folks that are running Postgres inside Docker on macOS or Windows, as IO performance is quite poor.

I put together a up / down migration validation system a while ago (start up two databases, apply all-1 up migrations on A and all up migrations + final down migration on B) for a pretty sizable schema.

Folks that were using Docker had to wait upwards of two minutes, while natively installed Postgres would finish in under 10sec.

1 comments

Thats good to know.

As long as their database in docker is being incrementally updated (using the same migration scripts as on production which only apply new ones) is this hit only when spinning up a clean docker image?

I'm considering exporting an SQL file whenever we run the migrations for our dev tools / tests to use the one large file. But I haven't found it as easy as export -> import to try it out yet.

> As long as their database in docker is being incrementally updated (using the same migration scripts as on production which only apply new ones) is this hit only when spinning up a clean docker image?

Yes, but being able to quickly return to a known-good state by trashing the database is still useful because getting migrations right without testing them is hard.

Using named volumes helps because they don't need to be bridged through to the host filesystem.