0

I have installed my site on a new server and have installed postgresql. now i am trying to rake the database. and get the following error:

I have this on CentOS 6.5 with ruby 1.93 and Ruby on Rails 3

[root@digihaul3-pc current]# rake db:migrate
rake aborted!
PG::Error: ERROR:  relation "geometry_columns" does not exist
LINE 1: SELECT * FROM geometry_columns WHERE f_table_name='schema_mi...
                      ^
: SELECT * FROM geometry_columns WHERE f_table_name='schema_migrations'

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

uploaded the entire DB folder to one of my sites... you can view it here http://www.digihaul.com/stackoverflow

Here is the right file sorry

# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20130811174830) do

  create_table "archived_loads", :id => false, :force => true do |t|
    t.integer  "id"
    t.integer  "user_id"
    t.spatial  "origin",       :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.spatial  "dest",         :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.integer  "length"
    t.string   "comments"
    t.boolean  "ltl"
    t.decimal  "rate"
    t.datetime "delivery"
    t.datetime "pickup"
    t.integer  "weight"
    t.integer  "equipment_id"
    t.boolean  "covered"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "owner"
    t.boolean  "deleted"
    t.string   "origin_city"
    t.string   "origin_state"
    t.string   "dest_city"
    t.string   "dest_state"
  end

  create_table "archived_trucks", :id => false, :force => true do |t|
    t.integer  "id"
    t.integer  "user_id"
    t.spatial  "origin",       :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.spatial  "dest",         :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.boolean  "covered"
    t.datetime "available"
    t.datetime "expiration"
    t.integer  "equipment_id"
    t.string   "comments"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "owner"
    t.boolean  "deleted"
    t.string   "origin_city"
    t.string   "origin_state"
    t.string   "dest_city"
    t.string   "dest_state"
  end

  create_table "autopost_headers", :force => true do |t|
    t.integer  "company_id"
    t.string   "pickup"
    t.string   "delivery"
    t.string   "dest"
    t.string   "origin"
    t.string   "available"
    t.string   "expiration"
    t.string   "rate"
    t.string   "length"
    t.string   "equipment"
    t.string   "weight"
    t.datetime "created_at", :null => false
    t.datetime "updated_at", :null => false
  end

  create_table "companies", :force => true do |t|
    t.string   "name"
    t.string   "city"
    t.string   "state"
    t.string   "zip"
    t.string   "address"
    t.boolean  "status"
    t.integer  "mc"
    t.string   "dispatch"
    t.string   "fax"
    t.datetime "created_at",   :null => false
    t.datetime "updated_at",   :null => false
    t.string   "credit_score"
  end

  create_table "credit_scores", :force => true do |t|
    t.string   "mc"
    t.string   "fbc"
    t.string   "dbt"
    t.string   "xp"
    t.datetime "created_at", :null => false
    t.datetime "updated_at", :null => false
  end

  create_table "documents", :force => true do |t|
    t.integer  "user_id"
    t.string   "name"
    t.string   "description"
    t.string   "filename"
    t.string   "filetype"
    t.integer  "filesize"
    t.datetime "created_at",  :null => false
    t.datetime "updated_at",  :null => false
  end

  create_table "equipment", :force => true do |t|
    t.string   "code"
    t.string   "name"
    t.string   "description"
    t.string   "altcode"
    t.boolean  "special_type"
    t.datetime "created_at",   :null => false
    t.datetime "updated_at",   :null => false
    t.integer  "parent_id"
  end

  create_table "equipment_notifications", :id => false, :force => true do |t|
    t.integer "equipment_id",    :null => false
    t.integer "notification_id", :null => false
  end

  add_index "equipment_notifications", ["equipment_id", "notification_id"], :name => "index_eq_not_on_equipment_id_and_notification_id", :unique => true
  add_index "equipment_notifications", ["notification_id", "equipment_id"], :name => "index_eq_not_on_notification_id_and_equipment_id", :unique => true

  create_table "equipment_searches", :id => false, :force => true do |t|
    t.integer "equipment_id", :null => false
    t.integer "search_id",    :null => false
  end

  add_index "equipment_searches", ["equipment_id", "search_id"], :name => "index_equipment_searches_on_equipment_id_and_search_id", :unique => true
  add_index "equipment_searches", ["search_id", "equipment_id"], :name => "index_equipment_searches_on_search_id_and_equipment_id", :unique => true

  create_table "lane_analyses", :force => true do |t|
    t.spatial  "origin",       :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.spatial  "dest",         :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.integer  "company_id"
    t.integer  "equipment_id"
    t.integer  "length"
    t.boolean  "ltl"
    t.datetime "created_at",                                                               :null => false
    t.datetime "updated_at",                                                               :null => false
  end

  add_index "lane_analyses", ["company_id"], :name => "index_lane_analyses_on_company_id"
  add_index "lane_analyses", ["dest"], :name => "index_lane_analyses_on_dest", :spatial => true
  add_index "lane_analyses", ["equipment_id"], :name => "index_lane_analyses_on_equipment_id"
  add_index "lane_analyses", ["origin"], :name => "index_lane_analyses_on_origin", :spatial => true

  create_table "leads", :force => true do |t|
    t.integer  "user_id"
    t.integer  "type_id"
    t.string   "post_type"
    t.datetime "created_at", :null => false
    t.datetime "updated_at", :null => false
  end

  add_index "leads", ["type_id"], :name => "index_leads_on_type_id"
  add_index "leads", ["user_id"], :name => "index_leads_on_user_id"

  create_table "loads", :force => true do |t|
    t.integer  "user_id"
    t.spatial  "origin",       :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.spatial  "dest",         :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.integer  "length"
    t.string   "comments"
    t.boolean  "ltl"
    t.decimal  "rate"
    t.datetime "delivery"
    t.datetime "pickup"
    t.integer  "weight"
    t.integer  "equipment_id"
    t.boolean  "covered",                                                                  :default => false, :null => false
    t.datetime "created_at",                                                                                  :null => false
    t.datetime "updated_at",                                                                                  :null => false
    t.integer  "owner"
    t.boolean  "deleted",                                                                  :default => false
    t.string   "origin_city"
    t.string   "origin_state"
    t.string   "dest_city"
    t.string   "dest_state"
  end

  add_index "loads", ["dest"], :name => "index_loads_on_dest", :spatial => true
  add_index "loads", ["equipment_id"], :name => "index_loads_on_equipment_id"

  create_table "locations", :force => true do |t|
    t.spatial  "coords",     :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.string   "city"
    t.string   "state"
    t.string   "zip"
    t.datetime "created_at",                                                             :null => false
    t.datetime "updated_at",                                                             :null => false
    t.string   "cs"
  end

  create_table "messages", :force => true do |t|
    t.integer  "user_id"
    t.string   "message"
    t.integer  "notifier_id"
    t.boolean  "received",    :default => false
    t.datetime "expiration"
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
  end

  create_table "notifications", :force => true do |t|
    t.integer  "user_id"
    t.spatial  "origin",            :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.spatial  "dest",              :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.integer  "length"
    t.boolean  "ltl"
    t.integer  "rate"
    t.datetime "delivery"
    t.datetime "pickup"
    t.integer  "weight"
    t.datetime "available"
    t.datetime "expiration"
    t.datetime "created_at",                                                                    :null => false
    t.datetime "updated_at",                                                                    :null => false
    t.integer  "radius"
    t.string   "notification_type"
  end

  create_table "reports", :force => true do |t|
    t.string   "name"
    t.string   "metric"
    t.integer  "value"
    t.datetime "created_at", :null => false
    t.datetime "updated_at", :null => false
  end

  create_table "searches", :force => true do |t|
    t.datetime "available"
    t.datetime "pickup"
    t.datetime "delivery"
    t.decimal  "rate"
    t.integer  "length"
    t.integer  "user_id"
    t.integer  "weight"
    t.string   "search_type"
    t.boolean  "ltl"
    t.datetime "created_at",                            :null => false
    t.datetime "updated_at",                            :null => false
    t.datetime "expiration"
    t.string   "pickup_operator",     :default => ">="
    t.string   "delivery_operator",   :default => "<="
    t.string   "expiration_operator", :default => "<="
    t.string   "available_operator",  :default => ">="
    t.string   "length_operator",     :default => "<="
    t.string   "rate_operator",       :default => "<="
    t.string   "weight_operator",     :default => "<="
    t.string   "origin_zip"
    t.string   "dest_zip"
    t.integer  "origin_radius"
    t.integer  "dest_radius"
    t.boolean  "saved"
    t.date     "date_posted"
    t.string   "order_by"
    t.integer  "origin_id"
    t.integer  "dest_id"
    t.integer  "results",             :default => 0
    t.string   "origin_states"
    t.string   "dest_states"
  end

  add_index "searches", ["dest_id"], :name => "index_searches_on_dest"
  add_index "searches", ["origin_id"], :name => "index_searches_on_origin"

  create_table "subscriptions", :force => true do |t|
    t.integer  "company_id"
    t.decimal  "price"
    t.integer  "tier_id"
    t.string   "recurrence"
    t.datetime "created_at",        :null => false
    t.datetime "updated_at",        :null => false
    t.string   "paysysid"
    t.integer  "billing_date"
    t.datetime "last_payment_date"
  end

  create_table "testimonials", :force => true do |t|
    t.string   "customer"
    t.text     "description"
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
    t.boolean  "approved",    :default => false
  end

  create_table "tiers", :force => true do |t|
    t.string   "name"
    t.string   "desc"
    t.datetime "created_at", :null => false
    t.datetime "updated_at", :null => false
  end

  create_table "trucks", :force => true do |t|
    t.integer  "user_id"
    t.spatial  "origin",       :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.spatial  "dest",         :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.boolean  "covered",                                                                  :default => false, :null => false
    t.datetime "available"
    t.datetime "expiration"
    t.integer  "equipment_id"
    t.string   "comments"
    t.datetime "created_at",                                                                                  :null => false
    t.datetime "updated_at",                                                                                  :null => false
    t.integer  "owner"
    t.boolean  "deleted",                                                                  :default => false
    t.string   "origin_city"
    t.string   "origin_state"
    t.string   "dest_city"
    t.string   "dest_state"
  end

  create_table "user_preferences", :force => true do |t|
    t.integer  "user_id"
    t.integer  "radius",                 :default => 175
    t.integer  "page_size",              :default => 10
    t.text     "view",                   :default => "table"
    t.boolean  "can_be_email_notified",  :default => false
    t.boolean  "can_be_sms_notified",    :default => false
    t.integer  "max_sms",                :default => 0
    t.integer  "max_email",              :default => 0
    t.integer  "emailed_today",          :default => 0
    t.integer  "smsd_today",             :default => 0
    t.boolean  "can_be_screen_notified", :default => false
    t.datetime "created_at",                                  :null => false
    t.datetime "updated_at",                                  :null => false
    t.text     "provider",               :default => ""
    t.string   "default_sound"
  end

  create_table "users", :force => true do |t|
    t.integer  "company_id"
    t.string   "username"
    t.string   "password"
    t.string   "email"
    t.string   "dispatch"
    t.string   "fax"
    t.string   "sms"
    t.boolean  "status"
    t.boolean  "company_manager"
    t.datetime "created_at",                             :null => false
    t.datetime "updated_at",                             :null => false
    t.string   "encrypted_password",     :default => "", :null => false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          :default => 0
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip"
    t.string   "last_sign_in_ip"
  end

