~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to database/schema/restoredump.sh

  • Committer: Julian Edwards
  • Date: 2011-07-28 20:46:18 UTC
  • mfrom: (13553 devel)
  • mto: This revision was merged to the branch mainline in revision 13555.
  • Revision ID: julian.edwards@canonical.com-20110728204618-tivj2wx2oa9s32bx
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
#
 
4
# This shell script can be used to restore a production database dump
 
5
 
 
6
DMP=launchpad_prod.20050207.pg_dump
 
7
DBNAME=rest
 
8
 
 
9
pg_restore -l ${DMP} \
 
10
    | grep -v SEQUENCE \
 
11
    | grep -v TABLE \
 
12
    | grep -v ACL \
 
13
    | grep -v INDEX \
 
14
    | grep -v CONSTRAINT \
 
15
    | grep -v VIEW \
 
16
    | grep -v TRIGGER \
 
17
    | grep -v COMMENT \
 
18
    | grep -v ACL \
 
19
    | grep -v BLOBS \
 
20
    > r.listing
 
21
pg_restore -l ${DMP} | grep TABLE >> r.listing
 
22
pg_restore -l ${DMP} | grep VIEW >> r.listing
 
23
pg_restore -l ${DMP} | grep INDEX >> r.listing
 
24
pg_restore -l ${DMP} | grep CONSTRAINT >> r.listing
 
25
pg_restore -l ${DMP} | grep TRIGGER >> r.listing
 
26
pg_restore -l ${DMP} | grep SEQUENCE >> r.listing
 
27
pg_restore -l ${DMP} | grep COMMENT >> r.listing
 
28
pg_restore -l ${DMP} | grep BLOBS >> r.listing
 
29
pg_restore -l ${DMP} | grep ACL >> r.listing
 
30
 
 
31
 
 
32
dropdb ${DBNAME}
 
33
createdb -E UNICODE ${DBNAME}
 
34
pg_restore -U postgres --no-acl --no-owner -L r.listing -d ${DBNAME} -v ${DMP} 2>&1 | grep -v NOTICE
 
35
env LP_DBNAME=${DBNAME} python security.py