Last active
August 29, 2015 19:42
-
-
Save karenc/b92633f62a19b571cf9c to your computer and use it in GitHub Desktop.
Replaced by cnxarchive_db.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 2 ] | |
then | |
echo "Usage: $0 db_user db_name" | |
exit 1 | |
fi | |
DB_USER=$1 | |
DB_NAME=$2 | |
sudo -u postgres dropdb $DB_NAME | |
sudo -u postgres createdb -O $DB_USER $DB_NAME | |
psql -U $DB_USER $DB_NAME -f cnxarchive_dump_without_files.sql | |
cat <<EOF | psql -U $DB_USER $DB_NAME | |
\\copy files FROM 'cnxarchive_index_files.txt' | |
ALTER TABLE module_files DISABLE TRIGGER ALL; | |
\\copy module_files FROM 'cnxarchive_index_module_files.txt' | |
ALTER TABLE module_files ENABLE TRIGGER ALL; | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment