A collection of computer systems and programming tips that you may find useful.
 
Brought to you by Craic Computing LLC, a bioinformatics consulting company.

Thursday, September 5, 2013

Adding extensions to Postgresql database with Rails on Heroku

This is a follow up to my previous post Adding extensions to Postgresql database with Rails

If your database is running on Heroku you need to access it slightly differently.

Using the 'rails db' command does not work:
$ heroku run rails db
Running `rails db` attached to terminal... up, run.6499
Couldn't find database client: psql. Check your $PATH and try again.

Instead access psql like this and then add the extension. \dx lists the current installed extensions
$ heroku pg:psql
psql (9.2.1, server 9.1.9)
[...]
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.
dftmhe7vpg4dhs=> create extension unaccent;
CREATE EXTENSION
dftmhe7vpg4dhs=> \dx
                         List of installed extensions
   Name   | Version |   Schema   |                 Description
----------+---------+------------+---------------------------------------------
 plpgsql  | 1.0     | pg_catalog | PL/pgSQL procedural language
 unaccent | 1.0     | public     | text search dictionary that removes accents


Note that this works just fine with a pg:basic database plan. There is no need to upgrade just to use postgres text search.

1 comment:

Blogger said...

If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you need to watch this video
right away...

(VIDEO) Text Your Ex Back?

Archive of Tips