Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 422635f

Browse files
committed
Added a --no-droptables argument.
1 parent 83d0072 commit 422635f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

cli/commands/database

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,21 @@ function database_import() {
164164
fi
165165
fi
166166

167-
output "Dropping any prior tables"
167+
if [ ! $(has_arg --no-droptables) ]; then
168168

169-
if [ ! $(has_arg --dryrun) ]; then
170-
box container exec ${database} mysql -h ${DB_HOST_IP} -u wordpress -pwordpress -Nse "show tables;" wordpress 2>&1 | grep -v "Warning:" > /tmp/mysql-table-list.txt
171-
cat /tmp/mysql-table-list.txt | while read table
172-
do
169+
output "Dropping any prior tables"
170+
171+
if [ ! $(has_arg --dryrun) ]; then
172+
box container exec ${database} mysql -h ${DB_HOST_IP} -u wordpress -pwordpress -Nse "show tables;" wordpress 2>&1 | grep -v "Warning:" > /tmp/mysql-table-list.txt
173+
cat /tmp/mysql-table-list.txt | while read table
174+
do
173175
box container exec ${database} mysql -h ${DB_HOST_IP} -u wordpress -pwordpress -e "drop table $table" wordpress 2>&1 | grep -v "Warning:"
174-
done
175-
rm /tmp/mysql-table-list.txt
176+
done
177+
rm /tmp/mysql-table-list.txt
178+
fi
179+
output "Tables dropped"
180+
176181
fi
177-
output "Tables dropped"
178182

179183
if [ "" != "$(cat "${importfilepath}" | grep "utf8mb4_unicode_520_ci")" ]; then
180184
#

0 commit comments

Comments
 (0)