Skip to content

Commit

Permalink
Merge pull request #5 from greensmith/development
Browse files Browse the repository at this point in the history
showtables was returning crap, add Nse
  • Loading branch information
greensmith authored Sep 21, 2023
2 parents 9b3eec7 + b31daa7 commit 39223be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,12 @@ drop_db_tables() {
# optional, empty tables in target db before import (otherwise can cause errors)
echo "emptying tables in $TARGET_DB_NAME"
# run mysql queries to get all the table names in the database
tables=$(mysql -h $TARGET_DB_HOST -u $TARGET_DB_USER -p$TARGET_DB_PASSWORD $TARGET_DB_NAME -e "show tables")
tables=$(mysql -h $TARGET_DB_HOST -u $TARGET_DB_USER -p$TARGET_DB_PASSWORD $TARGET_DB_NAME -Nse "show tables")
# disable foreign key checks
mysql -h $TARGET_DB_HOST -u $TARGET_DB_USER -p$TARGET_DB_PASSWORD $TARGET_DB_NAME -e "SET FOREIGN_KEY_CHECKS = 0;"
# loop through table names and truncate each table
for table in $tables; do
echo droping table $table
mysql -h $TARGET_DB_HOST -u $TARGET_DB_USER -p$TARGET_DB_PASSWORD $TARGET_DB_NAME -e "drop table $table"
done
# enable foreign key checks
Expand Down

0 comments on commit 39223be

Please sign in to comment.