ensure views are dumped after tables
This commit is contained in:
1 parent
1ba0a7936f
commit
5b3ffd90fc
1 file changed
+11
-3
+11
-3
@@ -1,5 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Source: https://git.rznet.fr/tchivert/scripts
|
||||
# License: MIT
|
||||
|
||||
# This script is used to create a database dump from a Mydumper multipart dump
|
||||
# Usage: ./mydumploader.sh -d <directory> -b <database> [-o <output file>] [-c]
|
||||
|
||||
@@ -54,12 +57,17 @@ echo "CREATE DATABASE IF NOT EXISTS $db;" > $out
|
||||
echo "USE $db;" >> $out
|
||||
|
||||
# Dump schema
|
||||
for file in $(ls $dir | grep $db | grep 'schema' | grep -v 'create'); do
|
||||
for file in $(ls $dir | grep $db | grep 'schema' | grep -v 'create\|view'); do
|
||||
${reader} $dir/$file >> $out
|
||||
done
|
||||
|
||||
# Dump data
|
||||
for file in $(ls $dir | grep $db | grep -v 'schema'); do
|
||||
for file in $(ls $dir | grep $db | grep -v 'schema\|view'); do
|
||||
${reader} $dir/$file >> $out
|
||||
done
|
||||
|
||||
# Dump views
|
||||
for file in $(ls $dir | grep $db | grep 'view'); do
|
||||
${reader} $dir/$file >> $out
|
||||
done
|
||||
|
||||
@@ -69,4 +77,4 @@ if [ $compress ]; then
|
||||
out="${out}.gz"
|
||||
fi
|
||||
|
||||
echo "Database dump created: $out"
|
||||
echo "Database dump created: $out"
|
||||
Reference in new issue
Block a user