diff options
-rw-r--r-- | scripts/prefix.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/prefix.sh b/scripts/prefix.sh new file mode 100644 index 000000000..00793a8a5 --- /dev/null +++ b/scripts/prefix.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ $# != 2 ]; then + cat >&2 << EOH +This is Drupal database prefixer. + +Usage: + $0 prefix original_db.sql >prefixed_db.sql + +- all tables will prefixed with 'prefix' +EOH + +exit 1; +fi + +PRFX=$1; +sed "s/^CREATE TABLE /CREATE TABLE $PRFX/; + s/^INSERT INTO /INSERT INTO $PRFX/; + s/^REPLACE /REPLACE $PRFX/; + s/^ALTER TABLE /ALTER TABLE $PRFX/" $2 + |