Merge pull request #218 from CartoDB/add_patches_scripts

Add download and apply patches scripts
remotes/origin/pick_iso_codes
Carla 8 years ago committed by GitHub
commit 33fcae063c

@ -0,0 +1,39 @@
#!/bin/bash
function usage() {
cat <<EOF
Usage:
$(basename $0) DBUSER DBNAME *.sql
E.g:
$(basename $0) development_cartodb_user_87ddf981-25c7-4538-9910-0eb4342f2483 cartodb_dev_user_87ddf981-25c7-4538-9910-0eb4342f2483_db patches/*.sql
EOF
}
if [ "$#" -lt "3" ]; then
usage
exit 1
fi
DBUSER=$1
DBNAME=$2
shift; shift;
DUMP_FILES="$@"
echo
echo "About to import the following files: ${DUMP_FILES}"
for i in $DUMP_FILES; do
echo
echo "Importing ${i}..."
psql \
--username=${DBUSER} \
--dbname=${DBNAME} \
--set=ON_ERROR_STOP=on \
--single-transaction \
--file=${i} || exit 1
echo "Done with ${i}."
echo
done
echo
echo "** Everything OK **"

@ -0,0 +1,16 @@
#!/bin/bash
TARGET_DIR_PATCHES=data_patches
BASE_URL=https://s3.amazonaws.com/data.cartodb.net/geocoding/dumps
VERSION=0.0.1
PATCHES_LIST="20160203_countries_bh_isocode.sql
20160622_countries_synonym_congo.sql"
mkdir -p $TARGET_DIR_PATCHES
for file in $PATCHES_LIST; do
url="${BASE_URL}/${VERSION}/patches/$file"
wget -c --directory-prefix=$TARGET_DIR_PATCHES $url
done
Loading…
Cancel
Save