end

here is the outcome

postgres=# DROP EXTENSION postgis;
ERROR:  extension "postgis" does not exist
postgres=# CREATE EXTENSION postgis;
ERROR:  type "spheroid" already exists
postgres=# DROP EXTENSION postgis;
ERROR:  extension "postgis" does not exist
postgres=# CREATE SCHEMA postgis;
ERROR:  schema "postgis" already exists
postgres=# CREATE EXTENSION postgis WITH SCHEMA postgis;
ERROR:  could not load library "/usr/pgsql-9.3/lib/rtpostgis-2.1.so": libhdf5.so.6: cannot open shared object file: No such file or directory

I used find -name to find the files:

[root@digihaul3-pc /]# find -name rtpostgis-2.1.so
./usr/pgsql-9.3/lib/rtpostgis-2.1.so

[root@digihaul3-pc /]# find -name libhdf5.so.6
./usr/lib64/mpich2/lib/libhdf5.so.6
./usr/pgsql-9.3/lib/libhdf5.so.6
./usr/lib/mpich2/lib/libhdf5.so.6

only showing the ones that were not found or blank as you see the dependency is in there twice.

[root@digihaul3-pc /]# ldd /usr/pgsql-9.3/lib/rtpostgis-2.1.so
        linux-vdso.so.1 =>  (0x00007fffcd9ff000)
        libhdf5.so.6 => not found
        libhdf5_hl.so.6 => not found
        libhdf5.so.6 => not found
