Skip to content

Commit 2ffe5ba

Browse files
committed
Add new action: create-tables
If we have a database, and we wish to import geonames tables, it would be important to not DROP the existing data. So, I propose the creation of a new case "create-tables" for dealing with those situations. Is it ok?
1 parent a9eb55e commit 2ffe5ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

geonames_importer.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ case "$action" in
119119
mysql -h $dbhost -P $dbport -u $dbusername -p$dbpassword $dbname < $dir/geonames_db_struct.sql
120120
;;
121121

122+
create-tables)
123+
echo "Creating tables for database $dbname..."
124+
mysql -h $dbhost -P $dbport -u $dbusername -p$dbpassword -Bse "USE $dbname;"
125+
mysql -h $dbhost -P $dbport -u $dbusername -p$dbpassword $dbname < $dir/geonames_db_struct.sql
126+
;;
127+
122128
import-dumps)
123129
echo "Importing geonames dumps into database $dbname"
124130
mysql -h $dbhost -P $dbport -u $dbusername -p$dbpassword --local-infile=1 $dbname < $dir/geonames_import_data.sql

0 commit comments

Comments
 (0)