~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
#
# This shell script can be used to restore a production database dump

DMP=launchpad_prod.20050207.pg_dump
DBNAME=rest

pg_restore -l ${DMP} \
    | grep -v SEQUENCE \
    | grep -v TABLE \
    | grep -v ACL \
    | grep -v INDEX \
    | grep -v CONSTRAINT \
    | grep -v VIEW \
    | grep -v TRIGGER \
    | grep -v COMMENT \
    | grep -v ACL \
    | grep -v BLOBS \
    > r.listing
pg_restore -l ${DMP} | grep TABLE >> r.listing
pg_restore -l ${DMP} | grep VIEW >> r.listing
pg_restore -l ${DMP} | grep INDEX >> r.listing
pg_restore -l ${DMP} | grep CONSTRAINT >> r.listing
pg_restore -l ${DMP} | grep TRIGGER >> r.listing
pg_restore -l ${DMP} | grep SEQUENCE >> r.listing
pg_restore -l ${DMP} | grep COMMENT >> r.listing
pg_restore -l ${DMP} | grep BLOBS >> r.listing
pg_restore -l ${DMP} | grep ACL >> r.listing


dropdb ${DBNAME}
createdb -E UNICODE ${DBNAME}
pg_restore -U postgres --no-acl --no-owner -L r.listing -d ${DBNAME} -v ${DMP} 2>&1 | grep -v NOTICE
env LP_DBNAME=${DBNAME} python security.py