Big Al Ruby Newbie
  • 69
  • 1
  • 2
  • 14
  • check your migration file for mistakes. Add it to your question plz – kirqe Mar 29 '14 at 21:12
  • The problem is that you haven't created that table yet or you made a typo in your migration file. – kirqe Mar 29 '14 at 21:28
  • uploaded the entire DB folder to one of my sites... you can view it here http://digihaul.com/stackoverflow/ – Big Al Ruby Newbie Mar 29 '14 at 21:30
  • what's the name of migration where you've tried to create schema_migrations? There're too many files. – kirqe Mar 29 '14 at 21:38
  • believe that it is in postgis_scripts... sorry i have been tring to figure this out. i did not program this site and am not really familiar with Ruby, postgresql, or rails... i am a php mysql programmer – Big Al Ruby Newbie Mar 29 '14 at 21:47

1 Answers1

1

PG::Error: ERROR: relation "geometry_columns" does not exist LINE 1: SELECT * FROM geometry_columns WHERE f_table_name='schema_mi... ^ : SELECT * FROM geometry_columns WHERE f_table_name='schema_migrations'

As per the error, geometry_columns table is not present in your database.
It seems like issue with PostGIS installation and may be related to CREATE EXTENSION postgis; query which you need to run at least once.

Please refer to PostGIS instructions here.

EDIT

Try the following steps:

DROP EXTENSION postgis;
CREATE SCHEMA postgis;
CREATE EXTENSION postgis WITH SCHEMA postgis;
Kirti Thorat
  • 52,578
  • 9
  • 101
  • 108