Rails 4 - postgresql 9.4 jsonb does not exist

I used rails 4 and postgresql 9.4 in my project. When I ran "rdd & rdc & rdm & rds" and I got this error PG :: UndefinedObject: ERROR: type "jsonb" does not exist , how to solve this error? tell me.

My migration file:

class CreateConsultingLocationDoctorSchedules < ActiveRecord::Migration def change create_table :consulting_location_doctor_schedules do |t| t.belongs_to :consulting_location_doctor t.datetime :schedule_date, null: false t.jsonb :slot_details, index: true, default: {} t.daterange :start_and_end_time, null: false t.datetime :deleted_at t.belongs_to :deleted_by t.timestamps end end end 

Thanks for the help!

+7
postgresql ruby-on-rails-4 jsonb
source share
1 answer

Make sure you are connected to the correct Postgres instance during development.

 rails console ActiveRecord::Base.connection.execute("select version();").first["version"] 

If you are sure that you are using 9.4, you may have two Postgres servers. One 9.4 and older.

I ran into this problem and edited my .yml database and pointed host: 'localhost' .

+6
source share

All Articles