How to run SQL files in a directory in order by file name in PSQL

Viewed 3220

Sort of like this question: Run all SQL files in a directory

I have files like: V1__some_migration.sql, V2__some_other_one.sql, etc

I was wondering how I could loop through and import these in some bash script based on the file name (bonus points if you know a way that works both on UNIX [OS X] and Linux [Ubuntu])

1 Answers
Related