pg_dumps files not working


(Budh Ram Gurung) #1

After running successfully ‘rake spec’, I did

psql DATABASE_NAME < pg_dumps/production-image.sql

to populate as per production data but it broke the application.
Getting following error:

Started GET "/" for 127.0.0.1 at 2013-11-25 15:44:44 +0530
Processing by ListController#latest as HTML
   (6.1ms)  SELECT "groups"."name" FROM "groups"
  Category Load (4.4ms)  SELECT "categories".* FROM "categories" WHERE (NOT categories.read_restricted) ORDER BY "categories"."position" ASC
PG::UndefinedColumn: ERROR:  column categories.read_restricted does not exist
LINE 1: ...LECT "categories".* FROM "categories"  WHERE (NOT categories...
                                                             ^
: SELECT "categories".* FROM "categories"  WHERE (NOT categories.read_restricted)  ORDER BY "categories"."position" ASC
Completed 500 Internal Server Error in 159ms

PG::UndefinedColumn - ERROR:  column categories.read_restricted does not exist
LINE 1: ...LECT "categories".* FROM "categories"  WHERE (NOT categories...

Are these dump files outdated?

Also I am newbie to “discourse”. Do I have to create my own data or there is another way to populate some of the data?


(Régis Hanol) #2

Have you run bundle exec rake db:migrate after importing the dump?


(Budh Ram Gurung) #3

Getting following error now:

==  CreateCasUserInfos: migrating =============================================
-- create_table(:cas_user_infos)
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "cas_user_infos" already exists
: CREATE TABLE "cas_user_infos" ("id" serial primary key, "user_id" integer NOT NULL, "cas_user_id" character varying(255) NOT NULL, "username" character varying(255) NOT NULL, "first_name" character varying(255), "last_name" character varying(255), "email" character varying(255), "gender" character varying(255), "name" character varying(255), "link" character varying(255), "created_at" timestamp, "updated_at" timestamp) /home/budhram/.rvm/gems/ruby-1.9.3-p429/bundler/gems/rack-mini-profiler-740970f50af5/lib/patches/sql_patches.rb:155:in `exec'

What might be the problem?


(Sam Saffron) #4

try dropping the DB, loading it and migrating it.


(Budh Ram Gurung) #5

Thanks @sam. I followed your steps. It worked well.
For reference, I did following steps:

  1. rake db:drop
  2. rake db:create
  3. psql DATABASE_NAME < pg_dumps/production-image.sql
  4. rake db:migrate

(Régis Hanol) #6