Showing posts with label Postgres. Show all posts
Showing posts with label Postgres. Show all posts

Friday, 2 August 2013

Restore a postgres database dump

If you want to restore your postgres database from a dump. first cd into the directory where your dump file exist.
Then run the following command in your console.

$ psql -U mypostgresusername -d mydestinationdbname -f mydbdumpfilename.sql


Creating a Postgres admin user

First run this Query on Postgres:

WITH mx AS ( SELECT MAX(id) AS id FROM sch.mytable)
SELECT setval('sch.mytable_id_seq', mx.id) AS curseq
FROM mx; 

Then run this in your console:

$ rake spree_auth:admin:create ?