Added cleanout of local tables missing from db dump (assuming they have been created by migrations) and added new switches --no-load and --no-zap to docker/updatedb
- Legacy-Id: 17924
This commit is contained in:
parent
f9ad2346bc
commit
a3bc062952
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
# -*- indent-with-tabs: 1 -*-
|
||||
|
||||
version=0.10
|
||||
program=${0##*/}
|
||||
|
@ -69,11 +70,12 @@ trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)";
|
|||
# Option parsing
|
||||
|
||||
# Options
|
||||
shortopts=DhqvV
|
||||
longopts=no-download,help,quiet,verbose,version
|
||||
shortopts=DLZhqvV
|
||||
longopts=no-download,no-load,no-zap,help,quiet,verbose,version
|
||||
|
||||
LOAD=1
|
||||
DOWNLOAD=1
|
||||
DROP=1
|
||||
QUIET=""
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
|
@ -91,12 +93,13 @@ fi
|
|||
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-d| --download) LOAD="";; # Only download
|
||||
-D| --no-download) DOWNLOAD="";; # Don't download, use existing file
|
||||
-h| --help) usage; exit;; # Show this help, then exit
|
||||
-q| --quiet) QUIET="-q";; # Don't show progress
|
||||
-v| --verbose) VERBOSE=1;; # Be more talkative
|
||||
-V| --version) version; exit;; # Show program version, then exit
|
||||
-D| --no-download) DOWNLOAD="";; #Don't download, use existing file
|
||||
-L| --no-load) LOAD=""; ;; # Don't load the database
|
||||
-Z| --no-zap) DROP="";; # Don't drop new tables
|
||||
-h| --help) usage; exit;; # Show this help, then exit
|
||||
-q| --quiet) QUIET="-q";; # Don't show progress
|
||||
-v| --verbose) VERBOSE=1;; # Be more talkative
|
||||
-V| --version) version; exit;; # Show program version, then exit
|
||||
--) shift; break;;
|
||||
*) die "Internal error, inconsistent option specification: '$1'";;
|
||||
esac
|
||||
|
@ -143,5 +146,13 @@ if [ "$LOAD" ]; then
|
|||
| sed -e 's/ENGINE=MyISAM/ENGINE=InnoDB/' \
|
||||
| $parent/ietf/manage.py dbshell
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ "$DROP" ]; then
|
||||
echo "Dropping tables not in the dump (so migrations can succeed) ..."
|
||||
diff <(zcat $DATADIR/ietf_utf8.sql.gz | grep '^DROP TABLE IF EXISTS' | tr -d '`;' | field 5) \
|
||||
<($parent/ietf/manage.py dbshell <<< 'show tables;' | tail -n +2) \
|
||||
| grep '^>' | awk '{print "drop table if exists", $2, ";";}' \
|
||||
| tee /dev/stderr | $parent/ietf/manage.py dbshell
|
||||
fi
|
Loading…
Reference in a new issue