I was looking for a repo from someone I collaborate with, and I'm just trying to start my development environment. One of the migrations has a json attribute, and we use Postgres for dev and production:
class CreateExams < ActiveRecord::Migration def change create_table :exams do |t| t.belongs_to :user t.json :exam t.timestamps end end end
database.yml
development: adapter: postgresql database: examgen_development host: localhost
When I run rake db:migrate , I get an error message that would make me believe PG does not support JSON column types:
PG::Error: ERROR: type "json" does not exist
But I know that Postgres 9.2 supports JSON (i.e. http://www.postgresql.org/docs/devel/static/datatype-json.html ).
Interestingly, when I check the version of PG that I use with "psql", it shows 9.0.4. If I use "postgres", it shows 9.2.1. So I'm not quite sure which version I'm using and how to switch back and forth.
psql --version psql (PostgreSQL) 9.0.4 postgres --version postgres (PostgreSQL) 9.2.1
Does anyone have any thoughts on why I am getting this Postgres error?
source share