Running a postgres SQL command during build process

rails
ruby
postgresql

#1

Hi! Swedish developer here, having kind of a big issue with collations in postgres.

We’re building and testing a ruby on rails app with cirleci and we’ve recently hit a spot where we need to do sorting with support for our native special characters (å, ä, ö). This means that we had to change the collation for one column on one table to “sv_SE”, which is no big deal on neither our dev environment nor on heroku where we deploy.

On circleci however we run in to the biggest hurdle. Postgres does not have the “sv_SE” collation built in, and we can’t find any way of adding this in the beginning of our build process.

One option would be to run the needed SQL command as a pre command, but we can’t figure out how to do it. Any ideas?


#2

The easiest way is to build a Postgres image like this one:
https://hub.docker.com/r/skiftet/postgres/~/dockerfile/


#3

Ryan’s guide to building your own Docker image is also very relevant here.


#4